Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024
Easy

Introduction to Operating System

Author Rituraj Seal
10 upvotes
gp-icon
Operating system track
Free guided path
14 chapters
83+ problems
gp-badge
Earn badges and level up

Introduction

An Operating System (OS) is an interface that manages all the resources of a computer system (both hardware and software). 

An OS software performs all the basic tasks like memory management, file management, process management, input and output handling, and the user and provides an environment in which the user can execute his/her programs in a convenient manner.

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.

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.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Why Use an Operating System?

An operating system (OS) is an important part of the computer system and provides communication between computer hardware and software. Operating System roles are to manage resources, provide a user interface, enforce security, handle file management, support hardware communication, and enable multitasking. An operating System is essential for efficient and secure computer operations.

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 multiprogrammingMultiprogramming 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.
     

Also see, Difference Between Bit and Byte

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.

Need for Operating System

You now know that an OS is like a mediator between the system hardware and its user. Hence its requirement lies in providing an interface between the users and systems like computer systems, mobile phones, music players, tablets, etc. However, let us briefly discuss these requirements.

Resource Allocation

Since more than one program runs simultaneously on the system and uses the CPU and memory, we need an operating system to manage the resource distribution among the various processes.

Multitasking

There is a need for system software to facilitate the execution of more than one process/application simultaneously.

Graphical user interface

It eases the user’s understanding of the system process and enables a smooth interaction between the two.

File management

It means there are many resources required by a process for its execution, so which resource to allocate and when is the task handled by an operating system.

Platform

It’s a platform or a link without which the communication between user and system is next to impossible.

Also See, FCFS Scheduling Algorithm 

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.

Types of 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.

Batch operating System

In batch operating systems, the operating system executes jobs in batches and no user interaction is needed in between the execution. The operating system takes the jobs in bunches (batches) from the user and then these jobs are executed in a predefined sequential manner. Batch operating systems are used in systems where the data volume is very high and needs to processed in a repetitive manner like banking sector and scientific research.

Network Operating System

A Network operating system is a type of operating system that is used to manage and control all the network resources and services of a network device. This type of operating system is made to run on servers and is mainly responsible for maintaining the communication between different devices on same network like file sharing, printing and network management.

Mobile Operating System

Mobile Operating system is the software that is designed to run of devices like mobile phones and tablets instead of computers. It provides the same functions as other operating systems like memory and process management and network connectivity. These type of operating systems are generally designed to be lightweight, energy-efficient so that these can run on lower specification devices easily.

Also read: Register in Computer

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 Windows

Microsoft Windows

Microsoft is one of the companies operating a vast number of people using Windows operating 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.

Mac OS

Mac OS

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

Linux

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

First Generation

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.

Second Generation

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.

Read about Batch Operating System here.

Third Generation

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.

Fourth Generation

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.

Kernel

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

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.

Libraries 

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.

File System

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. 
Also read - File management in operating system

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.

Memory Management

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.

Process Management

The operating system manages processes by scheduling their processes with the help of an algorithm. Process management Operating System 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.

Security

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.

Networking

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.

Device Management

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.

Click on the following link to read further: Multitasking Operating System

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.

Also read - AMD vs Intel

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 4 types of operating system?

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 are the three main function of OS?

The three main functions of operating system are efficient management of computer resources like memory, providing an environment for an user to execute his/her programs and to provide security to the system by protecting unauthorized access of system data and resources.

Conclusion

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.

Recommended Readings:

 

You can also consider our Operating System Course to give your career an edge over others.

Next article
Need of Operating System
Guided path
Free
gridgp-icon
Operating system track
14 chapters
83+ Problems
gp-badge
Earn badges and level up
Live masterclass