Role of operating systems
Operating systems manage a computer's resources—memory, peripheral devices, and even CPU access—and provide a battery of services to the user's programs. UNIX, first developed for minicomputers and now widely used on both PCs and mainframes, is one example; Linux (a version of UNIX), Microsoft Corporation's Windows XP, and Apple Computer's OS X are others.One may think of an operating system as a set of concentric shells. At the centre is the bare processor, surrounded by layers of operating system routines to manage input/output (I/O), memory access, multiple processes, and communication among processes. User programs are located in the outermost layers. Each layer insulates its inner layer from direct access, while providing services to its outer layer. This architecture frees outer layers from having to know all the details of lower-level operations, while protecting inner layers and their essential services from interference.
Early computers had no operating system. A user loaded a program from paper tape by employing switches to specify its memory address, to start loading, and to run the program. When the program finished, the computer halted. The programmer had to have knowledge of every computer detail, such as how much memory it had and the characteristics of I/O devices used by the program.
It was quickly realized that this was an inefficient use of resources, particularly as the CPU was largely idle while waiting for relatively slow I/O devices to finish tasks such as reading and writing data. If instead several programs could be loaded at once and coordinated to interleave their steps of computation and I/O, more work could be done. The earliest operating systems were small supervisor programs that did just that: they coordinated several programs, accepting commands from the operator, and provided them all with basic I/O operations. These were known as multiprogrammed systems.
A multiprogrammed system must schedule its programs according to some priority rule, such as “shortest jobs first.” It must protect them from mutual interference to prevent an addressing error in a program from corrupting the data or code of another. It must ensure noninterference during I/O so that output from several programs does not get commingled or input misdirected. It might also have to record the CPU time of each job for billing purposes.
Modern types of operating systems
Multiuser systems
An extension of multiprogramming systems was developed in the 1960s, known variously as multiuser or time-sharing systems. (For a history of this development, see the section Time-sharing from Project MAC to UNIX.) Time-sharing allows many people to interact with a computer at once, each getting a small portion of the CPU's time. If the CPU is fast enough, it will appear to be dedicated to each user, particularly as a computer can perform many functions while waiting for each user to finish typing the latest commands.Multiuser operating systems employ a technique known as multiprocessing, or multitasking (as do most single-user systems today), in which even a single program may consist of many separate computational activities, called processes. The system must keep track of active and queued processes, when each process must access secondary memory to retrieve and store its code and data, and the allocation of other resources, such as peripheral devices.
Since main memory was very limited, early operating systems had to be as small as possible to leave room for other programs. To overcome some of this limitation, operating systems use virtual memory, one of many computing techniques developed during the late 1950s under the direction of Tom Kilburn at the University of Manchester, England. Virtual memory gives each process a large address space (memory that it may use), often much larger than the actual main memory. This address space resides in secondary memory (such as tape or disks), from which portions are copied into main memory as needed, updated as necessary, and returned when a process is no longer active. Even with virtual memory, however, some “kernel” of the operating system has to remain in main memory. Early UNIX kernels occupied tens of kilobytes; today they occupy more than a megabyte, and PC operating systems are comparable, largely because of the declining cost of main memory.
Operating systems have to maintain virtual memory tables to keep track of where each process's address space resides, and modern CPUs provide special registers to make this more efficient. Indeed, much of an operating system consists of tables: tables of processes, of files and their locations (directories), of resources used by each process, and so on. There are also tables of user accounts and passwords that help control access to the user's files and protect them against accidental or malicious interference.
Thin systems
While minimizing the memory requirements of operating systems for standard computers has been important, it has been absolutely essential for small, inexpensive, specialized devices such as personal digital assistants (PDAs), “smart” cellular telephones, portable devices for listening to compressed music files, and Internet kiosks. Such devices must be highly reliable, fast, and secure against break-ins or corruption—a cellular telephone that “freezes” in the middle of calls would not be tolerated. One might argue that these traits should characterize any operating system, but PC users seem to have become quite tolerant of frequent operating system failures that require restarts.Reactive systems
Still more limited are embedded, or real-time, systems. These are small systems that run the control processors embedded in machinery from factory production lines to home appliances. They interact with their environment, taking in data from sensors and making appropriate responses. Embedded systems are known as “hard” real-time systems if they must guarantee schedules that handle all events even in a worst case and “soft” if missed deadlines are not fatal. An aircraft control system is a hard real-time system, as a single flight error might be fatal. An airline reservation system, on the other hand, is a soft real-time system, since a missed booking is rarely catastrophic.Many of the features of modern CPUs and operating systems are inappropriate for hard real-time systems. For example, pipelines and superscalar multiple execution units give high performance at the expense of occasional delays when a branch prediction fails and a pipeline is filled with unneeded instructions. Likewise, virtual memory and caches give good memory-access times on the average, but sometimes they are slow. Such variability is inimical to meeting demanding real-time schedules, and so embedded processors and their operating systems must generally be relatively simple.
No comments:
Post a Comment