0% found this document useful (0 votes)
2 views12 pages

Module2 OS Notes

Module 2 covers the structure of operating systems, detailing various architectures such as simple, monolithic, layered, microkernel, and hybrid structures, along with their advantages and disadvantages. It also discusses virtualization, OS services, the client-server model, system calls, linkers, loaders, and the booting process of an OS. Key topics include process state transitions and the process control block, which are essential for understanding OS functionality.

Uploaded by

Blehli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views12 pages

Module2 OS Notes

Module 2 covers the structure of operating systems, detailing various architectures such as simple, monolithic, layered, microkernel, and hybrid structures, along with their advantages and disadvantages. It also discusses virtualization, OS services, the client-server model, system calls, linkers, loaders, and the booting process of an OS. Key topics include process state transitions and the process control block, which are essential for understanding OS functionality.

Uploaded by

Blehli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE 2

Structure of Operating Systems

Subject Code: CC203 | 2nd Semester 2025-26

Dr. Debaleena Datta

Contents
→ 1. OS Architecture (Simple, Monolithic, Layered, Microkernel, Hybrid)

→ 2. Virtualization in OS

→ 3. OS Services

→ 4. Client-Server Model

→ 5. System Calls

→ 6. Linker

→ 7. Loader

→ 8. Booting of an OS

→ 9. Process State Transition Diagram (CA3)

→ 10. Process Control Block (CA3)

→ 11. Scheduler Types (CA3)


1. Architecture of Operating Systems
A system structure/architecture for an OS is like the blueprint of how an OS is organized and how its
different parts interact with each other.

a. Simple Structure
• Small, simple and limited systems with no well-defined structure, but grew beyond their original
scope.
• No defined subsystem; interfaces and levels of functionality are not well-separated.
• Application programs have direct access to the underlying hardware, causing crashes to the entire
system.
• Limited hardware resources.
Examples: MS-DOS

b. Monolithic Structure
Entire OS structure is implemented as a single large process in kernel mode. Essential OS services
(process management, memory management, file systems, device drivers) are combined into a single
code block.
• Each component of the OS is contained in the kernel (kernel space); components communicate
using function calls.
Examples: OS/360, VMX, LINUX

■ Advantages ■ Disadvantages

Simple design – all services in one place. If one component fails, the entire OS may crash.

Fast communication between components via functionDifficult


calls. to maintain and extend – any change requires recompiling the

High performance as no inter-process communication Security


[Link] – a bug in one component can compromise the entire sy

c. Layered Structure
Components with similar functionalities are grouped to form a layer. Total n+1 layers constructed (0 to n);
each layer has a different set of functionalities and services.

■ KEY POINT: Layer Rule: Any i-th layer can communicate with layers 0 to i-1, but NOT with the
i+1-th layer. Each layer only needs functionalities present in itself or layers below it.

Layer Functionality

Layer N (Top) User Interface

... ...

Layer 2 Memory and I/O Device Management

Layer 1 Process Scheduling / File System

Layer 0 (Bottom) Hardware


■ Advantages ■ Disadvantages

Modularity – easy to debug and update individual layers.


Poor performance – each layer adds overhead due to calls between l

Abstraction – upper layers don't need to know implementation


Difficult to
details
defineoflayers
lower appropriately.
layers.

Easy to extend or replace individual layers. Not all OS functions fit neatly into a layer model.

Examples: THE operating system, Windows XP, LINUX

d. Microkernel Structure
Components like process management, networking, file system interaction, and device management are
executed outside the kernel (in user space). Memory management and synchronization are executed
inside the kernel.
• Removes all non-essential services from the kernel; implements them as system applications
instead.
• The kernel is kept as small and efficient as possible.
• Provides basic process and memory management, and message passing between other services.
• High modularity – even if one or more components fail, the OS keeps working.
Examples: Windows XP, LINUX (Mach microkernel)

■ Advantages ■ Disadvantages

More reliable – a bug in one service doesn't crash the Performance


kernel. overhead due to message passing between user space

Easier to port to new hardware. More complex communication design.

Better security and fault isolation. Can be slower than monolithic kernels for frequent system calls.

Easier to extend with new services.

e. Hybrid Structure
A hybrid of all architectures explained so far, making it highly useful in present-day OS. Combines different
OS structures to address performance, security, and usability.

Layer Name Functions

Layer 1 (Bottom) Hardware Abstraction Layer Interface between kernel and hardware

Layer 2 (Middle) Microkernel Layer CPU scheduling, memory management,


inter-process communication

Layer 3 (Top) Application Layer File server, I/O management, error detection

Examples: Mac OS X, iOS, Google Android


Summary: Comparison of OS Architectures

Structure Examples Advantages Disadvantages

Simple MS-DOS Easy to develop No protection; crashes


easily

Monolithic Linux, UNIX Fast; all in one kernel Difficult to maintain; one bug
crashes all

Layered THE OS, Windows Modular; easy to debug Performance overhead


XP

Microkernel Windows XP, Mach Reliable; secure; portable Slower due to message
passing

Hybrid Mac OS X, Android Best of all; widely used Complex design

2. Virtualization in OS
OS-based Virtualization: An OS feature in which the kernel enables the existence of various isolated
user-space instances. A user installs the virtualization software in the OS to operate and generate various
virtual machines (VM).
• Installed over a pre-existing OS called the host operating system.
• VMs provide an interface that looks like independent hardware to multiple different OSes running on
the same physical hardware.
• Each OS believes it has access to its own CPU, RAM, I/O devices, hard drives, etc.
• Used for development and testing of software that must run on multiple platforms.
• First appeared for IBM Mainframes in 1972.
Examples: VMware, JVM, .NET Framework

Features of OS-Based Virtualization


• Resource Isolation: Each container has its own set of resources (CPU, memory, I/O bandwidth).

• Lightweight: Containers share the same host OS – faster startup and lower resource usage than
traditional VMs.

• Portability: Containers are highly portable – easy to move between environments without modifying
the application.

• Security: Containers isolate the containerized application from the host OS and other containers.

• Reduced Overhead: Containers don't need to emulate a full hardware environment.

■ Advantages ■ Disadvantages

Greater resource efficiency – no need to emulate a complete


Securityhardware
risk – breach
environment.
in one container can affect others on same hos

High Scalability – containers easily scaled up or [Link] Isolation – may not provide complete isolation.

Easy Management – simple commands to deploy and Dependency


maintain. Issues – compatibility issues between containers.

Reduced Costs – fewer resources and infrastructure needed.


Limited Hardware Access – may have limited access to hardware res
Faster Deployment – containers deployed quickly.

3. OS Services
OSes provide environments in which programs run, and services for the users of the system:

Service Description

User Interfaces Means by which users can issue commands – CLI (sh, csh, ksh, tcsh), GUI
(Windows, KDE, Gnome), or batch command systems.

Program Execution Able to load a program into RAM, run the program, and terminate it normally or
abnormally.

I/O Operations Responsible for transferring data to and from I/O devices (keyboards,
terminals, printers, storage devices).

File-System Manipulation Maintains directory/subdirectory structures, maps file names to specific data
blocks, provides navigation tools.

Communications Inter-process communications implemented as either shared memory or


message passing, or both.

Error Detection Both hardware and software errors must be detected and handled
appropriately, with minimum harmful repercussions.

Resource Allocation Resources managed with generic systems and carefully designed special
systems customized per resource and environment.

Accounting Keeping track of system activity and resource usage for billing purposes or
statistical record keeping.

Protection and Security Preventing harm through uncontrolled internal processes or malicious
outsiders; authentication, ownership, restricted access.

4. Client-Server Model
A distributed application structure that partitions tasks or workloads between providers of a resource or
service (servers) and service requesters (clients).

Component Description

Client A person/organization using a particular service. In digital context: a computer (Host)


capable of receiving information or using a service from servers.

Server A person/medium that serves something. In digital context: a remote computer that
provides information (data) or access to particular services.

How Client-Server Interaction Works (e.g., Web Browsing)

Step 1: User enters the URL. The Browser requests the DNS (Domain Name System) Server.
Step 2: DNS Server looks up the address of the Web Server.
Step 3: DNS Server responds with the IP address of the Web Server.
Step 4: Browser sends an HTTP/HTTPS request to the Web Server's IP (provided by DNS).
Step 5: Server sends over the necessary files for the website.
Step 6: Browser renders the files and displays the website using DOM.

■ KEY POINT: Examples of Client-Server Model: Email, World Wide Web (WWW)

5. System Calls
A system call is a programmatic way in which a computer program requests a service from the kernel of
the OS it is executed on. It is a way for programs to interact with the operating system.
• System call provides OS services to user programs via the Application Program Interface (API).
• System calls are the only entry points into the kernel system and are executed in kernel mode.
• A user program interacts with the OS using a system call; the OS responds by launching system
calls to fulfil the request.

Type of System Call Operations / Examples

Process Control End, abort, load, execute, create, terminate process Get/set process
attributes Wait for time or event Signal event Allocate and free memory

File Management Create file, delete file Open, close, read, write, reposition Get/set file
attributes

Device Management Request/release device Read, write, reposition Get/set device attributes
Logically attach/detach devices

Information Maintenance Get/set time or date Get/set system data Get/set process, file, or device
information

Communication Create/delete communication connection Send/receive messages Transfer


status information Attach/detach remote devices

Protection Provide mechanisms for controlling which users/processes have access to


which system resources System calls allow access mechanisms to be
adjusted as needed

■ KEY POINT: fork() is the system call for creating a new Process. (Important for CA3!)

6. Linker
A linker is a special program that combines the object files (generated by the compiler/assembler) and
other pieces of code to originate an executable file (.exe extension).
• In the object file, the linker searches and appends all libraries needed for execution.
• Regulates the memory space that will hold the code from each module.
• Merges two or more separate object programs and establishes links among them.

Functions of Linker
• Symbol Resolution: Resolves symbols in the program defined in one module and referenced in
another.

• Code Optimization: Optimizes the code generated by the compiler to reduce code size and improve
performance.

• Memory Management: Assigns memory addresses to the code and data sections of the program and
resolves any conflicts.

• Library Management: Links external libraries into the executable file to provide additional
functionality.

7. Loader
A loader is a special program that takes input of executable files from the linker, loads it to main memory,
and prepares the code for execution by the computer.
• Loader allocates memory space to the program and settles symbolic references between objects.
• In charge of loading programs and libraries in the operating system.
• Embedded computer systems don't have loaders – code is executed through ROM.

Functions of Loader
• Loading: Loads the executable file into memory and allocates memory for the program.

• Relocation: Adjusts the program's memory addresses to reflect its location in memory.

• Symbol Resolution: Resolves any unresolved external symbols required by the program.

• Dynamic Linking: Can dynamically link libraries into the program at runtime to provide additional
functionality.

Linker vs Loader – Comparison

Aspect Linker Loader

Purpose Resolves symbol references and Loads the executable program into the
generates a single executable file. computer's memory for execution.

Stage in Process Operates after the compilation of source Operates after linking and before
code. execution.

Interaction Interacts with object files, libraries, and Interacts with executable files and
resolves symbol references. computer memory.

Main Functions Symbol resolution, duplicate symbol Memory allocation, relocation, and
resolution, generating an executable file. initialization of program structures.

Dependency Dependent on the source code, object Dependent on the executable program
files, and libraries. file and available memory space.

Error Detection Detects unresolved symbols, duplicate Detects memory allocation failures,
symbols, and other linking errors. relocation errors, and execution errors.
8. Booting of an OS
When a computer system is started, there is a mechanism that loads the OS from secondary storage into
main memory (RAM). This is called the booting process.

Types of Booting
Type Description

Cold / Hard Booting Process when computer moves from shutdown state to start by pressing the
power button. • System undergoes complete Power-On Self-Test (POST) •
Initializes hardware devices • Reads BIOS from ROM • Eventually loads OS
into RAM

Soft / Warm Booting Process when computer restarts due to reasons like new software/hardware
(Reboot) installation. • Reboots without shutting down entirely • Started by OS restart
command or key combination • Skips some hardware initialization
(components already powered and initialized)

Steps in the Booting Process

I. Loading of BIOS: The small set of instructions in ROM is loaded into computer memory and the
CPU executes those instructions.

II. Power-On Self-Test (POST): BIOS carries out POST to check operability of all hardware. If any
problem is found, user is alerted with POST beeps and screen messages.

III. Loading of Operating System: After successful POST, BIOS reads the bootable sequence from
CMOS. It searches for Master Boot Record (MBR) in bootable devices (floppy disk, CD-ROM, hard
disk). If MBR is not found: system halts with 'No Boot Device Found'. If MBR is found: BIOS loads the
Boot Loader, which eventually loads the OS.

IV. System Configuration: After OS is loaded, device drivers are loaded into memory so devices can
function correctly.

V. System Utilities Loaded: System utilities like antivirus, volume control, etc. are loaded into
memory.

VI. User Authentication: If user authentication is set, the system asks for credentials. On correct
credentials, computer runs GUI shell (most cases) or CLI shell.
9. Process State Transition Diagram ★ CA3 Important
■ KEY POINT: This is a KEY topic for CA3 Examination as per the suggestion sheet.

A process passes through various states from its creation to its completion. The following are the five
states of a process:

State Description

New The process is being created. OS is allocating resources and initializing the PCB
(Process Control Block).

Ready The process is ready to execute and is waiting in the ready queue for CPU
allocation by the scheduler.

Running The process is currently being executed by the CPU. Only one process can be in
this state per CPU at a time.

Blocked / Waiting The process is waiting for some event to occur (e.g., I/O completion, signal). It
cannot proceed until the event is complete.

Terminated / Exit The process has finished execution. Resources are deallocated and the process
is removed from the system.

State Transitions

Transition Trigger Description

New → Ready Admitted OS admits the new process into the ready
queue.

Ready → Running Scheduler Dispatch CPU scheduler selects and dispatches the
process to the CPU.

Running → Ready Interrupt / Preemption Process is preempted (another higher priority


process needs CPU) or time slice expires.

Running → Blocked I/O or Event Wait Process requests I/O or waits for an event
(e.g., reading from disk).

Blocked → Ready I/O or Event Complete The I/O operation or event that the process
was waiting for is completed.

Running → Terminated Exit Process completes execution or is killed by


the OS.

■ KEY POINT: The DISPATCHER is the OS kernel module that gives control of the CPU to the
process selected by the scheduler. A process in 'Blocked' state waiting for I/O goes to the 'Ready'
state (NOT Running) after I/O completes.

10. Process Control Block (PCB) ★ CA3 Important


■ KEY POINT: This is a KEY topic for CA3 Examination as per the suggestion sheet.
A Process Control Block (PCB) is a data structure in the OS kernel containing all the information needed
to manage a particular process. It is also called Task Control Block.

Components of PCB
• Process ID (PID): Unique identifier assigned to each process.

• Process State: Current state of the process (New, Ready, Running, Blocked, Terminated).

• Program Counter (PC): Address of the next instruction to be executed.

• CPU Registers: Contents of all process-centric registers (accumulators, index registers, stack
pointers, general purpose registers, condition codes).

• CPU Scheduling Information: Process priority, pointers to scheduling queues, scheduling


parameters.

• Memory Management Information: Base and limit registers, page tables, or segment tables
depending on memory system used.

• Accounting Information: Amount of CPU time used, clock time elapsed since start, time limits,
account numbers.

• I/O Status Information: List of I/O devices allocated to the process, list of open files.

■ KEY POINT: The PCB is the repository for any information that may vary from process to process.
Each process has exactly one PCB. When the OS switches from one process to another (context
switch), it saves the current process state into its PCB and loads the new process state from its
PCB.

11. Scheduler Types ★ CA3 Important


■ KEY POINT: This is a KEY topic for CA3 Examination as per the suggestion sheet.

A scheduler is an OS component that decides which process runs next, when, and for how long. There
are three types of schedulers:

Scheduler Type Description Movement

Long-term Scheduler • Selects processes from the Job Queue (programs waiting Disk → Main
(Job Scheduler) on disk) and loads them into the Ready Queue in main Memory
memory. • Controls the degree of multiprogramming
(number of processes in memory). • Invoked infrequently
(seconds, minutes) – can afford to be slow. • Must balance
I/O-bound and CPU-bound processes. • Example: selects
which programs to bring from disk to main memory.

Short-term Scheduler • Selects a process from the Ready Queue and assigns the Ready Queue →
(CPU Scheduler) CPU to it. • Invoked very frequently (milliseconds) – must be CPU
very fast. • Implements CPU scheduling algorithms (FCFS,
SJF, Priority, Round Robin). • Interacts closely with the
dispatcher. • Example: selects which process gets the CPU
next.
Medium-term Scheduler • Temporarily removes processes from main memory and Main Memory ↔
(Swapper) places them in secondary storage (swap out). • Brings them Secondary
back when appropriate (swap in). • Goal: to control degree of Storage
multiprogramming when memory is overloaded. • Reduces
memory competition between processes. • Example: swaps
out a blocked process to make room for a new one.

Summary Comparison

Aspect Long-term Short-term Medium-term

Frequency Low High (every few ms) Medium

Speed Slow (can afford) Fast (must be) Medium

Queue Managed Job Queue (disk) Ready Queue (memory) Memory ↔ Disk

Controls Degree of CPU allocation Degree of


multiprogramming multiprogramming

Algorithm Used Job selection criteria FCFS, SJF, RR, Priority Swapping criteria
Quick Revision – Key Points for CA3
1. fork() is the system call for creating a new Process.

2. The dispatcher is the OS kernel module that gives control of the CPU to the process selected by the
scheduler.

3. A process in 'Blocked' state waiting for I/O goes to the 'Ready' state after I/O completes.

4. Preemptive SJF (Shortest Job First) = Shortest Remaining Time First (SRTF).

5. Priority Scheduling can cause starvation → resolved using Aging method.

6. Time-sharing OS: each user gets a small time slice (time quantum) of CPU time.

7. Turnaround Time (TAT) = time from submission to completion of a process.

8. Preemption = OS temporarily interrupts a running process to give CPU to another.

9. Long-term Scheduler: Job Queue (disk) → Ready Queue (main memory).

10. Short-term Scheduler: Ready Queue → CPU.

11. Medium-term Scheduler: Swaps processes in/out of main memory to control multiprogramming
degree.

12. Second-generation OS (Batch Systems): jobs collected and executed in groups without user
interaction.

13. Linker → combines object files into a single executable (.exe).

14. Loader → loads the executable into main memory for execution.

15. Cold Boot = power-on from shutdown. Warm Boot = restart without full shutdown.

16. MBR (Master Boot Record) searched during booting. If not found: 'No Boot Device Found'.

17. OS Architecture: Simple → Monolithic → Layered → Microkernel → Hybrid (increasing complexity


and reliability).

You might also like