Log in ....Tribune

Monday, August 12, 2002
Feature

User-hardware interface
Sarabjeet Singh Kanwal

AN operating system (OS) is the first software you see when you turn on your computer and the last one when you turn the PC off. It is the software that actually manages the raw hardware, hence acting as an interface between the user and hardware. It directly operates on the hardware and fabricates an environment for the execution of the other programs.

The goals of OS are to:

1) Use hardware in an efficient way ó User programs rely on the facilities provided by OS to gain access to resources of a computer system, such as processor, memory, files, disk space and I/O devices. It keeps track of the status of each resource and decides which application gets the resource, for how long and when. In a multiprogramming system (eg: Windows), where multiple programs competes simultaneously for a limited set of resources, OS resolves conflicting requests for resources in a way to optimise performance and increase productivity of the overall system, keeping the integrity of system preserved.

2) Make system convenient to use ó This is done by providing a stable and consistent way to the application programs to deal with hardware without knowing the details of the hardware. The OS works in a primitive way on the hardware. The code to directly manipulate the hardware (especially I/O devices) is very detailed, tough and awkward, and is a major source of programming difficulty.

To make this point clear, let us take an example of a floppy disk driver. The operating system provides a simple and a nice interface of files and folders of the floppy disk, each with a name. Using the name of a file we can open, read, write and finally close it. How a controller chip of a floppy drive performs this read/write is really complex. The controller chip accepts read/write commands and the commands to move disk arm to the place where read/write is to be done. A laser-beam checks whether the write-protect tab is on or off. When an operation is complete, the controller chip returns status and error information. Hence, a programmer must be aware of these much of details whenever he writes a simple program for I/O. Besides, he should constantly keep track whether the motor is on or off. If it is off, it must be turned on, before read/write function is performed. Also, it canít be left on for long time as it may cause wearing out. This makes programming a nightmare. What an average programmer wants is a simple high-level abstraction to work upon. An abstraction is a concept of hiding too much of the unnecessary details from a user and present a view that is easy to understand and operate. A typical abstraction is just a disk with an interface of files and folders. Details of motor status, laser beam working and disk space management etc should not appear before the user.

OS not only hides these unpleasant hardware details from a programmer, but also saves his time and energy from dealing with interrupts, timers, conflicts, scheduling and errors. OS manages this using a subroutine library called device driver. This view is the equivalent of an extended machine or virtual machine that is easier to program than the underlying hardware.