Table of Contents
OPERATING SYSTEM FUNCTIONS | FUNCTIONS OF OPERATING SYSTEM
The functions of operating system vary depending upon its type, the resources available on the machine and other policies related to the design of overall computer system. We shall discuss here the important functions which are generally found in almost all operating systems. Our discussion will be more taxonomic rather than design oriented.
functions of operating system can broadly be divided into two categories:
- (a) Machine-dependent functions,
- (b) Machine-independent functions.
In machine-dependent functions of operating system, our discussion is confined to following:
- (a) Process Management,
- (b) I/O Management,
- (c) Memory Management, and
- (d) Processor Management.
A process is a basic unit of work to be performed by the system. Since there will be a large number of processes to be serviced by the system, the system should be provided with some management policy based on which all the processes are rendered services of different resources of the computer. Normally, the processes are independent of each other. It depends upon the type of operating system whether a single program can be taken as a single process or can be decomposed into several processes. In batch processing, each job is an independent process. In multiprogramming systems, a job may be decomposed into several process. In later case, the processes may not be totally independent of each other. They may be linked at some common point of the job.
There are two aspects in process management which are important from view point of effective utilization. One is process interrupt and other process scheduling. An interrupt is a message to the computer that causes a change in normal flow of the execution. These messages are normally in the form of signals to suspend the current process. The period of suspension can be used for performing some more important process activities as directed by the interrupt. The signals of interrupts are generally originated by many different conditions. Accordingly, several types of interrupt modes are needed. A service interrupt is made when a new process needs an immediate service from the operating system for some resource. A program interrupt is one which is made at the time of some error occurring during execution. This error may occur due to any run time fault like, divide by zero, memory protection violation, arithmetic overflow, address out of space available or privileged command run in user mode etc. A time interrupt is the interrupt generated by an unprivileged user which keeps track of a known interval. At user level, this is caused by wait or pause commands. An I/O interrupt is one that is generated by an I/O channel or device, during read/write instructions being executed. At the time when an interrupt occurs, the status of the current process is saved and the program control gets transferred to an interrupt- service routine (IRS). After completion of IRS, the status saved for the suspended process is restored and its execution continues.
The process scheduling is an activity of managing the CPU by means of switching its control from one process to another according to some policy. The creation of a process is caused when a user initiates a job execution. This process is destroyed after completion of job execution. Whenever a process exists in a computer system, it may be in one of three states: running, block and ready. A process is said to be in running state when CPU executes its instructions. A block state is one when the process is waiting for some event to occur before it can continue execution. For instance, there is a program in which the data must be input before the processing. The process of execution might be blocked because it has to wait for the completion of I/O activity. There is a third state of the process called ready state. A ready process is assigned the CPU when the existing process under CPU control is released. One can depict the process transition from one state to another as in Figure below. It is quite obvious to note that at most one process can be in the running state, at any instant. When a transfer for CPU control is passed to a user process, the operating system specifies the time interval to be given for that process. The process now is in running state. After completion of this time interval, the process switches from running state to ready state. There may be more than one process in ready state, the operating system must decide as per some scheduling policy which one should be selected for the running state and others to wait for some event to occur. The selected process is despatched by the despatcher routine of the operating system. A blocked state can come to ready state when some event like completion of I/O operation has occurred. In this fashion, the process gets switched amongst running, ready and block states, many times before it is completely executed.
I/O activity is a very important function of an operating system. The operating system has an I/O system as its integral part to perform I/O management. An I/O system is an interface between the I/O devices and the user. A user can give a number specifications for a device to be accessed or can specify a file on a device to be accessed. For instance, in FORTRAN, command READ (1,10) variable-list specifies the number “1” which may be any one of input devices. The I/O system of operating system facilitates the user through FORTRAN compiler the access of the input device and read the values of variables from the device. Associated with each I/O device, there is an I/O channel for controlling I/O device and transfer of information. Sometimes a single I/O channel is dedicated to several devices. The speed of memory and capacity of I/O channels decide the maximum number of devices to be connected in a computer system. A typical operating system has an I/O system with 16 channels each connectible with 16 I/O devices.
The I/O channel is run by a sequence of instructions known as I/O program. The I/O program contains the instructions to initiate I/O, specifying the channel number. Once channel is initiated, the device is operated by the I/O channel without further support from CPU. For this purpose, an I/O processor is required. After completion of device access, the I/O channel generates an interrupt to the CPU for further instructions. Since after the initiation of the channel, the I/O processor takes over and CPU becomes free from this channel, the CPU can now put its attention to other I/O channels. In this manner, more than one channels are active at a time, causing several I/O activities to be taking place simultaneously.
As there may be more than one program and data modules present at the same time in the memory, there must be proper way of managing the memory. This proper way is provided by the memory management unit of the operating system. An operating system supporting more than one program at a time has mechanism of allocating the memory portions to many concurrent processes of the programs under execution. Many operating systems with multi-programmed mode divide the memory into two different ways:
- (a) Static partition
- (b) Dynamic partition
Memory allocation in static partitioning scheme allows each input job into a block (or partition) of predefined fixed size. If the memory requirement of a job is less than partition size, the excess portion of the partition remains unused and is not granted to any other job. If the memory requirement of a job is of larger size than the partition capacity, an additional partition of predefined size is provided by the system. A job remains loaded in the memory until the execution of this job is over. The free partition can be made available for a new job.
In dynamic mode of memory partition, the allocation of memory is performed depending upon the need of the program being executed. In dynamic partition method, the partitions are created and destroyed as and when required. The size of created partition depends upon the size of the job. When the execution of job is over, the memory from used partition is released and given back to the system. Memory fragmentation is a problem that occurs during the dynamic partitioning in almost all general-purpose operating systems. The fragmentation means the splitting of the memory into several small sized blocks which are left by the small sized jobs after their execution. These small blocks may be at scattered positions which can not be allocated to new jobs of larger size easily. The solution to this problem is to use the relocation techniques. In these techniques, the small sized free blocks are moved towards one end of the memory. Thus, a contiguous block of large size is made available for large jobs.
There are some important related concepts with the memory management of the operating system. Memory protection is one of these in which a job is prevented to address any locations outside the partition assigned to it. Some systems deviate slightly from this strict strategy of memory protection by means of providing a data partition whose locations can be addressed by a job only for data access.
Virtual memory is the concept related to execution of very large programs into small size real main memory by virtue of mapping. A user is allowed to use a large contiguous memory in his program. The virtual memory management scheme loads the program partially in the main memory from the secondary storage. The mapping of virtual memory to real memory can be done in two ways:
- (a) Demand paging
- (b) Segmentation
In demand paging, the virtual memory of a job is divided into pages of some fixed size with specified positions. Correspondingly, the main memory of the computer is divided into frames of the same sizes as pages. Then, the conversion of virtual address into real address is performed for the purpose of execution.
In segmentation approach, a programmer specifies the segments in his program instead of the system dividing the memory into pages as in demand paging. The required segment is loaded from the secondary storage to the real main memory for execution. The programmer can specify the number of segments depending upon the availability of the physical memory.
This kind of management is required in advanced computer architectures where more than one CPUs (or processors) are employed. An operating system responsible for managing a number of processors as computer resources is called multiprocessor operating system. Since there are many processors activated for performing job execution, there will be a need of systematic policy for their effective use. One of the popular policies is to use the processors in master-slave mode. In this mode, a processor is assigned a job of being master of the system and other processors are used as slaves which work under supervisory control of the master. Any sort of interaction amongst the slave processors is systematically handled by the master processor.
Another way of performing processor management is to assign the task independently, to each processor. In such a policy, a number of asynchronous processes are under execution by each processor. However, there is need of a centralized control only for handling the interrupts. The centralized control decides which processor is supposed to handle the next occurring interrupt.
Machine Independent Functions
In this section, we shall discuss some functions of operating system which are independent of the hardware of the machine. Normally, these functions can be implemented in higher level languages, rather than the low-level languages. The machine-independent functions of operating system can broadly be classified into following:
- (a) File Management,
- (b) Job Scheduling,
- (c) Protection and Security.
A file is identified in operating system by its name, its type, header and end-of-file marker. File-management function of an operating system plays a role of intermediary between a user and I/O system. A user interacts through an input device while giving the name of file to be processed. The request of accessing the file is processed through I/O processor.
There is provision of a large number of files to be stored in the memory and the file management routines obtain the information from the file tables. These file tables are called catalogs or directories. The organization of the file tables vary from system to system. A file in the table is described by basic information like its name, the date of creation, the date of last update, the size and some other attributes. An attribute here means the property associated with the file. The protection of a file may be one attribute and access mode of the file may be another attribute.
The user specifies a file name in the command with some options and can get the file information with details as output. To begin processing of a file, the file management routine searches the file table and locates the appropriate file along with all its attributes. Such processing is known as opening of a file. After the file processing is complete, the file can be closed. The opening and closing operation of a file needs a memory buffer where the header address, and other pointers of the file can be stored. The memory buffer is supplied by memory management unit of the operating system.
File system of an operating system can be structured in two ways: linear structure and tree (hierarchical) structure. The linear structure of the files is simple to implement but tedious to use because of linear search. The hierarchical structure organizes the file system in such a way that efficient tree search can be employed to search a file. A hierarchical organization consists of a root directory. This root directory has several descendants in the form of sub-directories and files. The sub-directories may contain sub-directories further. Thus, a hierarchical system of files has three types of nodes:
- (a) Root node to represent root directory,
- (b) Intermediate nodes to represent subdirectories,
- (c) Leaf nodes to represent the files containing information (i.e. data and program).
The hierarchical structure of files can be traversed by a pointer. The user can specify the directory or sub-directory to work at. The directory (or sub-directory) under current use is known as the working directory. A typical file system is shown in Figure below, Root, user, bin and dev are names of the directories and u1, u2, d1, d2, b1 and b2 are names of the files.
Job scheduling is the activity of giving priority to a job and selecting it for its execution. In a batch processing system, the job scheduler completely follows the order of execution by the order in which the jobs are entered in the sequence. In multi- programming systems, the job scheduler determines the order by the set of processes in the job which are executed concurrently. In a simple time-shared operating system, the job scheduling is truly on round-robin basis.
There are several principles based on which the priority to a job is assigned. Some of them are:
- (a) First-Come-First Served (FCFS) Priority,
- (b) Priority according to the user’s command,
- (c) Priority according to the nature of job given by user,
- (d) Priority according to the shortest job next,
- (e) Priority according the deadline specified for a job,
- (f) Priority according to the profitability of the job,
- (g) Priority according to the type of user (privileged, semi-privileged, ordinary).
Protection and Security
An operating system may be responsible to take care of several users. It is possible that there may be an unauthorized access of the information of one user by some other user. There should be some mechanism to protect the file of user from unauthorized actions. A file may be provided with protection attributes, so that unauthorized action may be avoided. For instance, a file may be given attribute that it can not read or updated or modified by others. Another requirement of a computer system is security that only authorized users can access the computer facility. One of the most popular methods is to provide password facility for user identification. In this method, a user is provided a registration for the computer use along with a password. A password is a secret string of characters which only an authorized user and/or system administrator is supposed to know. When an authorized user enters the secret string on a password query, he gets the access to the system. A wrong password is signaled as unauthorized access.
Hope you liked this article on “functions of operating system”. You are invited for any kind of suggestion or feedback in the comment box. You can also mail us your suggestions or feedback directly at email@example.com. To read more such articles related to Technology, Electronics and Instrumentation. You can also download our Android App. Click here to download the mobile app.
- Digital Integrated Circuit | What is an ICs?
- Resistor transistor logic (RTL)
- Diode Transistor Logic (DTL)
- Direct coupled Transistor Logic (DCTL)
- What is computer programming
- Calibration Standards | Their Importance and Types
- Pressure Control Valve | Applications of pressure control valves
What is an Operating System(OS) ? Types of OS, Function & features