An operating system is a program that manages the computer hardware . It acts as an intermediary between the computer user and the computer hardware.
An operating system manages overall activities of a computer and the input/output devices attached to the computer . Operating system is a program most intimately involved with the hardware. It also acts as a resource allocator , A computer system has many resources that may be required to solve a problem : CPU time , memory space , file storage space , I/O device and so on . The operating system acts as a manager to these resources.Let's talk about the tasks performed by OS one by one:
- Program Execution: The operating system provides an environment for execution of programs . Operating system takes care of loading the program into memory and then assigning CPU time for its execution . It also takes care of important task like allocation and de allocation of memory , CPU scheduling etc.
- I/O operations" Each program may require I/O for getting input and producing some output . For example : Running a program for adding two numbers given by user , program would need two numbers as input from user and would produce their sum as output . This whole execution would require use of I/O devices .For efficiency and protection , users usually cannot control I/O devices directly . Therefore , operating system provides a means to do I/O .
- File-system manipulation: User need read and write files and directories , they also need to create, delete and search a given file .Files are stored on the disk (secondary storage) . Operating system provides file system to help users to perform above mentioned functions and apart from that operating system also handles the task of giving permission to the program for operation on file .
- Communication: Many a times one process needs to exchange information with another process executing on the same computer or different computer tied together by computer network . Operating system manages the communication via shared memory or through message passing .
- Error Detection: Various error can occur while executing a program , for e.g. access an illegal memory location while executing a code , memory overflow or error related to I/O devices . Operating system needs to be constantly aware of possible errors and for each type of error it should take an appropriate action to ensure correct and consistent computing .
- Resource Allocation: When there are multiple jobs running at the same time, resources such as CPU, main memory, or secondary storage etc should be allocated to each process . It is responsibility of operating system to manage all the resources and make its better utilization.
- Accounting: Operating system keeps track of which user or which process use how much and what kinds of computer resources. In multitasking, keeping track enhances the system performance with allocation of resources to each process gets required resources.
- Protection and security: There are numerous security threats to your computer, in particular various types of malware, which is short for malicious software. This includes computer viruses, which can interfere with the normal operations of your computer. Viruses can be very harmful and result in loss of data or system crashes. The OS of a computer has a number of built-in tools to protect against security threats, including the use of virus scanning utilities and setting up a firewall to block suspicious network activity.