Friday, October 17, 2008

OPERATING SYSTEMS

OPERATING SYSTEM

Operating system is an integrated set of programs that controls the resources (CPU, memory, input, output devices etc.) of a computer system and provides its user with an interface or virtual machine that is easier to use than the bare machine. According to this definition, the two primary objectives of an operating system are:

1. Make a computer system easier to use. An operating system hides details of hardware resources from programmers and other users and provides them with a convenient interface for using a computer system. It acts as an intermediary between the hardware and its users, providing high level interface to low level hardware resources, and making it easier for programmers and other users to use those resources.

2. Manage the resources of a computer system. An operating system manages all the resources of a computer system. This involves performing such tasks as keeping track of who is using what resources, granting resource requests, accounting for resource usage, and mediating conflicting requests from different programs and users. Efficient and fair sharing of system resources among users and /or programs is a key goal of all operating systems.






MEASURING SYSTEM PERFORMANCE
Efficiency of an operating system and overall performance of a computer system are measured usually in terms of following parameters:
1) Throughput. Throughput is the amount of work that a system is able to do per unit of time. It is measured as the number of jobs completed by the system per unit time. Throughput is measured normally in processes/hour. Note that the throughput of a system does not depend on its jobs processing efficiency only, but also on the nature of jobs processed.
2) Turnaround time. From the point of view of an individual user, an important criterion is how long it takes a system to complete a job submitted by him. Turnaround time is the interval between the time of submission of a job to the system for processing to the completion of the job. Although, higher throughput is desirable from the point of view of overall system performance individual users are more interested in better turnaround time for their job.
3) Response time. Turnaround time is not a suitable measure for interactive systems because in such a system a process can produce some output early during its execution and can continue executing while previous results are being output to the user. Hence, another measure used in case of interactive system is response time. It is the interval between the time of submission of a job to the system for processing to the time of the system producing the first response for the job.



MAIN FUNCTIONS OF AN OPERATING SYSTEM

1) memory management
2) file management
3) security
4) command interpretation




MEMORY MANAGEMENT

Other than CPU, main memory is an important resource of a computer system that must be managed properly for overall system performance. Memory management module of an operating system takes care of this requirement. Its job is to keep track of which parts of memory are in use and which are free. It also allocates memory to processes when they need it, and de-allocates when they no more need.

UNIPROGRAMMING MEMORY MODEL
Uniprogramming memory model is used in systems that process one job only at a time, and all system resources are available exclusively for the job until it completes. In this memory management scheme, one part of memory is used by operating system and its remaining part is available for use entirely by the currently active user process. The operating system loads a program from disk into user area of memory and executes. When the process finishes, it cleans up the user area of memory and then loads the next program to be executed. Although this memory management scheme is simple and easy to implement, it does not lead to proper utilization of main memory resource. This is because the unoccupied space is user area remains unused for the entire duration of execution of the currently active user process. Hence, this memory management scheme is now used in very small or dedicated computer systems only.




MULTIPROGRAMMING MEMORY MODELS
In a multiprogramming system, multiple user processes need to reside simultaneously in main memory. The two memory management schemes used to facilitate this is multiprogramming with fixed number of memory partitions and multiprogramming with variable number of memory partitions. They are described below.

Multiprogramming with fixed number of memory partitions
In this scheme, the user area of memory is divided into a number of fixed size partitions. These partitions may be of same or different sizes, but the size of each partition is fixed. All new jobs are queued in an input queue. When a partition is free, the next job from the input queue is loaded into that partition. When a process terminates, the partition occupied by it becomes free for use by another process. Note that in a system that uses partitions of different sizes, when a partition becomes free, the first process in input queue that fits in it could be loaded into this partition.

Multiprogramming with variable number of memory partitions.
In the scheme described above, since all partitions are fixed in size, any space in a partition that is in excess of actual memory requirement of the process loaded into it remains unused. On an average, 50% of memory may remain unused due to this, resulting in under utilization of memory resource. To overcome this problem, another scheme with variable number of memory partitions was introduced. In this scheme, number, sizes, and locations of partitions vary dynamically as processes enter and exit the system. Initially, all the memory in user area is available for the user processes. When a process enters the system, only as much memory as needed by it is allocated to it, keeping the rest available for future requests. As processes enter and exit, memory partitions are allocated and de-allocated, each partition being equal in size of memory required by the process to which it is allocated. Since memory requirement of different processes is generally different, as process enter and exit, various sizes of free memory are created in memory. Operating system maintains the table to keep a track of free memory blocks. When a new process arrives, it searches for a free block that is large enough for this process. If the free block is too large, it is split into two parts. One part is large enough to be allocated enough to be allocated to the process, while the other part that contains remaining memory is entered as a smaller free block in the free block table. When a process terminates, it releases the partition allocated to it. The released partition is entered as a free memory block in the free blocks table. However, if the released partition is adjacent to any free blocks, it is merged with it to create a larger free block, and the associated entries in the free blocks table are updated properly. In this manner, number, sizes and locations of partitions vary dynamically as processes enter and exit the system.





FILE MANAGEMENT
A file is a collection of related information. Every file has a name, its data and attributes. Name of the file uniquely identifies it in a system. Users’ access files by their names. A file’s data is its contents. Contents of a file are a sequence of bits, bytes, lines or records whose meaning is defined by the file’s creator and users. Attributes of a file contain other information about the file, such as data and the time of its creation, date and time if last access, date and time of last update, its current size, its protection features, etc. File management module of an operating system takes care of file related activities, such as structuring, accessing, naming, sharing, and protection of files.

FILE ACCESS METHODS
1. Sequential access files. Sequential access files are used normally with sequential access storage media, such as magnetic tape. Contents of a sequential access file can be accessed only sequentially. That is, a process can read the bytes or records in the file in the order in which they are stored, starting at the beginning. Reading of bytes or records randomly or out of order is not possible. A sequential file however can be rewound and read as often as needed.
2. Random access files. Random access files are used normally with random access storage media, such as magnetic or optical disks. Unlike a sequential access file, contents of a random access file can be accessed randomly, irrespective of the order in which the bytes or records are stored.



SECURITY
Computer security deals with protecting various resources and information of a computer system against destruction and unauthorized access. In involves both external and internal security. External security deals with securing a computer system against external factors such as fires, floods, stolen disks/tapes, leaking out of stored information by a person who access to information etc. The commonly used methods for external security include maintaining backup copies of stored information at places far away from original information, using security guards to allow entry of authorized persons only into computer centers, allowing access to sensitive information to trusted employees/users only, etc.

Internal security, on the other hand, mainly deals with following aspects:
1. User authentication. Once a user is allowed physical access to a computer, the computer must check the user’s identification before allowing the user to use it. User authentication mechanisms take care of this requirement. Passwords used for logging into a computer, electronic cards used in ATMs and biometric devices that verify some unique physical characteristic of the user are some commonly used user authentication mechanisms.
2. Access control. A computer is often shared by many users. It also contains many resources and several types of information. Obviously, not all resources and information are meant for all users. Therefore, even when a user passes user authentication phase and is allowed to use a computer, some mechanism is needed to restrict the user’s access to those information that he is authorized to access. Access control mechanisms take care of this requirement. Operating system normally maintains access control lists to implement access control. Access control lists specify which users can have what type of accesses on various system resources.
3. Cryptography. Even if a user somehow manages to gain access to some information the he is not authorized to access, some mechanism is needed to ensure that the user cannot make use of that information. Cryptography mechanisms take care of this requirement. They work on the idea of encrypting a piece of information to prevent its comprehension by unauthorized users. Authorized users only can have the necessary key to decrypt encrypted information





COMMAND INTERPRETATION
Command interpretation module (known as command interpreter) of an operating system provides a set of commands using which users give instructions to a computer for getting their jobs processed. Commands supported by command interpretation module are known as system calls. When a user gives instructions to a computer by using these system calls, command interpreter takes care of interpreting these commands and directing the computer’s resources to handle the user’s request. Hence, command interpreter provides a user interface to hide hardware details of a system from its users. In this manner, it contributes greatly to the ‘ease of use’ objective of an operating system.

The two broad categories of user interfaces supported by various operating systems are:
1. Command-line interface. Users give instructions to computers by typing commands in this textual user interface. That is, to enter a command, a user uses keyboard to type words and symbols. If a user types a command incorrectly, command interpreter responds with a message indicating that it did not understand the command. There is no problem in typing simple commands. However, users often need to give detail instructions to computers about their jobs. To facilitate this, systems that support command-line interface, also support some type of command language or job control language. Command interpreters are designed to interpret codes written in job control language and invoke system actions.
2. Graphical user interface. Graphical user interface or GUI is much easier to learn and use than command line interface. Unlike command line interface in which commands are textual, GUI commands are graphical. GUI provides a screen full of graphic icons or menus to the users and allows them to make rapid selection from displayed icon or menus to give instructions to the computer.