Concepts with Symbian OS (779878), страница 62
Текст из файла (страница 62)
Describe which characteristics of a file could revealcorruption.3.One method used for system security on mobile phones is a passworded screen-saver application. A screen saver locks the screenafter a period of idle time and any use of the phone makes theapplication ask for a password before allowing use.
Discuss this as amethod of security. How much security does this provide? Is it goodenough for authentication?4.Suppose a program advertised itself as installing a set of cool ringtoneson your mobile phone. You download this program and, whenSymbian OS asks you, you allow installation. You might get ringtoneswhen the program is run, but you also get a process that waits fortwo weeks and then deletes all the files on your phone. How doesSymbian OS v9 catch this type of Trojan horse?5.In 1988, Robert Morris unleashed an infamous attack on the Internetwith a worm of his design.
It brought down thousands of computers and he eventually got a sentence of three years of probation,400 hours of community service, a fine of $10 050 and the cost ofhis probationary supervision. Make an argument for or against thisjudgment.6.What steps should an administrator of a computer hooked to theInternet take to secure his system?7.What steps should a Symbian OS smartphone user take to secure hersmartphone system?15Virtual MachinesMany science-fiction stories have a ‘virtual reality’ premise. A person or acommunity lives and works in an environment they believe is their wholeworld.
One day, they stumble upon evidence that their world is not whatthey think it is. In fact, they discover that their ‘world’ is really just acontained environment within a larger world, usually much different fromtheir own.This is the idea behind a virtual machine. The applications hostedby the machine assume that it is a real computer, with operational andfunctional components that a real computer has. In reality, it is probablyan emulated computer, with components also emulated by software orconnected through a larger operating system to hardware.
There areseveral reasons to use a virtual machine and the implementation of avirtual machine poses certain challenges to operating system design (bothfor the virtual machine itself and the host operating system).This chapter discusses these issues in detail. This topic is a greatway to review and apply the principles from this book. We discussthe basic concepts of virtual machines, including the need for themand the challenges they represent.
We also pay specific attention toimplementation of the Java virtual machine on Symbian OS.15.1Basic ConceptsWe have discussed operating systems as layers or interfaces that provideprograms a way to interact with hardware. Through various models and300VIRTUAL MACHINESimplementations, operating systems provide an environment for multipleprograms to run at once and to access hardware in an organized andshared manner. The layers in the structure that is built by an operatingsystem look like those in Figure 15.1.Processes access the hardware by making system calls, which arerequests that are serviced by the kernel and responded to as the kernelinteracts with the computer’s hardware. The kernel takes active steps thatcoordinate hardware use: scheduling the shared CPU, for example, orvirtual memory techniques that allow memory to be shared.What if programs carried this operating structure further to allow otherprograms to act as an operating system and execute other programs?For example, what if an operating system ran inside another operatingsystem? This would mean one of the processes executed by an operatingsystem would actually be another operating system that also ran programs.This idea is called a virtual machine and represents another layer to gothrough in accessing the computer’s hardware.
Figure 15.2 shows thistype of environment.In order for a program on a virtual machine to access hardware, thereare now multiple layers to go through, each of which is implementing itsown access mechanisms and its own view of hardware.As you can imagine, discussing the same concepts for operatingsystems-within-operating-systems can get quite confusing. We call thebottom kernel level the host operating system and the hosted virtualmachine the virtual operating system.ProgramsKernelHardwareFigure 15.1Relationships between hardware, operating system and programsBASIC CONCEPTS301ProgramsProgramsProgramsVirtual kernelVirtual kernelVirtual kernelVirtual hardwareKernelHardwareFigure 15.2 Relationships between hardware, operating system and virtual machinesThe Need for Virtual MachinesThere are several reasons why virtual machines are handy devices to use.Most of these reasons center on a virtual machine as a contained environment that controls access to the host operating system and hardware.Sheltering system resources from accidental abuse is a prime advantageof virtual machines.
A virtual machine is a contained environment,accessing the host operating system through fixed, constrained methods.Each virtual machine is isolated from all the others by the host operatingsystem’s memory management and protection mechanisms.
A virtualmachine is a great place to run untrusted applications – ones that havethe potential to ruin an operating environment.A protected and isolated environment is an excellent arena for development of new system software – particularly new operating systems.Operating system designers face a recursive problem: operating systemsneed hardware for design and testing, but hardware needs an operatingsystem to allow design and testing. This catch-22 situation is remedied302VIRTUAL MACHINESnicely by a virtual machine environment.
Each operating system designcan be done in its own virtual machine environment. The designer cancontrol the parameters of the environment and the testing of the operatingsystem. The host operating system is untouched.This is especially useful when the hardware is also being designedand tested. New hardware requires a new layer – one that provides theoperating system an emulated hardware environment. A virtual machineallows the hardware to be tested with real operating system softwarewithout expensive building and rebuilding of hardware. Note here that‘hardware’ is a misnomer; the hardware design is tested by the softwareemulated environment in a virtual machine.Virtual machines also allow for software to be developed more easily for less-accessible systems.
Symbian OS is a good example. Thedevelopment environment for Symbian OS software has always providedan emulation environment: Symbian OS running on emulated hardwarecontained in a Microsoft Windows operating system. This virtual machineallows software to be developed using tools that run in Microsoft Windows while the software itself can be tested and executed by the SymbianOS emulator. Since Symbian smartphones are not designed to allowgeneral-purpose software development, the virtual machine approach isthe best way to facilitate new software.Virtual machines are used to bridge system incompatibilities. Considerthis scenario. For various reasons, you must upgrade your computerto Microsoft Windows XP but you have an essential software packagethat only runs in Microsoft Windows 2000.
Rather than buying a newcomputer just for this software package or finding a new version of thepackage that runs in Windows XP, you could install a Windows 2000 ona virtual machine and run this essential software there. Virtual machinesoftware from companies such as VMware and Moka5 provide this kindof virtual platform.Virtual machines have recently been used as execution platforms.Increasingly, we see more interpreted programming languages which aredesigned to produce executable code that runs on a virtual machinethat makes the code platform-independent.
That is, when you compilea program in a language targeted to a virtual machine, that programexecutes on any computer that can run the virtual machine. The originalprogram does not need to be recompiled. (The illusive ‘write once, runeverywhere’ goal is achieved successfully to a certain extent, with realisticrestrictions.)BASIC CONCEPTS303Virtual Environments Are EverywhereVirtual machines exist throughout an operating system.
In fact, it isusually the operating system’s goal to create a virtual machine for everyprogram. The environment a process runs in is designed to make thatprocess believe it is running alone on the computer’s CPU and has allmemory at its disposal – a virtual environment. Communication stacksemploy abstraction to make virtual environments – the ‘machine’ at acertain layer in the stack is supposed to operate as if it is communicatingwith the corresponding ‘machine’ at the same layer on another computer.Abstraction is used in many areas of an operating system – from messagingto I/O – to make virtual environments out of the raw hardware interface.ImplementationVirtual machines can be implemented in two ways.
They can be designedto run on the same hardware as the host operating system or they canbe designed to run on an entirely different hardware architecture. Both ofthese cases are illustrated in Figure 15.2.If a virtual machine requires a hardware architecture that is different from the host architecture, then that hardware layer is usuallyimplemented first. This is a difficult task, because the hardware must beemulated exactly, especially when I/O and hardware features (e.g., timers)are important.
However, it is also a very liberating task. It frees designersto build an architecture of their own design, with unique capabilities thatmight be unavailable if the architecture were actually built. For example,the Java virtual machine features interesting architectural aspects – suchas a memory pool for constants and typed registers – that have provenquite expensive to build yet work well in software.The software layer represents the operating system on the virtualmachine.