Major Functions of Operating System:
- Memory management: It manages both the primary and secondary memory such as RAM, ROM, hard disk, pen drive, etc. It checks and decides the allocations and deallocation of memory space to different processes. When a user interacts with a system, the CPU is supposed to read or write operations, in this case, OS decides the amount of memory to be allocated for loading the program instructions and data into RAM. After this program is terminated, the memory area is again free and is ready to be allocated to other programs by the OS.
- Processor Management: It facilitates processor management, where it decides the order for the processes to access the processor as well as decides the processing time to be allocated for each process. Besides this, it monitors the status of processes, frees the processor when a process is executed then allocates it to a new process.
- Device/ hardware management: The operating system also contains drivers to manage devices. A driver is a type of translation software that allows the operating system to communicate with devices, and there are different drivers for different devices as each device speaks a different language.
- Run software applications: It offers the environment to run or use software applications developed to perform specific tasks, for example, Ms Word, Ms Excel, Photoshop, etc.
- Data management: It helps in data management by offering and displaying directories for data management. You can view and manipulate files, folders, e.g., you can move, copy, name, or rename, delete a file or a folder.
- Evaluates the system's health: It gives us an idea about the performance of the hardware of the system. For example, you can see how busy the CPU is, how fast the data is retrieved from the hard disk, etc.
- Provides user interface: It acts as an interface between the user and the hardware. It can be a GUI where you can see and click elements on the screen to perform various tasks. It enables you to communicate with the computer even without knowing the computer's language.
- I/O management: It manages the input output devices and makes the I/O process smooth and effective. For example, it receives the input provided by the user through an input device and stores it in the main memory. Then it directs the CPU to process this input and accordingly provides the output through an output device such as a monitor.
- Security: It has a security module to protect the data or information stored in the memories of the computer against malware and unauthorized access. Thus, it not only manages your data but also helps to protect it.
- Time Management: It helps CPU in time management. The Kernel OS keeps checking the frequency of processes that requests CPU time. When two or more processes that are equally important compete for the CPU time, then the CPU time is sliced into segments and allocated to these processes in a round-robin fashion to prevent a single process from monopolizing the CPU.
- Deadlock Prevention: Sometimes a resource that is supposed to be shared by two or more processes is held by one process due to which the resource cannot continue. This situation is known as deadlock. The OS does not let this situation arise by carefully distributing the resources among the different processes.
- Interrupt Handling: OS also responds to interrupts, which are signals generated by a program or a device to seek the attention of the CPU. The OS checks the priority of the interrupt, and if it is more important than the currently running process, it stops the execution of the current process and preserves this state of CPU then executes the requested process. Thereafter the CPU returns to the same state where it was stopped.