Introduction to Operating System
Does it interest you how your computer can run multiple programs simultaneously? Do you want to know whether your computer can run without an operating system? Do you want to understand how an application of several Gigabytes can run on a few Gigabytes of RAM?
In this article, we will learn about the operating system, its purpose for the user, how it works, and how important it is for a computer.
Also See, FCFS Scheduling Algorithm
What is an Operating System?
An operating application is loaded onto the computer's memory after booting up. The application acts as a layer of communication between the user or applications and the system's hardware. It performs many tasks like job scheduling, memory storage, and resource management.
Features of the Operating System
Some of the features of the operating system are
- Memory management: The operating system manages the allocation of memory to applications. It uses concepts like paging to maximise memory utilisation.
- Process management: Process management involves job scheduling, process termination and managing the execution of processes. The operating system schedules the processes with the help of an algorithm. Some algorithms used for job scheduling are First In, First Out, Shortest Job First, and many more.
- File management: The operating system controls how secondary storage will store files in the computer hardware. The operating system decides how to keep the files in order to maximise data redundancy and the disk space's efficiency.
- I/O management: Any process which needs to perform an I/O operation needs to achieve through the operating system. The process transfers control to the operating system while the I/O operation occurs. Once the I/O operation is complete, the command is transferred back to the process.
- Security: The operating system takes care of the security of the system. It enforces the permissions given to users for different files. It also ensures that the files of other users on the computer are separated.
The architecture of the Operating System
The operating system interacts with the application programs and system programs through system calls. Application programs are those programs which are executed by the user, whereas system programs are those which are executed by the operating system. It has an API for the applications to perform certain operations accessible only through the operating system. The operating system has all the computer's resources. It allocates them to processes based on their availability and needs.
History of Operating Systems
The history of operating systems can be divided into four generations. Operating systems introduced something new in each of these generations compared to the previous generations.
- The first generation of operating systems lasted from the 1940s to the early 1950s. During this period, programmers wrote programs in machine language.
- In the early 1950s to 1960s, the need for an operating system arose as computers got more powerful. General Motors developed the first operating system GMOS for IBM's 701 computer.
- During the 1960s to early 1980s, operating systems could support multiprogramming. Multiprogramming means being able to run multiple programs at the same time. For example the UNIX operating system.
- From the 1980s to the present day, the operating systems which companies created prioritized user-friendliness over efficiency. For example Windows 7 by Microsoft.
Need for Operating System
An operating system is needed in a computer system for the ease of the user. The operating system is an application which runs very close to the hardware. The kernel of an operating system makes calls to the respective hardware to get the desired operations. As the operating system has direct control over the hardware, it can manage resources for the user, take care of different system processes running simultaneously, and also protect the user from various security threats. Thus an operating system makes it easier for the user to operate a computer as it takes care of multiple things on a computer system which the user would have to take care of.
Types of Operating Systems
There are many different types of operating systems present today. Some classes are single-user operating systems, multi-user operating systems, and real-time operating systems. We have explained below about these types of operating systems.
Single-User Operating Systems
This operating system allows only a single user to operate at a time. This type of operating system is used in personal computers. These operating systems can support multiple user profiles but only allow one user to operate simultaneously. In this operating system, the security risks are much less due to a single user working on the computer simultaneously.
Multi-User Operating Systems
In multi-user operating systems, multiple users can use the computer at the same time. This operating system is used in large organizations, like e-commerce sectors, government institutions and educational institutions. This operating system is also used in cloud computing, where an operating system runs the hypervisor on a single powerful machine to emulate an environment for the users.
Real-time Operating Systems
In real-time operating systems, the systems show updates with minimal delay. It is used in places where the results of computation results in the change of inputs. Real-time operating systems are of three types complex real-time operating systems, soft real-time operating systems, and firm real-time operating systems. It is used in applications like missile guidance systems, radar detection, fuel injection systems, medical imaging systems and air traffic control systems.
Distributed Operating Systems
In distributed operating systems, the operating system handles the resources of various computers connected through a communication channel. This type of operating system is used in distributed computing systems, where multiple computer systems are used to perform heavy computation. The distributed operating system can handle computer systems which can be geographically distributed.
Examples of Operating Systems
We have come a long way from when there used to be a handful of computers and operating systems. In the information age, many operating systems are compatible with different hardware platforms. Some of the operating systems you might have heard of include
Microsoft is one of the companies operating a vast number of people using systems. Their operating systems have an exemplary user interface and allow for the usage of applications which are helpful for many people. These operating systems support many different applications and also contain decent security options.
MacOS is an operating system developed by Apple. It is one of the most user-friendly operating systems with excellent security features. MacOS is a UNIX-based operating system.
Linux is an open-source operating system, meaning anyone can use it and go through its code. Being an open source also means modifying Linux to create a new operating system based on Linux. This feature of modifications means that one can create an operating system based on their needs. Some of the flavours of Linux operating systems are Solaris, Kali Linux, Ubuntu, Debian and Arch Linux.
Generations of Operating Systems
As time passed, the operating systems became more powerful and efficient at managing resources. Below are the generations of operating systems
The first generation of operating systems lasted from the 1940s to the early 1950s. During this period, computers were quite rudimentary and could do only simple calculations. In these types of computers, the First generation did not need an operating system as these computers were not robust as compared to modern computers.
The second generation of operating systems was from the early 1950s to 1960s. As computers got more powerful, the need for an operating system arose. In the second generation of computers, IBM introduced batch processing. In this operating system, a set of programs were made into a batch of programs based on the similarity of their tasks and were loaded into the computer. GMOS was the first operating system which used this method. General Motors developed GMOS for IBM's 701 computer.
The third generation of operating systems lasted from the 1960s to the early 1980s. During this period, the operating systems could support multiprogramming. Multiprogramming means being able to run multiple programs at the same time. The concept of multiprogramming caused CPU utilization of almost 100 per cent.
The fourth generation of operating systems started in the 1980s and continues to the present day. In this generation, the created operating systems prioritised user-friendliness over efficiency. Apart from operating systems used in computers, operating systems present in mobile phones were also created during this period.
Components of an Operating System
An operating system is composed of various components to function correctly. The members make the operating system take care of different parts of a computer system properly. Some of the members of an operating system are discussed below.
A kernel of an operating system is one of the essential parts of an operating system. It sends commands to the individual hardware components of a computer. The kernel of an operating system has a process table which keeps track of all the processes running. The kernel loads an executable file into memory during the 'exec' system call. The kernel decides which process should be allocated to the processor to execute and which processes should be kept in RAM to be completed. There are 5 types of kernels, namely monolithic kernel, microkernel, hybrid kernel, nano kernel and exo kernel.
System calls to make it possible for a user program to access a service from the kernel of the operating system. The operating system provides an Application Program Interface (API) to make system calls for the user programs. The API acts as a link between the operating system and the process running in the CPU. Some of the systems calls for a UNIX operating system are fork(), wait(), exit(), and open().
The fork() system call is used to create a child process of a process running. The child and parent processes execute the instruction following the fork() system call. The fork() has no arguments. It returns a process ID as an output. Suppose the fork() returns a negative value. That means that the operating system could not create the child process. The fork() returns value 0 to the child process and a positive value that is the processID to the parent process—the process ID.is of datatype pid_t.
They are generally used when a standard functionality is used many times, and you do not need to implement that functionality from scratch again and again. In operating systems, libraries are present that help you do the same. Say that you want to print something on the screen, so that you would use a library in the operating system. There are two types of libraries in operating systems
- Shared: These libraries are dynamically linked. So when the libraries are used, multiple copies of the same code are not made.
- Static: These libraries are resolved in a caller during compilation time and copied into a target application by a compiler or a linker producing an object file and an executable file.
The file system in an operating system, takes care of the file management in the computer. The operating system takes care of the file system, recovering free space, disk space assignment to the files, and tracking data location. The file system provides a mechanism to store the files in the disk and also ways to retrieve the files effectively. The file system offers different methods for storing files in secondary storage devices like contiguous allocation, linked list allocation, and indexed allocation.
Functions of the Operating System
The operating system, as discussed above, performs a lot of functions. It manages the computer's resources and makes it easier for the user to operate the computer system. Some of the critical parts of the operating system are discussed below.
It is one of the essential functions of the operating system. Memory management is done through the concept of virtual memory. According to virtual memory the program is first divided into fixed-sized pages and stored in secondary memory to be run later. The computer's RAM is also divided into pages of the same fixed size as the programs in secondary memory. The program is first loaded into the main memory to be executed. Then a few necessary pages are loaded into the main memory from the secondary memory instead of the whole program. Whenever a page is needed which is not present in the main memory, a page fault occurs, and the operating system generates a trap to fetch the particular page from the secondary memory. The operating system also takes care of page swapping. A situation may arise when the program changes the pages in the main memory, but the pages in the secondary memory are not updated. In such a situation, the operating system performs page swapping, swaps the pages in the secondary memory with pages in the main memory, and reloads the main memory from the secondary memory.
The operating system manages processes by scheduling their processes with the help of an algorithm. Process management is needed in order to maximise the utilisation of the CPU and make the computer faster. Process management also involves process synchronization. In some programs, multiple threads run for a single process, and the order in which the threads run affects the overall outcome of the process. In such cases, a critical section is created, and locks are enforced so that, at a time, only a single thread can run in the critical section. The process management component of the operating system also takes care of inter-process communication. The inter-process communication is done through some shared variable in which changes made by a process are reflected in other processes also.
The operating system makes sure that the operating system's integrity are maintained and that the operating system is available at all times. The operating system protects the computer system from security threats like breach of integrity, the threat of service, and denial of service. The operating system enforces user authentication. With the help of user this, the operating system ascertains whether the user is who they claim to be. The operating system also ensures access control to ensure that the user or programs without administrator privileges cannot access the settings that need administrator privileges. The operating system implements similar access control and permissions-wise access in the whole system to make the computer system as secure as possible.
It means the exchange of information. Networking is an integral part of an operating system as many applications running on the computer require some form of networking to utilize all its features. The operating system offers many commands that allow you to diagnose and help your programs communicate with the internet. Some commands are ping, tracert, ipconfig, arp, and netstat.
The device management system in an operating system manages all the devices connected to the computer. The operating system allocates I/O devices to a particular process based on priority and deallocates the I/O when the need is over. The I/O devices handled by the operating system are of 3 types: boot devices, character devices and network devices.
Advantages of Operating System
The advantages of the operating system are many for a user. Some of the benefits are explained below
- User-friendliness: The main objective of an operating system is to provide the user ease of use. The operating system provides the user a friendly interface, which they can use to operate a computer system. The graphical user interface of the operating system dramatically improves the user-friendliness of the operating system.
- Sharing resources: The operating system helps in resource management. The operating system controls all the resources, and the operating system allocates and deallocates resources given to different processes. This allows effective sharing of resources amongst the process running through the operating system.
- Data protection: The operating system protects the data from unauthorised manipulation. The operating system enforces this through access control. Also, the operating system saves the data of different users present in the same system by effectively partitioning the data.
- Multitasking: The operating system allows multiple programs to run in the computer system simultaneously. It is made possible by virtual memory and preemptive job scheduling. The operating system makes it possible to run different programs together by efficiently sharing resources.
Disadvantages of Operating System
As there are advantages to an operating system, there are also disadvantages to an operating system. Below, the weaknesses of the operating system are discussed
- Expensive: One of the disadvantages of the operating system is that it is costly. They cost a lot of money and are not replaced frequently once installed in a computer system.
- Complex structure: The operating systems are very complex. They have several components working together, which makes their design very complicated. It also makes finding problems difficult in an operating system when something unexpected happens.
- Threats from viruses: An operating system is vulnerable to viruses. A virus can bypass some of the protective features of the operating system and can cause various problems in the computer. Viruses can steal your personal information, slow your system, and create unexpected problems.
- Fragmentation: Fragmentation means a waste of space in the main memory. It occurs when programs are loaded and unloaded from the main memory in such a way that gaps in memory are created a program cannot fill that. Fragmentation can be internal or external and reduce the adequate size of the main memory. In order to prevent fragmentation the concept of paging is used.
Limitations of Operating System
As in most applications, the operating system also has its limitations. These operating system limitations make it flawed in terms of its performance and availability. Some of the limitations are
- Expensive: One of the operating system's limitations is that it is costly. This reduces the availability of an operating system in computers.
- Deadlocks: Deadlocks occur when there is a complete cycle in the need for resources for processes, but none of the needs of the processes can be satisfied. There are algorithms to recover from the deadlock state, but they take a lot of time to recover from a deadlock. Also, the addition of deadlock algorithms in the operating system slows down the computer system. So in most operating systems, deadlocks are not handled. Deadlock algorithms work by freeing resources from the processes one by one. They continue freeing resources till the deadlock is broken.
- Process scheduling: Despite many algorithms, there are still cases when the operating system fails to optimize the processes to maximize CPU utilization. This failure to perfectly optimize the processes reduces the operating system's efficiency.
Frequently Asked Questions
What is an operating system?
An operating is an application loaded onto the computer's memory after booting up. It is the application that acts as a layer of communication between the user or applications and the system's hardware. It performs many tasks like job scheduling, memory, storage, and resource management.
What are the different types of operating systems?
There are many different types of operating systems present today. Some classes are single-user operating systems, multi-user operating systems, and real-time operating systems.
What is a kernel in the operating system?
A kernel of an operating system is one of the essential parts of an operating system. It sends commands to the individual hardware components of a computer. The kernel decides which process should be allocated to the processor to execute and which processes should be kept in RAM to be executed.
The operating system is an application which makes it easier for the user to operate the computer system. It interfaces between the user-level processes and the computer's hardware. It helps in resource management and ensures the computer system's security. Still, operating systems has its disadvantages, but they are continuously being addressed in future generations.