Operating System
Operating System
An operating system acts as an intermediary between the computer hardware and the user.
It prevents the user from directly accessing the hardware and manages all system resources.
The hardware includes CPU, ALU, memory, I/O devices, peripheral devices and storage
devices.
The system programs include compilers, loaders, editors and the OS itself.
The application programs are user-level software that perform specific tasks.
An operating system is always running in the background to manage and coordinate the use
of hardware resources among system and application programs for multiple users. The OS
itself is not only a user interface. Instead, it provides an interface for user interaction,
typically through:
Note: At the core of the OS lies the Kernel, which is the primary interface
between hardware and software which handles low-level operations such as
process management, memory management, file system control and device
handling.
An operating system is system software that acts as an interface between the user and
computer hardware. It manages system resources and provides a platform for executing
programs efficiently.
Primary Goals
The primary goals of an operating system (OS) are to provide an easy to use and convenient
environment for executing user programs.
User Convenience: It should be easy to use, providing a user-friendly interface and making
it simple to interact with the system.
Program Execution: It facilitates the execution of user programs, providing the necessary
environment and services for them to run.
Resource Management: The OS manages and allocates the computer's resources,
including the CPU, memory, disk storage and input/output devices, to ensure fair
utilization.
Security: The OS protects the system and user data from unauthorized access, ensuring
confidentiality, integrity and availability of information.
Secondary Goals
Secondary goals of an operating system focus on improving overall system performance
and stability. They ensure efficient use of resources and make the system reliable and
robust.
Efficient Resource Utilization: It should aim to maximize the performance and utilization
of computer resources like CPU, Memory and I/O devices, ensuring that the system runs
smoothly and efficiently.
Reliability: It should be robust and reliable, able to handle errors and exceptions
gracefully, ensuring that the system continues to operate smoothly. It should be modular
in design and easy to debug.
There are multiple types of operating systems each having its own unique features:
Windows OS : Developed by Microsoft. Used in personal computing, business
environment, gaming.
macOS : Developed by Apple. Used for creative industries (design, video editing, music
production), Personal computing and Professional environments.
Linux : Developed by Linus Torvalds and maintained by the open-source community (Linux
Foundation, Red Hat, Canonical, etc.). Used in servers and data centers, development and
programming, Personal computing for tech enthusiasts.
Unix : Developed originally at AT&T Bell Labs, various commercial and open-source
versions available. Used in servers and workstations, Development environments,
Research and academic settings
There are so many factors to be considered while choosing the best Operating System for
our use. These factors are mentioned below.
Price Factor: Price is one factor to consider when choosing an operating system, as some
OSs are free, like Linux, but there is some more OS that is paid like Windows and macOS.
Accessibility Factor: Some Operating Systems are easy to use like macOS and iOS, but
some OS are a little bit complex to understand like Linux. So, you must choose the
Operating System in which you are more accessible.
Compatibility factor: Some Operating Systems support few applications whereas some
Operating Systems supports more application. You must choose the OS, which supports
the applications which are required by you.
Security Factor: Security is an important factor when choosing the correct operating
system. Both macOS and Microsoft Windows provide strong security features, and the
level of security mainly depends on proper configuration, regular updates, and how the
system is used.
An Operating System (OS) is software that acts as a bridge between the user and the
computer hardware. It provides an environment where users can execute programs
efficiently and conveniently.
Manages and controls all computer resources.
Provides services and resources to user programs.
Coordinates and monitors program execution to prevent errors.
Offers a user interface (virtual machine) and hides software complexity.
Supports multiple execution modes for programs.
Function of OS
Note: The OS controls all computer resources, coordinates program
execution, hides system complexity, ensures security, and improves resource
utilization.
Functions of an Operating System
1. Process Management
Process management in operating system is about managing processes. A Process is a
running program. The life cycle of process is from the moment program start until it
finishes.
Device Management
The OS protects system resources and user data from unauthorized access and attacks.
Access Control: Limits user and process permissions.
Authentication: Verifies users through credentials (UIDs/SIDs).
Resource Protection: Prevents misuse of files, memory, or devices.
Security: Guards against malware, denial-of-service attacks, and data theft.
Read more about Security and Protection in OS
Additional Functions
Beyond core tasks like process and memory management, OS also focus on:
Performance Monitoring: Tracks system efficiency and identifies bottlenecks.
Job Accounting: Records resource usage for auditing and optimization.
Error Detection: Generates error logs, traces, and dumps to detect and fix issues.
Types of Operating Systems
An operating system (OS) is software that manages computer hardware and software
resources. It acts as a bridge between users and the computer, ensuring smooth operation.
Different types of OS serve different needs; some handle one task at a time, while others
manage multiple users or real-time processes.
Advantages
Minimal Idle Time: The system minimizes idle time by processing jobs in a continuous
sequence without human intervention.
Handling Repetitive Tasks: Ideal for managing large, repetitive tasks, such as payroll and
billing, with minimal effort.
Improved Throughput: Batch systems can handle high volumes of jobs at once, improving
overall system throughput.
Disadvantages
Inefficient CPU Utilization: When a job is waiting for input/output (I/O), the CPU remains
idle, leading to poor utilization of resources.
Increased Response Time: The time between job submission and output can be high as all
jobs are processed sequentially.
Lack of Real-Time Feedback: Users cannot interact with the system in real-time, making it
less suitable for interactive tasks.
Examples:
Insurance Claim Processing
Library Book Records
Stock Market Reports
2. Multi-Programming Operating System
In a Multi-Programming Operating System, multiple programs run in memory at the same
time. The CPU switches between programs, utilizing its resources more effectively and
improving overall system performance.
Runs multiple programs in memory at the same time to maximize CPU usage.
Advantages
Better CPU Utilization: CPU stays busy by switching to another job during I/O wait.
Improved Throughput: Multiple jobs run concurrently, increasing work done per unit time.
Efficient Resource Use: CPU, memory, and I/O devices are shared effectively among
processes.
Disadvantages
Complex Design: Requires advanced memory management and CPU scheduling.
Security Issues: More programs in memory increase chances of unauthorized access.
High Memory Requirement: Needs larger RAM to run multiple programs together.
Examples:
Banking systems
Railway servers
Billing machines
3. Multi-tasking/Time-sharing Operating systems
Multitasking OS is a type of multiprogramming system where each process runs in a round-
robin manner. Every task gets a fixed time slice called a quantum. After the quantum ends,
the OS switches to the next task, allowing multiple tasks whether from one user or many to
run smoothly on a single system.
Allows multiple tasks to run by giving each a small time slice for smooth, shared system use.
Advantages
Equal CPU Access: Each task gets a fair share of CPU time.
Reduced Software Duplication: Many users can run the same software without needing
separate copies.
Low CPU Idle Time: Efficient scheduling keeps the CPU busy.
Disadvantages
Lower Reliability: System failures affect all users.
Security Concerns: Multiple users increase risks to data integrity and privacy.
Communication Issues: Data sharing between users can cause conflicts.
Examples:
IBM VM/CMS
TSO (Time Sharing Option)
Windows Terminal Services
4. Multi-Processing Operating System
Multi-Processing OS is a type of Operating System in which more than one CPU is used for
the execution of processes. It betters the throughput of the System.
Uses two or more CPUs simultaneously to increase speed and reliability.
Advantages
Faster Processing: Multiple CPUs work simultaneously, increasing overall system speed.
High Reliability: If one processor fails, others can continue working (fault tolerance).
Supports Heavy Tasks: Ideal for computation-intensive applications like scientific or
industrial tasks.
Disadvantages
High Cost: Multiple processors and complex hardware increase system cost.
Complex Design: Requires advanced OS support for communication and task distribution.
Not Always Efficient: Poor task distribution can lead to idle processors and wasted
resources.
Examples:
UNIX
Linux (Ubuntu, Red Hat, Debian)
macOS
5. Distributed Operating System
Distributed operating systems connects multiple independent computers through a shared
communication network. Each system has its own CPU and memory but works together as
a single unit. The main benefit is remote access, allowing users to use files and software
stored on other connected systems.
Disadvantages
Network Dependency: If the main network fails, communication stops.
Lack of Standardization: No well-defined language or model for building such systems.
High Cost & Complexity: Hardware is expensive, and the software is complex and not
widely understood.
Advantages
Centralized and Stable Servers: Provide reliable management of resources.
Easy Upgrades: New hardware and technologies can be added without difficulty.
Remote Access: Users can access the server from different locations and devices.
Disadvantages
High Server Cost: Setting up and maintaining servers is expensive.
Dependency on Server: Most operations rely on a central server.
Regular Maintenance Needed: Frequent updates and technical support are required.
Examples:
Microsoft Windows Server 2003
UNIX, Linux
Mac OS X
7. Real-Time Operating System
These types of OSs serve real-time systems. The time interval required to process and
respond to inputs is very small. This time interval is called response time. Real-time
systems are used when there are time requirements that are very strict like missile systems,
air traffic control systems, robots, etc.
Advantages
Maximum Utilization: Maximum utilization of devices and systems, thus more output
from all the resources.
Error-Free: These types of systems are error-free.
Memory Allocation: Memory allocation is best managed in these types of systems.
Disadvantages
Limited Tasks: Very few tasks run at the same time and they focus on very few
applications to avoid errors.
Complex Algorithms: The algorithms are very complex and difficult for the designer to
write.
Thread Priority: It is not good to set thread priority, as these systems are not suitable for
frequent task switching.
Examples:
Scientific experiments
Medical imaging systems
Robots
8. Mobile Operating Systems
Mobile operating systems are designed specifically for mobile devices such as smartphones
and tablets. Examples of such operating systems are Android and iOS. These operating
systems manage the hardware and software resources of the device, providing a platform
for running applications and ensuring a seamless user experience.
Runs on smartphones and tablets, managing hardware, apps, and touch-based interfaces.
Advantages
User-Friendly Interfaces: Mobile operating systems are designed to be intuitive and easy
to use, making them accessible to a wide range of users.
Extensive App Ecosystems: The availability of a vast number of applications allows users
to customize their devices to meet their specific needs.
Connectivity Options: Mobile operating systems support multiple connectivity options,
enabling users to stay connected wherever they go.
Disadvantages
Battery Life Constraints: Despite advancements in power management, battery life
remains a challenge for mobile devices, especially with heavy usage.
Security Risks: Mobile devices are susceptible to various security threats, such as malware
and phishing attacks, which can compromise user data.
Fragmentation: In the case of Android, the wide range of devices and customizations can
lead to fragmentation, making it difficult for developers to ensure compatibility across all
devices.
Examples:
Android
iOS
Blackberry
System Call
User programs cannot directly access hardware or critical OS resources because it would
make the system unstable and insecure. To maintain safety, the operating system provides
system calls — controlled interfaces that allow user programs to request services from the
kernel. These calls act as a gateway between user mode and kernel mode. System Calls are,
A way for programs to interact with the operating system.
Provide the services of the operating system to the user programs.
Only entry points into the kernel are executed in kernel mode.
System Call
Example:
Opening a file in C (fopen) internally uses system calls like open().
Running a program in Linux uses fork() and exec() system calls.
Printing on screen uses the write() system call.
A system call is a controlled entry point that allows a user program to request a service
from the operating system. Here's how it works:
The user program executes a system call instruction (e.g., using syscall or int 0x80).
The CPU switches from user mode → kernel mode for safe execution.
The kernel identifies the system call number and performs the requested operation (file
access, process creation, memory allocation, etc.).
After completing the task, the kernel switches back to user mode.
The result (success/failure/data) is returned to the program.
Without system calls, every program would need its own way to access hardware, leading
to inconsistent and insecure systems.
System calls do not always cause context switching. They primarily involve a mode
switch from user mode to kernel mode. A context switch happens only when the calling
process is blocked, not during every system call.
Types of System Calls
Services provided by an OS are typically related to any kind of operation that a user
program can perform like creation, termination, forking, moving, communication, etc.
Similar types of operations are grouped into one single system call category. System calls
are classified into the following categories:
Types of system call
Read more about - Different Types of System Calls in OS
File System: Used to create, open, read, write, and manage files and directories.
Process Control: Used to create, execute, synchronize, and terminate processes.
Memory Management: Used to allocate, deallocate, and manage memory for processes.
Interprocess Communication (IPC): Used for data exchange and communication between
different processes.
Device Management: Used to request and release devices, and to perform read/write
operations on them.
Operating System Services
An operating system is software that acts as an intermediary between the user and
computer hardware. It is a program with the help of which we are able to run various
applications. It is the one program that is running all the time. Every computer must have
an operating system to smoothly execute other programs.
The OS coordinates the use of hardware and application programs for users.
It provides a platform for running application software.
It is a set of special programs that help the computer function properly.
It controls input–output devices and system operations.
It manages program execution and file handling.
OS Services
1. Program Execution
The Operating System manages program execution by loading programs into memory and
scheduling them using algorithms like FCFS, SJF. It ensures smooth execution of user and
system programs while preventing deadlocks where processes wait indefinitely. The OS also
allocates system resources efficiently for proper functioning.
Loads programs into memory for execution.
Uses CPU scheduling algorithms (FCFS, SJF, etc.) to decide execution order.
Handles and prevents deadlocks during execution.
Manages system resources for efficient overall functioning.
2. Input Output Operations
The Operating System manages all input-output operations and enables communication
between users, programs, and device drivers. Device Device drivers act as the software
interface for hardware, allowing the OS to control devices smoothly. The OS also provides
programs with safe and timely access to input-output devices whenever required.
Manages all input-output operations.
Communicates with hardware through device drivers.
Ensures proper coordination between devices and the system.
Provides programs controlled access to input-output devices.
3. Communication Between Processes
The Operating System manages communication between processes and enables smooth
data transfer among them. It handles both local communication on the same computer and
communication across networked systems. This ensures efficient and coordinated
exchange of information.
Manages inter-process communication (IPC).
Enables data transfer between processes.
Supports communication across networked computers.
Ensures secure and efficient information exchange.
4. File Management
The Operating System manages all file operations by granting programs the required access
permissions such as read-only or read-write. It allows users to create, delete, store, and
organize files across devices like, floppy disk or pen drives. The OS also decides how data
should be stored and manipulated for efficient file management.
Grants programs file access with permissions like read-only or read-write.
Allows users to create, delete, and organize files.
Manages file storage across devices such as hard disks and pen drives.
Decides how data is stored and manipulated for efficient file management.
5. Memory Management
The OS manages memory like a cricket team manager choosing players. Just as the
manager decides whether a player enters the playing 11 or 15 based on performance, the
OS checks whether a new program meets the requirements for memory. If it does, the OS
decides how much memory the program needs and loads it into an appropriate location,
preventing unnecessary memory usage.
OS checks whether a new program meets the requirements to get memory.
It decides how much memory the program needs.
Loads the program into a suitable memory location.
Prevents programs from using unnecessary or extra memory.
6. Process Management
Process management can be understood by imagining the kitchen stove as the CPU and the
chef as the Operating System. The chef must cook multiple dishes (programs) and ensures
no single dish takes too much time so that every dish gets a fair chance to be cooked. In this
way, the OS schedules and manages all programs efficiently to keep the system running
smoothly.
CPU is like the kitchen stove where execution happens.
OS (chef) ensures each program gets fair execution time.
Prevents any program from occupying the CPU for too long.
Schedules all programs efficiently to keep the system running smoothly.
7. Security and Privacy
Security
The Operating System keeps the computer safe from unauthorized users by adding
protective security layers. It defends the system from threats like viruses and hackers
through tools such as firewalls and antivirus software. These measures ensure the safety of
the computer and its data.
Blocks unauthorized access to the system.
Protects against viruses and malware.
Uses firewalls and antivirus tools for defense.
Ensures overall system and data safety.
Privacy
The Operating System helps keep personal information private, similar to locking a door
that only you can open. It ensures that sensitive files and data remain hidden from others.
In this way, the OS respects user confidentiality and protects important information.
Keeps personal data hidden from others.
Provides access control options like passwords.
Ensures only authorized users can view files.
Protects sensitive information from misuse.
8. Resource Management
The Operating System manages how system resources are shared among different
processes. It allocates CPU time using CPU Scheduling Algorithms, handles memory
management, and controls input-output devices. By deciding which process gets which
resource, the OS ensures proper and efficient use of all available resources.
Shares system resources among multiple processes.
Allocates CPU time using scheduling algorithms.
Manages memory and input-output devices.
Ensures efficient and proper use of all resources.
9. User Interface
The Operating System provides a user interface that allows users to interact with the
system either through a command-line interface(CLI) or a Graphical User Interface (GUI). In
a CLI, the command interpreter executes user-typed commands. A GUI offers a mouse-
based window and menu system that makes interaction easier and more visual.
Provides both CLI and GUI for user interaction.
CLI uses a command interpreter to run user commands.
GUI offers windows, icons, and menus for easy use.
Helps users communicate smoothly with the operating system.
10. Networking
This service enables communication between devices on a network by managing
connections and controlling data exchange. It allows devices to connect to the internet,
send and receive data packets, and maintain stable communication. Through proper
network management, the system ensures smooth and reliable data transfer.
Manages network connections between devices.
Supports internet access and communication.
Sends and receives data packets reliably.
Ensures smooth and stable network operations.
11. Error Handling
The Operating System detects and handles errors occurring in the CPU, memory, or input-
output devices to keep the system stable. It prevents frequent errors, avoids deadlocks,
and fixes issues that appear during program execution. A secure OS also acts as a protective
layer against external threats or breaches.
Detects and handles CPU, memory, and I/O errors.
Prevents frequent errors and avoids deadlocks.
Fixes issues that occur during task execution.
Provides security measures against external threats and breaches.
12. Time Management
Imagine a traffic light as the Operating System, guiding cars (programs) on when to stop,
wait, or move. Red represents the simple queue, yellow is the ready queue, and green
means the program is under execution. By switching lights at proper intervals, the OS
ensures all programs move smoothly without traffic or delays.
Red light = programs waiting in the simple queue.
Yellow light = programs in the ready queue.
Green light = programs under execution.
OS changes states at proper intervals to ensure smooth program flow.
Operating Systems Structures
An operating system can be built using different structures depending on how its
components are organized and how they interact inside the kernel. Its system structure
acts as a blueprint that shows how the OS is arranged so it can be understood and adapted
to different needs. Since OS design is complex, breaking it into smaller, manageable parts
makes development easier. The structure defines the strategy used to integrate these
components within the kernel.
OS structure depends on component organization and interaction.
Acts as a blueprint that guides OS design.
Breaking the OS into smaller parts simplifies development.
Structure defines how components are integrated into the kernel.
Simple Structure
Simple-structure operating systems have no well-defined architecture and are small, simple
and limited in functionality. Their interfaces and functional levels are not clearly separated,
which makes them less reliable. Because of this lack of separation, a failure in any user
program can cause the entire system to crash.
No well-defined structure; small and limited.
Interfaces and functionality levels are not separated.
MS-DOS is an example of this structure.
Applications can directly access basic I/O routines.
A user program failure can crash the entire system.
Simple OS Structure
Layered Structure
In Layered structure, the OS is divided into levels where each layer uses the services of the
one below it—hardware at the bottom and the user interface at the top. This design
improves organization and simplifies debugging, as errors can be isolated to specific layers.
However, it adds overhead because data must pass through multiple layers and requires
careful planning. UNIX is an example of this structure.
OS is divided into multiple layers (hardware at bottom, UI at top).
Each layer uses the functions of the layer below it.
Easier debugging because errors are isolated to specific layers.
Adds overhead due to data passing through many layers.
Requires careful planning; layers can only use lower layers.
UNIX is an example of a layered structure.
Layered Structure
Modular Structure
A modular structure uses a kernel that contains only essential core components, while
additional services are added as loadable modules during boot or runtime. It is similar to a
layered design because it has defined and protected interfaces, but it is more flexible since
modules can communicate freely. This approach is widely used in modern systems such as
Solaris.
Kernel contains only core components.
Extra services are added as dynamically loadable modules.
More flexible than layered structure; modules can call any other module.
Used in systems like Solaris.
Modular OS Structure
The fundamental issue with the virtual machine technique is disk-system limitations. If a
host machine has only three physical disks but needs to support seven VMs, it cannot
assign one disk per VM. Instead, the hypervisor creates virtual disks.
Monolithic Structure
A monolithic structure is an OS architecture in which the entire system is built as one large
kernel. All major services—such as process management, memory management, file
systems and device drivers—run together in a single code base. This design places all core
functionality inside one unified kernel.
Entire OS is implemented as one large kernel.
Core services are combined into a single code base.
Includes process, memory and file system management.
Device drivers also operate inside the kernel.
Micro-Kernel Structure
A Micro-Kernel structure removes all non-essential services from the kernel and runs them
in user space, leaving only a small core called the microkernel. This design allows new
services to be added without modifying the kernel, improving security and reliability since
failures in user-space services do not affect the whole system. macOS uses microkernel
concepts but functions as a hybrid kernel (XNU).
Non-essential services run in user space, leaving a small core kernel.
New services can be added without changing the kernel.
More secure and reliable because failures don’t crash the whole OS.
macOS uses microkernel ideas within its hybrid XNU kernel.
Hybrid-Kernel Structure
A hybrid-kernel structure combines the features of both monolithic and microkernel
architectures. It blends the speed and performance of monolithic kernels with the
modularity and stability of microkernels. This approach offers a more flexible and efficient
design than either structure alone.
Combines monolithic and microkernel concepts.
Provides monolithic-level speed and performance.
Offers microkernel-style modularity and stability.
Results in a more flexible and efficient OS design.
Exo-Kernel Structure
Exo-kernel is an OS architecture developed at MIT that gives applications direct control
over hardware resources by separating resource protection from resource management. Its
design avoids imposing OS-level abstractions, allowing applications to customize resources
as needed. Because of this minimal approach, exokernels are small and offer developers
greater flexibility.
Provides application-level control of hardware resources.
Separates protection from resource management.
Avoids enforcing OS abstractions to allow customization.
Small, minimal design that offers greater developer freedom.