24CSEN2011: Operating
Systems
MODULE 1: OVERVIEW OF OPERATING SYSTEMS
12 Hrs
Introduction: Basic organization of hardware components, Role
of OS relative to hardware functionality, Operating-System
Operations, Generations of OS, Types of OS
Process Management, Memory Management, Storage
Management, Kernel Data Structures, Computing Environments.
Operating System Structures: Types, Layered structure,
System Components, Operating System services, Reentrant
Kernels, Monolithic and Microkernel Systems, Interrupt handling
and System Calls, System Boot.
1
Operating-System Structures
An operating system provides the environment within which programs are executed.
1. Operating System Services
2. User Operating System Interface
3. System Calls
4. System services
5. Linkers and loaders
6. Why Applications Are Operating-System Specific
7. Operating System Design and Implementation
8. Operating System Structure
9. Building and Booting an Operating System
10. Operating System Debugging
2
Operating-System Structures…
1. Operating System Services:
i. Program execution
ii. I/O operations
iii. File System manipulation
iv. Communication
v. Error Detection
vi. Resource Allocation
vii. Protection and security
[Link]
3
Operating System - Services
4
Operating System – Services…
An Operating System provides services to users to execute their programs in a
convenient manner.
Following are a few common services provided by an operating system −
Program execution:
Loading a program into memory,
Executing the program,
Provides a mechanism for process synchronization,
Process communication and
Mechanism for deadlock handling.
I/O operations:
An OS manages the communication between user and device drivers.
I/O operation means read or write operation with any file or any specific I/O device.
Operating system provides the access to the required I/O device whenever required.
5
Operating System – Services…
File System manipulation:
Program needs to read a file or write a file.
The operating system gives the permission to the program for operation on file.
Permission varies from read-only, read-write, denied and so on.
OS provides an interface to create the backup file system and
To the user to create/delete files and directories.
Communication:
Two processes often require data to be transferred between them.
Both the processes can be on one computer or on different computers, but are
connected through a computer network.
Communication may be implemented by two methods, either by Shared Memory
or by Message Passing.
6
Operating System – Services…
Error Detection:
The OS constantly checks, detects and handles for possible errors i.e., hardware,
software, and I/O errors.
The OS takes an appropriate action to ensure correct and consistent computing to
ensures system stability.
Resource Allocation:
The OS manages all kinds of resources using schedulers i.e., Ensures fair and efficient
usage.
CPU scheduling algorithms are used for better utilization of CPU.
Protection and security:
The OS ensures that all access to system resources is controlled.
The OS ensures that external I/O devices are protected from invalid access attempts. 7
Operating System – Services…
Accounting
Tracks resource usage (CPU time, memory, disk usage)
Useful for billing, statistics, and system tuning
8
Operating-System Structures…
2. User Operating System Interface
Provides interaction between user and system
Types:
o Command-Line Interface (CLI),
o Graphical User Interface (GUI),
o Touch Interface
9
User Interfaces
An operating system is software that manages computer hardware and software.
It supplies an interface for the user and important utilities for managing the
computer.
User Interface (UI) provides a means of interaction between the user and the
operating system.
The OS provides a user interface (UI), an environment for the user to interact with
the machine.
The UI is either graphical or text-based.
o Graphical user interface (GUI)
o Command line interface (CLI)
o Touch Interface
10
User Interfaces…
Graphical user interface (GUI):
The OS on the most of the computers, laptops, tablets and mobile
phones provides an environment with tiles, icons and/or menus.
This type of interface is called the graphical user interface (GUI) because the
user interacts with images through a mouse, keyboard, touchpad or touchscreen.
Command line interface (CLI):
An OS also provides a method of interaction that is non-graphical, called the
command line interface (CLI).
This is a text-only service with feedback from the OS appearing in text.
Use of CLI requires knowledge of the commands available on a particular
machine.
11
User Interfaces…
12
User Interfaces…
Touch Interface:
A Touch Interface allows users to interact with the system directly
through touch gestures on a screen instead of using a keyboard or
mouse.
Common touch actions include tap, swipe, pinch, zoom, drag, and
long-press.
Touch interfaces are widely used in smartphones, tablets, kiosks,
ATMs, and embedded systems.
They offer an intuitive, fast, and user-friendly experience, especially
for mobile and portable devices.
Example: Touch-based interaction in Android and iOS devices.
13
Operating-System Structures…
3. System Calls:
A system call is a mechanism that provides the interface between a process
and the operating system
Types:
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communications
6. Protection
14
System Calls
A system call is a mechanism that provides the interface between a process and the
operating system
A computer program makes a system call when it makes a request to the operating system’s
kernel.
System call provides the operating system services to the user programs via Application
Program Interface (API)
Following are situations which need system calls in OS:
Reading and writing from files demand system calls.
If a file system wants to create or delete files, system calls are required.
System calls are used for the creation and management of new processes.
Network connections need system calls for sending and receiving packets.
Access to hardware devices like scanner, printer, need a system call. 15
Types of system calls
1. Process Control:
This system calls perform the task of process creation, process termination, etc.
Functions-End and Abort, Load and Execute, Create and Terminate Process, Wait and Signal
Event, Allocate and free memory, Debugger for determining bugs, single step execution, Locks
for managing access to shared data between processes.
2. File Management:
File management system calls handle file manipulation jobs like creating a file, reading, and
writing, etc.
Functions: Create and delete a file, Open and close file, read, write, and reposition, Get and
set file attributes.
3. Device Management:
Device management does the job of device manipulation like reading from device buffers,
writing into device buffers, etc.
Functions-Request and release device, Logically attach/ detach devices, Get and Set device
attributes 16
Types of system calls…
4. Information Maintenance:
It handles information and its transfer between the OS and the user program.
Functions- Get or set time and date, Get process and device attributes
5. Communication:
These types of system calls are specially used for inter-process communications.
Functions- Create, delete communication connections, Send, receive message, Help
OS to transfer status information, Attach or detach remote devices
6. Protection:
It provide the security and protection to system for wanted/unwanted requests
Functions- Control access to resources, Get and set permissions, Allow and deny user
access
17
Examples of Windows and Unix System Calls
Standard C Library Example
C program invoking printf() library call, which
calls write() system call
18
Interrupt Handling and System Calls
Interrupts are signals generated by hardware or software to request immediate
attention from the CPU.
When an interrupt occurs, the CPU pauses the current process, saves its state, and
transfers control to an Interrupt Service Routine (ISR) in the operating system.
Interrupt handling enables the OS to respond to I/O devices, timers, errors, and
external events, improving efficiency and responsiveness.
After servicing the interrupt, the OS restores the process state and resumes
execution.
System calls provide a controlled interface through which user programs request
services from the operating system.
Examples of system-call services include process creation, file operations, memory
19
management, and communication.
Interrupt Handling and System Calls…
A system call causes a software interrupt that switches execution from user mode to kernel mode.
This mechanism ensures protection and security, as user programs cannot access hardware directly.
How Interrupt Handling Works:
1. Interrupt Request (IRQ): A hardware device (e.g., disk, keyboard, timer) raises an interrupt line.
2. Context Save: CPU saves Program Counter (PC), registers, and Processor Status Word
(PSW).
3. Mode Switch: CPU switches from user mode → kernel mode.
4. ISR Execution: OS executes the Interrupt Service Routine (ISR).
5. Interrupt Acknowledge: Device controller is notified that interrupt is handled.
6. Context Restore: Saved state is restored.
7. Resume Execution: Interrupted process continues or scheduler selects another process.
20
System Programs
System Programs can be defined as an act of building systems software using
system programming languages.
According to Computer Hierarchy, one which comes at last is hardware.
Then it is Operating System, System Programs, and finally Application Programs
Program development and execution can be done conveniently in system
programs.
Some of system programs are simply user interfaces, others are complex.
It traditionally lies between user interface and system calls.
21
Operating-System Structures…
22
Operating-System Structures
Modern operating systems are large and complex, requiring careful engineering to
ensure correct operation and easy modification.
A common design approach is to divide the OS into smaller components (modules)
instead of building a single monolithic system.
This modular design is similar to structured programming, where logic is divided
into functions with defined parameters and return values.
Modularization improves readability, maintainability, testing, and extensibility of
the operating system.
Core operating-system components (process management, memory
management, file systems, I/O, etc.) are interconnected and integrated into the
kernel.
The overall OS structure determines how these components cooperate to provide
efficient and reliable system services. 23
Monolithic Structure
A monolithic structure is the simplest operating system design, where all kernel
services are combined into a single, static binary running in one address space
in kernel mode.
The original UNIX operating system is a classic example, consisting of the kernel
and system programs, with most functionality placed inside the kernel.
Although UNIX shows some logical layering, everything between the system-call
interface and the hardware belongs to the kernel.
Linux, which is based on UNIX, also follows a monolithic kernel design, running
entirely in kernel mode, though it supports loadable kernel modules for flexibility.
24
Monolithic Structure…
Advantages:
High performance and efficiency due to minimal system-call overhead
Fast communication within the kernel
Disadvantages:
Difficult to design, debug, and extend
A failure in one component can affect the entire system
Despite limitations, monolithic kernels are still widely used in UNIX, Linux, and
Windows systems due to their speed and simplicity.
The traditional UNIX operating system as being layered as shown in Figure 2.12.
The Linux operating system structured shown in Figure 2.13.
25
Monolithic Structure…
Applications typically use the glibc standard C library
when communicating with the system call interface
to the kernel.
26
Layered Approach
The layered approach designs the operating system as a loosely coupled, modular
system divided into a number of layers (levels).
Layer 0 represents the hardware, while the topmost layer (Layer N) represents the user
interface.
Each layer is an abstract object consisting of data structures and operations, and it uses
only the services provided by lower-level layers.
A layer does not need to know how lower-level operations are implemented, only what
services they provide, thereby hiding internal details from higher layers.
The main advantage is simplicity in design, implementation, debugging, and system
verification, since errors can be isolated to a specific layer.
Once a lower layer is debugged, it can be assumed correct while debugging higher
layers.
27
Layered Approach…
Layered systems are widely used in computer
networks (e.g., TCP/IP) and web applications.
However, pure layered operating systems are rare
due to difficulties in defining layers and
performance overhead caused by traversing
multiple layers for services.
Modern operating systems adopt partial layering,
using fewer layers with more functionality,
achieving modularity without significant
performance loss.
28
Microkernels
The microkernel approach structures the operating system by keeping the kernel
as small as possible by moving nonessential services to user space.
It emerged to address the limitations of monolithic kernels, which became large
and difficult to manage (e.g., early UNIX).
In a microkernel, only essential services remain in the kernel, typically:
Process management
Basic memory management
Inter-process communication (IPC) via message passing
Other services such as file systems, device drivers, and networking run as user-
level processes in separate address spaces.
Communication between client programs and services occurs indirectly through
the microkernel, improving modularity and isolation. 29
Microkernels…
Advantages:
Easier system extension and maintenance
Improved security and reliability (failure of one service does not crash the kernel)
Better portability across hardware platforms
More reliable (less code is running in kernel mode)
Disadvantage:
Performance overhead due to message copying and frequent context switches between
user and kernel space
Historical examples include Mach (developed at Carnegie Mellon University),
Darwin (used in macOS and iOS), and QNX (real-time embedded OS).
Due to performance concerns, many modern systems use a hybrid approach,
combining microkernel ideas with monolithic design. 30
Microkernels…
31
OS Kernel Structures: Comparison
Feature Monolithic Kernel Layered Kernel Microkernel
Minimal kernel;
All OS services in OS divided into
Basic idea services in user
one kernel layers
space
Kernel size Very large Moderate Very small
Structure Single address space Hierarchical layers Client–server model
Message passing
Communication Direct function calls Through lower layers
(IPC)
Medium (layer Lower (IPC &
Performance High (low overhead)
traversal) context switches)
Modularity Poor Good Excellent
Easy (isolated
Ease of debugging Difficult Easy (layer-wise)
services)
Low (failure affects High (service
Reliability Medium
whole OS) isolation)
Security Lower Medium High
Flexibility /
Difficult Moderate Easy
Extensibility 32
Reentrant Kernels
A reentrant kernel allows multiple processes or interrupts to execute kernel code
simultaneously without corrupting shared data.
It supports preemptive multitasking, interrupt handling, and multiprocessor
systems.
Kernel code can be interrupted and safely re-entered by another process or CPU.
Kernel data structures are protected using synchronization mechanisms.
Reentrant kernel allows parallel kernel execution, improving throughput.
Multiple processes (or interrupts) may execute kernel code at the same time.
Examples: Linux, modern UNIX systems, Windows
33
Reentrant Kernels…
Advantages:
Higher system performance and responsiveness
Efficient use of multiple CPU cores
Improved scalability and reliability
Example: Scenario: File Read with Interrupt
Process P1 enters kernel to execute read().
While in kernel mode, a timer interrupt occurs.
Scheduler switches to Process P2.
P2 also enters kernel (e.g., write() system call).
Kernel correctly handles both operations without conflict.
This is possible only if the kernel is reentrant.
34
Operating-System Structures…
9. Building and Booting an Operating System
It is possible to design, code, and implement an operating system specifically for
one specific machine configuration.
However, operating systems are designed to run on any of a class of machines
with a variety of peripheral configurations.
i. Operating-System Generation
ii. System Boot
35
Operating System Generation
Most commonly, a computer system, when purchased, has an operating system already
installed.
For example, you may purchase a new laptop with Windows or macOS preinstalled. But suppose
you wish to replace the preinstalled operating system or add additional operating systems.
Or suppose you purchase a computer without an operating system. In these latter situations,
you have a few options for placing the appropriate OS on the computer and configuring it for
use.
If you are generating (or building) an operating system from scratch, you must follow these
steps:
• Write the operating system source code (or obtain previously written source code).
• Configure the operating system for the system on which it will run.
• Compile the operating system.
• Install the operating system.
• Boot the computer and its new operating system. 36
Operating System Generation…
System configuration specifies required features and hardware support, typically
stored in a configuration file.
System generation approaches vary in flexibility:
Full system build: Configuration modifies source code and the OS is fully
recompiled, producing a system tailored to specific hardware.
Module linking approach: Precompiled object modules (e.g., device drivers)
are selected and linked, resulting in faster system generation but less
customization.
Fully modular approach: System components are loaded at execution time,
requiring only parameter setting during generation.
These approaches balance customization, performance, and generation speed,
allowing the OS to adapt to different hardware environments.
37
System Boot
After an operating system is generated, it must be made available for use by the
hardware.
The process of starting a computer by loading the kernel is known as booting the system.
On most systems, the boot process proceeds as follows:
1. A small piece of code known as the bootstrap program or boot loader locates
the kernel.
2. The kernel is loaded into memory and started.
3. The kernel initializes hardware.
4. The root file system is mounted.
Some computer systems use a multistage boot process:
When the computer is first powered on, a small boot loader located in nonvolatile
firmware known as BIOS is run.
This initial boot loader usually does nothing more than load a second boot loader,
38
which is located at a fixed disk location called the boot block.
System Boot…
The program stored in the boot block may be sophisticated enough to load the entire
operating system into memory and begin its execution.
More typically, it is simple code (as it must fit in a single disk block) and knows only
the address on disk and the length of the remainder of the bootstrap program.
Modern systems increasingly use UEFI (Unified Extensible Firmware Interface) instead of
BIOS, offering faster booting, better 64-bit support, and support for large disks.
Unlike the multistage BIOS process, UEFI acts as a complete boot manager, improving
efficiency and flexibility.
The bootstrap program performs critical tasks such as hardware diagnostics, device
discovery, CPU and memory initialization, and loading the OS kernel into memory.
After successful diagnostics, the bootstrap starts the operating system and mounts the
root file system, at which point the system is considered running.
39
System Boot…
GRUB is a widely used, open-source boot loader for Linux and UNIX, supporting
boot-time configuration changes and multiple kernel selection.
Separate versions of GRUB exist for BIOS and UEFI, and the firmware must know
which boot loader to use.
Mobile systems follow a different boot process; for example, Android uses vendor-
specific boot loaders such as LK (Little Kernel) instead of GRUB.
Android maintains the initial RAM file system (initramfs) as its root file system and
starts essential services before displaying the home screen.
Most operating systems support recovery mode or single-user mode to diagnose
hardware issues, repair file systems, or reinstall the OS.
40