Functions of the Operating System

166

The functions of the operating system are interrupt drives which means the operating system will not perform any task until an interrupt signal is given to it to do a specific task. The operating system does its functions only after the interrupt signal depending upon the kind of interrupt generated.

Also, as in an operating system, multiple users share common resources. It must be kept in mind that an error in a part of the program must affect the process related to that program only. The working of other processes and other users should not be disturbed due to it. So, an operating system should be designed keeping this in mind. This is one of a function of an operating system.

Functions of the Operating System

Now, we will understand other functions of the operating system in detail –

  1. Dual Mode Operation

It is necessary to distinguish between the user part of the code and the code that the operating system runs for a specific process. These two different parts are known as modes of an operating system.

There are two modes of execution in an operating system which are namely user mode and kernel mode. The kernel mode is also known as a privileged mode or supervisor mode.

A bit which is called the mode bit is set to distinguish between these two different modes. It is set to 0 for kernel mode and 1 for user mode.

Functions of the Operating System

The need for the two different modes was to stop users from accessing the privileged functionality of the Operating System. A user may access this functionality and modify it which may lead to the corruption of the operating system.

So, when our system starts, the hardware starts in kernel mode but after starting all the applications open in user mode. When an interrupt is received the system switches from user mode to kernel mode by modifying the mode bit and after that from kernel mode to user mode.

Thus, the dual-mode operation is very necessary and these days, almost all operating systems had it.

Use of timer –

There may be a possibility that a user program got stuck in an infinite loop and never returns the control to the operating system. To prevent this, a timer is used. A timer is set, for example, 10 milliseconds, and when the timer reaches 0, the interrupt signal is generated and the control reaches to the operating system.

2. Process Management

A program when kept in secondary storage does nothing until evoked by the CPU. When the program comes to memory for execution, then it is known as a process. Thus, a process is said to be a program in execution. The CPU executes a process instruction by instruction. The resources are allocated to the CPU either when the process is created, or at the run-time. And, once the process is executed, it releases its resources. Thus, a program can be said to be a passive entity whereas a process is said to be an active entity.

Also read: LRU Page Replacement Algorithm

A process can be single-threaded or multiple-threaded. Threads are the parts of the process in execution and each thread has a program counter pointing to the next instruction.

Thus, a CPU is responsible for the following tasks –

  • Allocation and deallocation of resources to the system.
  • Creating and Deleting the user and system processes
  • Resuming and Suspending processes.

3. Memory Management

For a system to be efficient, its main memory should be loaded with multiple programs. Multiple programs are loaded into the memory so that these can be easily accessible by the processor and for I/O operations.

For a program to be executed, it must be mapped to an address in the memory which is called the absolute address, and loaded to the main memory. And when the program terminates, the resources held by the process are released by the CPU.

An operating system is responsible for the following tasks in the CPU –

  • Allocating and de-allocating space in the memory for processes.
  • Keep track of the parts of memory that are currently being used and which are free.

4. File Management

Files are the basic component that stores information in a computer system. It is the job of the operating system, to control these files and store them on physical devices. These devices include magnetic tapes, pen drives, compact disks, and many more. Moreover, the files are kept in directories for their easy access and management.

Also read: Segmentation in OS

An operating system has the following functions under file management –

  • Creating and Deleting Files
  • Creating directories for easy management of files
  • Copying files to physical media
  • Backing up files

5. Protection and Security

A computer system can have multiple users within it. Thus, in needs a security mechanism so that one user cannot corrupt the files or important data of other systems. Moreover, the users should not gain control over the inner functioning of the CPU such as the timer or device registers. So, it is the job of the operating system to provide security to the files and useful information stored in it.

So, in this article, we had learn about four basic functions of operating systems. Apart from these, there are many other useful functions of an operating system which include networking, computing environment, user interface, and many more.

Previous QuizWhat is Multiprogramming in Operating System
Next QuizOperating System Services

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.