Thursday, December 16, 2010

Event and output device management, security and system data management

A very important function of a modern operating system is event management. In computer science, an event is a specific action that produces a reaction in some program. If you click the mouse in a certain spot on a program's window, for instance, the program may respond by displaying a menu. Mouse clicks and keystrokes are user-initiated events. Other events may be generated by the operating system itself. For example, a program that displays the current time in a corner of the screen might request a timer event to occur every minute so it can update its display.
It is the operating system's responsibility to route events to the appropriate programs. The programs do not directly communicate with the mouse or keyboard. Instead, the operating system collects all the events and sends messages to the programs that need them.
This separation between application programs and hardware is another example of abstraction. The programs are one level of abstraction removed from the mouse and keyboard. Different keyboards and mice may have different characteristics, but only the operating system needs to deal with that. It handles this with another layer of software between the operating system and devices. Software that acts as a middleman between the operating system and a device is called a device driver. These drivers are provided by the manufacturer of the device.






For output devices, the operating system expects input in a standard format. The job of an input device's driver is to provide the input in that format. This way, the programs that use the input devices can treat them generically, without worrying about who made them or what specific features they may have. The reverse of event management is output device management. Just as the operating system acts as middleman between programs and input devices, it also acts as a middleman between programs and the monitor or printer.
Device drivers exist for output devices too. For output devices, the operating system provides a generic set of commands that programs can use to display or print, and, on the other end, issue display or print commands in a standard format. The device drivers translate this standard output into the commands that the specific printer or graphic card expects.
Writing device drivers is a critical programming job. The graphic card's driver, for example, is probably executed more than any other program in the computer. An excellently designed piece of hardware can still produce a poor user experience if the driver is flawed or does not take advantage of all the device's strengths.
Look at the chain of actions that would occur when a user types a letter in a word processing program. The user presses the S key on the keyboard. The keyboard's device driver communicates this key press to the operating system. The operating system determines that the key press belongs to the word processing program and sends the key press to it. The word processor determines that an S must appear in the display at the current cursor location.
Now, it must update its display. To do so, it communicates back to the operating system. The operating system communicates with the device driver for the system's graphics card. The device driver communicates with the graphics card, which generates the display for the monitor. Thus, even a simple word processor's keystroke involves the interoperation of many pieces of software.
The operating system is involved in many aspects of computer security as well. Perhaps the most obvious aspect of this responsibility is user authentication, which just means positively identifying a user, usually through a user name and password. Some operating systems, like Windows XP, allow multiple user accounts on a single personal computer, and each user can have private folders and files that other users cannot view, modify, or delete. If a computer is connected to a network, the operating system may be required to authenticate the user before the computer can access files across that network.
The operating system also provides security in less obvious ways. As stated earlier, in a multitasking operating system, a single computer can have multiple programs running. A flawed or malicious program could alter the instructions or data of another program, corrupting the data or crashing the program. The operating system enforces rules to keep each program separate. This separation doesn't prevent a program from crashing or corrupting its own data, but it helps to prevent a single program's malfunction from creating system-wide havoc.
Operating systems must store system data. An operating system is installed on a wide variety of computers with different configurations of hardware and software, and these configurations must be tracked. The operating system stores data detailing the kind of CPU in the system, the size of the hard drive, the kind of graphics card, the name of the device driver for each device in the system, and other hardware-related data.
On a system with user accounts, all the account information and user preferences must be stored. The operating system also may offer choices of display resolution, organization of menus, whether certain user actions generate a sound, and so on.
Operating systems also store some application data. Most programs allow the user to customize the interface to some extent, by adding or removing a certain "toolbar," changing the colors used, and so on. This data is stored with the operating system also.

No comments:

Post a Comment