Operating System Notes
Ὅ Introduction to Operating System
An Operating System (OS) is a software that manages and handles hardware and software
resources of a computing device.
Key Functions of an Operating System
• Manages computer resources such as CPU, memory, and files.
• Acts as an interface between the user and hardware.
• Performs core functions like:
• Process Management
• Memory Management
• File Management
• Organizes system resources similar to different departments in a government.
• Provides an environment in which users can execute programs conveniently and efficiently.
Examples of Operating Systems
• Linux
• Unix
• Windows 11
• MS-DOS
• Android
• macOS
• iOS
? Operating System and User Interaction
Every general-purpose computer consists of the following components:
Computer System Components
Hardware
The hardware includes:
• CPU (Central Processing Unit)
• ALU (Arithmetic Logic Unit)
• Memory
• Input/Output (I/O) Devices
• Peripheral Devices
• Storage Devices
System Programs
The system programs include:
• Compilers
• Loaders
• Editors
• Operating System (OS)
Application Programs
• User-level software that performs specific tasks.
• Examples include web browsers, media players, office applications, etc.
Role of Operating System
1. An operating system continuously runs in the background to manage and coordinate the
use of hardware resources among system programs and application programs for multiple
users.
2. The OS is not merely a user interface. Instead, it provides mechanisms through which users
interact with the computer system.
User Interaction with OS
Command-Line Interface (CLI)
• Text-based interaction with the system.
• Users enter commands through a terminal.
Examples:
• Bash
• PowerShell
Graphical User Interface (GUI)
• Visual interaction using windows, icons, menus, and pointers.
• More user-friendly and easier for beginners.
Examples:
• Windows Desktop
• macOS Finder
Important Note: Kernel
At the core of every Operating System lies the Kernel.
The Kernel acts as the primary interface between hardware and software and is
responsible for handling low-level system operations such as:
• Process Management
• Memory Management
• File System Control
• Device Management and Handling
Ἲ Goals of Operating System
Operating systems are designed to achieve specific objectives that improve system
usability, performance, and reliability.
1. Primary Goals
Easy and Convenient Environment
The primary goal of an Operating System is to provide an easy-to-use and convenient
environment for executing user programs.
Program Execution and Resource Management
The OS manages and allocates computer resources including:
• CPU
• Memory
• Disk Storage
• Input/Output Devices
This ensures fair and efficient utilization of available resources.
Security
The Operating System protects system resources and user data from unauthorized access
by ensuring:
• Confidentiality
• Integrity
• Availability
of information.
2. Secondary Goals
Secondary goals focus on improving the overall performance, efficiency, stability, and
reliability of the computer system.
Efficient Resource Utilization
The OS should maximize the performance and utilization of resources such as:
• CPU
• Memory
• I/O Devices
This helps the system run smoothly and efficiently.
Reliability
An Operating System should be:
• Robust
• Reliable
• Fault-Tolerant
It should be capable of handling errors and exceptions gracefully while ensuring
uninterrupted operation.
Additionally, the OS should be:
• Modular in Design
• Easy to Maintain
• Easy to Debug
Ὄ List of Common Operating Systems
Different operating systems are designed for different environments and use cases.
ᾩ Windows OS
Developed By
• Microsoft
Common Uses
• Personal Computing
• Business Environments
• Gaming
Key Features
• User-Friendly Interface
• Wide Software Compatibility
• Strong Gaming Support
ἴ macOS
Developed By
• Apple
Common Uses
• Creative Industries
• Graphic Design
• Video Editing
• Music Production
• Personal Computing
• Professional Work Environments
Key Features
• Optimized for Apple Hardware
• High Stability and Security
• Excellent Creative Software Ecosystem
ὂ Linux
Developed By
• Originally created by Linus Torvalds
• Maintained by the Open-Source Community
Major Contributors
• Linux Foundation
• Red Hat
• Canonical
• Other Open-Source Organizations
Common Uses
• Servers and Data Centers
• Software Development
• Programming
• Personal Computing for Tech Enthusiasts
Key Features
• Open Source
• Highly Customizable
• Secure and Stable
• Widely Used in Enterprise Environments
⚙ Unix
Developed By
• Originally developed at AT&T Bell Labs
• Available in various commercial and open-source versions
Common Uses
• Servers and Workstations
• Development Environments
• Research and Academic Institutions
Key Features
• Multiuser Support
• Multitasking Capabilities
• High Stability and Reliability
• Strong Security Features
Quick Summary
Operating System Developed By Common Usage
Windows Microsoft Personal Computing, Business, Gaming
macOS Apple Creative & Professional Work
Linux Linus Torvalds & Open-Source Community Servers, Development, Programming
Unix AT&T Bell Labs Servers, Research, Workstations
Applications of Operating System
The Operating System (OS) performs several important functions that help users and
applications interact efficiently with computer hardware.
1. Platform for Application Programs
• Provides a platform on which application programs can run.
• Acts as an intermediary layer between applications and hardware.
• Enables software execution without requiring direct hardware interaction.
2. Managing Input-Output (I/O) Devices
• Manages hardware resources such as:
• Keyboard
• Mouse
• Monitor
• Printer
• Storage Devices
• Ensures effective and fair utilization of all hardware resources.
3. Multitasking
• Allows multiple programs to run simultaneously.
• Manages memory allocation for different applications.
• Enables processes to communicate through shared memory mechanisms.
4. Memory and File Management
• Manages both:
• Primary Memory (RAM)
• Secondary Storage (Hard Disk/SSD)
• Allocates and deallocates memory to programs as required.
• Organizes, stores, retrieves, and protects files efficiently.
5. Security and Protection
• Protects the system from unauthorized access.
• Uses authentication and authorization mechanisms.
• Helps maintain system integrity, confidentiality, and availability.
Types of Operating Systems
Different operating systems are designed to meet different computing requirements. Some
handle a single task at a time, while others support multiple users, processors, or real-time
operations.
Common Types of Operating Systems
Batch Operating System
A Batch Operating System is designed to process large groups of similar jobs efficiently.
Users do not directly interact with the computer during execution. Instead, jobs are
collected, grouped, and executed sequentially by the system.
Advantages
Minimal Idle Time
• Processes jobs continuously without human intervention.
• Reduces system idle time.
Handling Repetitive Tasks
• Suitable for large-scale repetitive operations.
• Commonly used in payroll, billing, and report generation systems.
Improved Throughput
• Processes a large number of jobs efficiently.
• Increases overall system throughput.
Disadvantages
Inefficient CPU Utilization
• CPU remains idle during I/O operations.
• Leads to poor resource utilization.
Increased Response Time
• Users may wait longer for results.
• Jobs are processed sequentially.
Lack of Real-Time Feedback
• No direct interaction between user and system during execution.
• Unsuitable for interactive applications.
Examples
• Insurance Claim Processing
• Library Book Record Management
• Stock Market Report Generation
ὐ Multi-Programming Operating System
A Multi-Programming Operating System allows multiple programs to reside in memory
simultaneously. The CPU switches among these programs to maximize resource utilization
and improve system performance.
Advantages
Better CPU Utilization
• CPU switches to another process during I/O wait time.
• Minimizes idle CPU cycles.
Improved Throughput
• Multiple jobs execute concurrently.
• More work is completed in less time.
Efficient Resource Utilization
• CPU, memory, and I/O devices are shared effectively.
• Enhances overall system efficiency.
Disadvantages
Complex Design
• Requires sophisticated memory management.
• Needs advanced CPU scheduling techniques.
Security Issues
• Multiple programs in memory increase security risks.
• Unauthorized access becomes more challenging to prevent.
High Memory Requirement
• Requires larger memory capacity.
• Multiple programs must be stored simultaneously.
⏱ Multi-Tasking / Time-Sharing Operating
System
A Multi-Tasking (Time-Sharing) Operating System is an extension of multiprogramming
where CPU time is divided into small intervals called time quanta. Each task receives a
fixed share of CPU time, allowing multiple users and applications to run concurrently.
Advantages
Equal CPU Access
• Each task receives a fair share of CPU time.
• Prevents starvation of processes.
Reduced Software Duplication
• Multiple users can use the same software simultaneously.
• Eliminates the need for separate copies.
Low CPU Idle Time
• Efficient scheduling keeps the CPU active.
• Improves system responsiveness.
Disadvantages
Lower Reliability
• A system failure can affect all users.
• Shared environment increases impact of faults.
Security Concerns
• Multiple users increase risks to privacy and data integrity.
• Requires strong protection mechanisms.
Communication Issues
• Data sharing among users may lead to conflicts.
• Synchronization becomes challenging.
Examples
• IBM VM/CMS
• TSO (Time Sharing Option)
• Windows Terminal Services
⚙ Multi-Processing Operating System
A Multi-Processing Operating System uses more than one CPU to execute processes
simultaneously. Multiple processors work together to improve system performance and
throughput.
Advantages
Faster Processing
• Multiple CPUs execute tasks concurrently.
• Significantly improves system speed.
High Reliability
• Failure of one processor does not stop the system.
• Provides fault tolerance.
Supports Heavy Workloads
• Suitable for scientific computations.
• Effective for industrial and engineering applications.
Disadvantages
High Cost
• Multiple processors increase hardware expenses.
• System maintenance is more costly.
Complex Design
• Requires advanced coordination among processors.
• OS support becomes more sophisticated.
Not Always Efficient
• Poor workload distribution may leave processors idle.
• Can reduce expected performance gains.
Examples
• UNIX
• Linux (Ubuntu, Red Hat, Debian)
• macOS
ἱ Distributed Operating System
A Distributed Operating System connects multiple independent computers through a
communication network. Each system has its own CPU and memory but collectively
functions as a single integrated system.
The major advantage of a distributed system is remote resource sharing, allowing users to
access files, software, and services located on other connected systems.
Advantages
Independent Systems
• Failure of one node does not affect others.
• Enhances system reliability.
Easy Scalability
• New computers can be added easily.
• Supports gradual system expansion.
Reduced Processing Delays
• Workloads are distributed across multiple machines.
• Improves overall processing efficiency.
Disadvantages
Network Dependency
• Communication depends heavily on the network.
• Network failures disrupt system operations.
Lack of Standardization
• No universally accepted standards for implementation.
• System development becomes difficult.
High Cost and Complexity
• Requires expensive hardware infrastructure.
• Software development and maintenance are complex.
Issues with Distributed Operating System
Communication Delays
• Data transfer between nodes introduces network latency.
• May result in inconsistent views of shared data.
• Makes event ordering difficult.
Distributed Control Functions
• Scheduling, resource allocation, and deadlock detection must be handled across multiple
nodes.
• Coordination becomes more complex.
Security Challenges
• Messages often travel through public or uncontrolled networks.
• Attackers may intercept, modify, or forge messages.
• Authentication and authorization become critical concerns.
Examples
• LOCUS
• MICROS
• Amoeba
ἱ Network Operating System (NOS)
A Network Operating System (NOS) runs on a server and manages network resources
such as data, users, security, applications, and shared devices.
It enables users within a network to access shared resources like files, printers, and
applications. Since users can view and interact with network configurations and
connections, these systems are considered tightly coupled systems.
Advantages
Centralized and Stable Servers
• Provides centralized management of network resources.
• Ensures reliable and consistent operation.
Easy Upgrades
• New hardware and technologies can be integrated easily.
• Simplifies system expansion and maintenance.
Remote Access
• Allows users to access network resources from different locations.
• Supports multiple devices and remote connectivity.
Disadvantages
High Server Cost
• Installation and maintenance of servers can be expensive.
• Requires dedicated hardware and administration.
Dependency on Server
• Most network operations depend on the central server.
• Server failures may affect all connected users.
Regular Maintenance Required
• Requires frequent updates and monitoring.
• Needs technical support and administration.
Examples
• Microsoft Windows Server 2003
• UNIX
• Linux
• Mac OS X
⏱ Real-Time Operating System (RTOS)
A Real-Time Operating System (RTOS) is designed for applications that require immediate
processing and response to inputs.
The time taken by the system to process an input and produce the corresponding output
is known as the Response Time.
Real-time operating systems are used in environments where timing requirements are
extremely strict, such as:
• Missile Systems
• Air Traffic Control Systems
• Industrial Robots
• Medical Equipment
Types of Real-Time Operating Systems
1. Hard Real-Time Operating System
A Hard Real-Time Operating System is used where strict timing requirements must always
be met and any delay is unacceptable.
Characteristics
• Guarantees response within a fixed deadline.
• Avoids virtual memory to ensure immediate execution.
• Failure to meet timing constraints may result in system failure.
Applications
• Airbag Systems
• Automatic Parachute Systems
• Missile Guidance Systems
• Nuclear Reactor Control Systems
2. Soft Real-Time Operating System
A Soft Real-Time Operating System is used where timely responses are important but
occasional delays are acceptable.
Characteristics
• Provides fast and predictable responses.
• Missing deadlines does not cause complete system failure.
• Focuses on performance rather than absolute timing accuracy.
Applications
• Multimedia Systems
• Video Streaming Platforms
• Online Gaming
• Interactive Applications
Advantages
Maximum Resource Utilization
• Ensures efficient utilization of system devices and resources.
• Increases overall system productivity.
Error-Free Operation
• Designed to minimize operational errors.
• Delivers highly reliable performance.
Efficient Memory Allocation
• Manages memory effectively.
• Ensures predictable system behavior.
Disadvantages
Limited Multitasking
• Only a small number of tasks run simultaneously.
• Focuses on critical applications to avoid timing failures.
Complex Algorithms
• Requires sophisticated scheduling and synchronization algorithms.
• Development and maintenance are difficult.
Thread Priority Issues
• Frequent task switching is not ideal.
• Improper priority assignment can affect performance.
Examples
• Scientific Experiment Systems
• Medical Imaging Systems
• Industrial Robots
Mobile Operating System
A Mobile Operating System (Mobile OS) is specifically designed for mobile devices such
as smartphones and tablets.
It manages the device's hardware and software resources while providing a platform for
running mobile applications and delivering a seamless user experience.
Advantages
User-Friendly Interface
• Designed to be intuitive and easy to use.
• Accessible to users of all experience levels.
Extensive Application Ecosystem
• Supports a vast collection of applications.
• Allows users to customize devices according to their needs.
Multiple Connectivity Options
• Supports Wi-Fi, Bluetooth, Mobile Networks, GPS, and NFC.
• Enables users to stay connected from virtually anywhere.
Disadvantages
Battery Life Constraints
• Heavy usage can quickly drain battery power.
• Power management remains a significant challenge.
Security Risks
• Vulnerable to malware, phishing attacks, and unauthorized access.
• User data may be compromised if proper security measures are not followed.
Fragmentation
• Particularly common in Android devices.
• Different device manufacturers and software versions create compatibility challenges for
developers.
Examples
• Android
• iOS
• BlackBerry OS
Ὄ Quick Comparison of Operating System Types
Type Main Purpose Examples
Batch OS Processes jobs in batches without user interaction Payroll Processing, Billing Systems
Multi-Programming OS Multiple programs in memory simultaneously Early Mainframe Systems
Multi-Tasking / Time-Sharing OS Multiple tasks share CPU time Windows Terminal Services, IBM VM/
Multi-Processing OS Uses multiple CPUs Linux, UNIX, macOS
Distributed OS Multiple computers work as one system LOCUS, MICROS, Amoeba
Network OS Manages network resources and users Windows Server, UNIX, Linux
Real-Time OS Immediate response within deadlines Air Traffic Control, Robots
Mobile OS Designed for smartphones and tablets Android, iOS, BlackBerry OS
⚙ Kernel in Operating System
A Kernel is the core component of an Operating System (OS). It acts as a bridge between
software applications and computer hardware.
The kernel manages critical system resources such as the CPU, memory, storage, and
input/output devices, ensuring that all components work together efficiently and securely.
It is responsible for executing programs, managing files, handling hardware
communication, and controlling access to system resources.
• UserThe
Note: Interface
Kernel (CLI/GUI)
is only one part of an Operating System. The complete Operating
• File System
System Management
also includes:
• Network Services
• Utility Programs
Ἲ •Role of Services
Security Kernel
Hardware-Software Communication
• Facilitates communication between hardware components and user applications.
• Acts as an intermediary layer between applications and physical devices.
Efficient Multitasking
• Manages multiple processes simultaneously.
• Ensures smooth execution of applications without conflicts.
Security and Protection
• Prevents unauthorized access to system resources.
• Enforces protection and access control mechanisms.
System Stability
• Coordinates hardware and software activities.
• Maintains reliable and stable system operation.
Ἵ Types of Kernel
Different operating systems use different kernel architectures depending on performance,
security, and reliability requirements.
1. Monolithic Kernel
A Monolithic Kernel contains almost all operating system services within the kernel space.
Characteristics
• All OS services run inside kernel space.
• Direct communication between components.
• High execution speed.
• Less fault isolation.
Advantages
• Faster performance.
• Efficient communication between system components.
Disadvantages
• Large kernel size.
• Failure in one component may affect the entire system.
Examples
• Unix
• Linux
• OpenVMS
• XTS-400
2. Microkernel
A Microkernel keeps only essential services inside the kernel and moves most operating
system services to user space.
Characteristics
• Minimal kernel functionality.
• Most services execute outside kernel space.
• Better modularity and reliability.
Advantages
• Improved security.
• Better fault isolation.
• Easier maintenance.
Disadvantages
• Additional communication overhead.
• Slightly slower performance.
Examples
• Minix 3
• Mach (Mach 3.0)
3. Hybrid Kernel
A Hybrid Kernel combines features of both Monolithic and Microkernel architectures.
Characteristics
• Critical services remain in kernel space for speed.
• Non-critical services may run in user space.
• Balances performance and reliability.
Advantages
• Better performance than Microkernel.
• Better fault isolation than Monolithic Kernel.
Disadvantages
• More complex design.
• Larger than Microkernels.
Examples
• Windows NT Family
• Windows 2000
• Windows XP
• Windows Vista
• Windows 7
• Windows 8
• Windows 10
• macOS (XNU)
• ReactOS
• Haiku OS
4. Nanokernel
A Nanokernel is an extremely small kernel that provides only basic hardware abstraction.
Characteristics
• Very minimal functionality.
• Most services operate outside the kernel.
• Designed for specialized systems.
Advantages
• Extremely lightweight.
• High flexibility.
Disadvantages
• Limited functionality.
• Rarely used in general-purpose systems.
Examples
• Nemesis
• MIT Exokernel Projects
• XOK
• Aegis
5. Exokernel
An Exokernel focuses mainly on protection and resource allocation.
Instead of managing hardware resources itself, it allows applications to access hardware
resources directly while maintaining security.
Characteristics
• Minimal resource management.
• Direct hardware access for applications.
• Maximum flexibility.
Advantages
• High performance.
• Application-specific resource management.
Disadvantages
• Increased application complexity.
• Difficult to develop and maintain.
Examples
• MIT Exokernel
• XOK
• ExOS
Ὄ Comparison of Kernel Types
Kernel Type Characteristics Examples
Monolithic Kernel All services in kernel space Linux, Unix
Microkernel Minimal services in kernel space Minix 3, Mach
Hybrid Kernel Combination of Monolithic and Microkernel Windows NT, macOS
Nanokernel Extremely small kernel Nemesis, Aegis
Exokernel Direct hardware access with protection MIT Exokernel, ExOS
⚡ Functions of Kernel
The kernel performs several critical functions necessary for the proper operation of a
computer system.
1. Process Management
Responsible for:
• Process Creation
• Process Scheduling
• Process Execution
• Process Termination
Ensures efficient utilization of CPU resources.
2. Memory Management
Handles:
• Memory Allocation
• Memory Deallocation
• Virtual Memory Management
• Memory Protection
• Memory Sharing
Ensures optimal use of system memory.
3. Device Management
Manages all input and output devices.
Responsibilities
• Device Communication
• Device Driver Management
• Hardware Coordination
• I/O Operations
Provides a unified interface for hardware devices.
4. File System Management
Responsible for:
• File Creation
• File Deletion
• File Access
• Directory Management
• Storage Organization
Provides a standard file system interface to applications.
5. Resource Management
Manages system resources including:
• CPU Time
• Disk Space
• Memory
• Network Bandwidth
Allocates and deallocates resources as needed.
6. Security and Access Control
Enforces security policies such as:
• User Authentication
• Access Permissions
• Resource Protection
• Authorization Mechanisms
Protects the system from unauthorized access.
7. Inter-Process Communication (IPC)
Facilitates communication between processes using mechanisms such as:
• Message Passing
• Shared Memory
• Signals
• Pipes
Enables coordinated execution of applications.
ὐ Working of Kernel
The kernel follows a structured workflow to manage hardware and software interactions.
Step 1: System Boot
• Kernel is the first part of the Operating System loaded into memory during system startup.
• Remains resident in memory while the system is running.
Step 2: Kernel Mode and User Mode
Kernel Mode
• Privileged execution mode.
• Full access to hardware and system resources.
User Mode
• Used by application programs.
• Restricted access to hardware resources.
User applications cannot directly access hardware or critical system resources.
Step 3: System Call Request
• Applications request OS services through System Calls (Software Interrupts).
• Control transfers from User Mode to Kernel Mode.
Examples
• Opening a file
• Creating a process
• Allocating memory
• Accessing a device
Step 4: Kernel Execution
The kernel performs the requested operation such as:
• File Input/Output
• Memory Allocation
• Process Creation
• Device Access
Step 5: Return to User Space
• After completing the requested task, the kernel returns the result (or an error message) to
the application.
• Control switches back to User Mode.
Step 6: Context Switching
The kernel scheduler continuously selects the next process or thread for execution.
Purpose
• Supports Multitasking
• Maximizes CPU Utilization
• Ensures Fair Resource Allocation
Ὅ System Call
User programs cannot directly access hardware or critical operating system resources
because doing so would make the system unstable and insecure.
To maintain security and system stability, the Operating System provides System Calls,
which act as controlled interfaces between user programs and the kernel.
A System Call serves as a gateway through which a user program requests services from
the operating system.
Ἲ Definition of System Call
A System Call is:
• A way for programs to interact with the Operating System.
• A mechanism through which the OS provides services to user programs.
• The only entry point into the kernel that executes in Kernel Mode.
• A controlled interface between User Mode and Kernel Mode.
ὐ Why System Calls are Needed
Without system calls:
• Applications would directly access hardware.
• Different programs would use different methods to control devices.
• System security would be compromised.
• Hardware resources could be damaged or misused.
• The operating system would become unstable.
System calls ensure:
• Security
• Resource Protection
• Standardized Hardware Access
• Controlled Communication with the Kernel
Ὄ Examples of System Calls
File Operations
Opening a file in C using:
fopen()
internally uses system calls such as:
open()
Program Execution
Running a program in Linux commonly uses:
fork()
exec()
system calls.
Output Operations
Printing text on the screen typically uses:
write()
system call.
⚙ How System Calls Work
A System Call acts as a controlled entry point between user applications and the operating
system.
Step 1: System Call Request
The user program executes a system call instruction such as:
• syscall
• int 0x80
Step 2: Mode Switch
The CPU switches from:
User Mode ? Kernel Mode
This allows privileged operations to execute safely.
Step 3: Kernel Processing
The kernel identifies the system call number and performs the requested operation.
Examples include:
• File Access
• Process Creation
• Memory Allocation
• Device Communication
Step 4: Return to User Mode
After completing the task:
• Kernel returns the result.
• CPU switches back to User Mode.
Step 5: Result Returned
The application receives:
• Success Status
• Failure/Error Code
• Requested Data
Ὄ Important Note
System Calls do not always cause a Context Switch.
A system call primarily causes a:
User Mode → Kernel Mode Switch
A Context Switch occurs only when:
• The current process is blocked.
• The scheduler decides to run another process.
Therefore:
Operation Happens Always?
Mode Switch ✅ Yes
Context Switch ❌ No
Ἵ System Call Architecture
+----------------------+
| User Programs |
+----------------------+
│
▼
+----------------------+
| User Interface |
+----------------------+
│
▼
+----------------------+
| System Calls |
+----------------------+
│
▼
+----------------------+
| Kernel |
+----------------------+
│
▼
+----------------------+
| Hardware |
+----------------------+
Ὄ Categories of System Calls
Operating System services are grouped into categories based on the type of operation
being performed.
The major categories of System Calls are:
1. File System Calls
2. Process Control Calls
3. Memory Management Calls
4. Interprocess Communication Calls
5. Device Management Calls
Ὄ 1. File System Calls
These system calls are used for file and directory operations.
Common File System Calls
System Call Purpose
open() Open a file
close() Close a file
read() Read data from a file
write() Write data to a file
seek() Move file pointer
ὐ 2. Process Control System Calls
Used for creating, managing, and terminating processes.
Common Process Control Calls
System Call Purpose
fork() Create a new process
exec() Execute a program
wait() Wait for child process
exit() Terminate process
kill() Send signal to process
ᾞ 3. Memory Management System Calls
Used to manage memory allocation and deallocation.
Common Memory Management Calls
System Call Purpose
brk() Change data segment size
sbrk() Increase process memory
mmap() Map files/devices into memory
munmap() Remove memory mapping
mlock() Lock memory pages
munlock() Unlock memory pages
ὑ 4. Interprocess Communication (IPC) System
Calls
Used for communication between processes.
Common IPC Calls
System Call Purpose
pipe() Create communication pipe
socket() Create network socket
shmget() Shared memory creation
semget() Semaphore creation
msgget() Message queue creation
5. Device Management System Calls
Used to interact with hardware devices.
Common Device Management Calls
System Call Purpose
setConsoleMode() Configure console mode
WriteConsole() Write to console
ReadConsole() Read from console
open() Open device
close() Close device
Ὂ Quick Revision
System Call Definition
• Interface between User Programs and Operating System.
• Gateway to Kernel Services.
Working Flow
User Program
↓
System Call
↓
Kernel Mode
↓
Requested Operation
↓
User Mode
↓
Result Returned
Major Categories
1. File System
2. Process Control
3. Memory Management
4. Interprocess Communication (IPC)
5. Device Management
Frequently Asked Examples
Operation System Call
Create Process fork()
Execute Program exec()
Open File open()
Read File read()
Write File write()
Create Pipe pipe()
Create Socket socket()
ὐ What Happens When We Turn On a Computer?
A computer without a running program is simply a collection of electronic components.
The moment the power button is pressed, a sequence of events begins that transforms the
machine from an inactive state into a fully functional computer.
This sequence is known as the Boot Process.
Note: Although the boot process is usually invisible to users, it is one of the most
important foundations of modern computing.
Ὠ Boot Process
The boot process is a series of well-defined steps that initialize hardware, load the
operating system, and prepare the computer for user interaction.
1. Power Supply Initialization
The boot process begins when the Power Supply Unit (PSU) provides electrical power to
the computer's essential components.
Components Powered On
• Motherboard
• Processor (CPU)
• Memory (RAM)
• Hard Disk Drive (HDD) / SSD
• Cooling Fans
Note: At this stage, stable power is supplied to all hardware components so they
can operate correctly.
2. BIOS/UEFI Startup and POST
Modern computers contain firmware known as:
• BIOS (Basic Input/Output System)
• UEFI (Unified Extensible Firmware Interface)
These firmware programs are responsible for preparing the system for booting.
Power-On Self-Test (POST)
POST checks whether critical hardware components are functioning properly.
Components Checked
• CPU
• RAM
• Graphics Card
• Storage Devices
• Keyboard and Other Essential Devices
Error Detection
If hardware problems are found:
• Error messages may appear on the screen.
• The system may produce beep codes.
These are known as POST Beep Codes.
Hardware Initialization
BIOS/UEFI:
• Detects connected devices.
• Configures hardware settings.
• Prepares the system for loading the operating system.
3. Loading the Boot Loader (MBR / GPT Process)
After POST completes successfully, BIOS/UEFI searches for a bootable device according to
the configured boot order.
Common Boot Devices
• Hard Disk
• SSD
• USB Drive
• DVD/CD
Traditional BIOS Systems
BIOS searches for the:
Master Boot Record (MBR)
located in the first sector of the boot disk.
Modern UEFI Systems
UEFI uses:
• GPT (GUID Partition Table)
• EFI System Partition (ESP)
to locate boot information.
Boot Loader
The boot sector contains a small program called the Boot Loader.
Its primary job is to load the operating system kernel into memory.
Examples of Boot Loaders
Linux
• GRUB (Grand Unified Boot Loader)
• LILO (Linux Loader)
Windows
• Windows Boot Manager
Note: The Boot Loader acts as a bridge between firmware and the operating
system.
Ὃ Master Boot Record (MBR)
The Master Boot Record (MBR) is located in the first sector of a storage device and
contains information required to start the operating system.
MBR Contains
Master Boot Code
• Small executable boot program.
Partition Table
Stores information about disk partitions.
Traditionally supports:
• 4 Primary Partitions
or
• 3 Primary Partitions + 1 Extended Partition
Extended Partition
An extended partition can contain multiple:
• Logical Drives
Examples:
• G:
• H:
• I:
• etc.
4. Kernel and Init Process
Once the Boot Loader executes successfully, it loads the Kernel into RAM.
The Kernel is the core component of the Operating System.
Responsibilities of the Kernel
• CPU Management
• Memory Management
• Device Management
• Driver Initialization
• Process Management
• File System Management
Starting the Init Process
After kernel initialization, the kernel launches the Init Process.
The init process determines the system's operating mode.
Traditional Run Levels
Runlevel 3
• Multiuser Mode
• Networking Enabled
• Text-Based Interface
Runlevel 5
• Multiuser Mode
• Networking Enabled
• Graphical User Interface (GUI)
Modern Alternatives
Many modern Linux systems use:
• systemd
• Upstart
instead of the traditional SysV Init.
5. Starting System Services and Daemons
The Init/Systemd process starts background services known as Daemons.
Common Services Started
Networking Services
• Internet connectivity
• Network management
Printing Services
• Printer management
Security Services
• Authentication
• Firewall services
Display Services
• X Server
• Wayland
Note: After these services start, the system displays either a login screen or a
command-line login prompt.
6. User Login and Desktop Environment
After successful login, the Operating System loads the desktop environment.
Examples
Windows
• Windows Desktop
macOS
• Finder
Linux
• GNOME
• KDE Plasma
The user can now interact with applications and hardware through a graphical interface.
⚙ Functions of BIOS/UEFI During Boot
BIOS/UEFI performs several important functions during system startup.
1. POST (Power-On Self-Test)
• Verifies hardware functionality.
• Detects hardware faults.
2. MBR/GPT Handling
• Locates the bootable device.
• Loads the boot loader.
3. System Configuration
Allows users to configure:
• Date and Time
• Boot Order
• CPU Settings
• Memory Settings
4. Security Features
Provides security mechanisms such as:
• BIOS Password
• UEFI Password
• Secure Boot
• TPM (Trusted Platform Module)
5. Init Support
Helps transfer control to the operating system so the init/systemd process can begin
system initialization.
Ὄ Complete Boot Process Flow
Power Button Pressed
│
▼
Power Supply Initialization
│
▼
BIOS / UEFI Starts
│
▼
POST (Hardware Check)
│
▼
Locate Boot Device
│
▼
Load MBR / GPT
│
▼
Load Boot Loader
│
▼
Load Kernel into RAM
│
▼
Start Init / Systemd
│
▼
Start Services & Daemons
│
▼
Login Screen
│
▼
Desktop Environment Loaded
Ὂ Quick│ Revision
▼
Boot Process
System Ready Sequence
for Use
Power On → BIOS/UEFI → POST → MBR/GPT → Boot Loader → Kernel → Init/Systemd →
Services → Login → Desktop
Important Terms
Term Purpose
BIOS Firmware that starts the computer
UEFI Modern replacement for BIOS
POST Hardware diagnostic test
MBR Stores boot information and partition table
GPT Modern partitioning scheme used by UEFI
Boot Loader Loads the operating system kernel
Kernel Core of the Operating System
Init/Systemd Starts services and determines run level
Daemon Background service process