An Operating System is a software that acts as an interface between the user and the application programs. It has several other tasks as well, including control of execution of programs, managing computer hardware resources etc.. We can say that operating system is a software that controls the hardware.
Functions of an Operating System
An operating system performs several functions simultaneously. The most common functions of an OS are listed below :-
1. Memory Management
Memory is divided into two types : main memory (primary memory) and secondary memory. The OS keeps track of primary memory, allocates and de-allocates memory to processes, move processes between disk and memory.
2. Resource Allocation
In case of multiple processes running concurrently, the OS decides which process will be allocated which resource and for what duration. Resources include CPU (processor), main memory, storage, I/O devices etc. In addition to it, the OS manages all the device drivers and device components.
3. Job Accounting
The OS keeps track of all users, time spent for each process and resources used. This is known as Accounting.
4. File System Manipulation
The various jobs involved in file systems are read and write operations on a file, creating / deleting / searching files / directories, managing access permissions etc. These jobs are handled by the OS.
5. User Interface
As we have already pointed out in the definition, an OS acts as an interface between the user and application programs. GUI - Graphical User Interface, CLI - Command Line Interface, Batch are some examples of user interfaces.
6. Program Execution
The OS is responsible for carrying out all tasks related to program execution - allocating memory and resources, loading the program, run the program, detect errors etc.
7. Protection and Security
The OS provides restricted control to users depending on their access privileges, and reinforces security by preventing unauthorized access attempts to programs etc.
8. Interprocess Communication
Processes may exchange information and coordinate over networks. This is known as interprocess communication.
9. Error Detection
Any abnormal execution or termination of a program leads to errors. Different types of errors are generated in different situations. The OS is responsible for detecting errors, reporting them and taking appropriate actions.