OS Sem notes
➖
Diff between
1. Process & Thread
Process Thread
Process means a program in
Thread means a segment of a process.
execution.
A process takes more time to
A thread takes less time to terminate.
terminate.
It takes more time for creation. It takes less time for creation.
It also takes more time for context
It takes less time for context switching.
switching.
A process is less efficient in terms
Thread is more efficient in terms of communication.
of communication.
We don't need multi programs in action for multiple
Multiprogramming holds the
threads because a single process consists of
concepts of multi-process.
multiple threads.
Every process runs in its own
Threads share memory.
memory.
A process is heavyweight A Thread is lightweight as each thread in a process
compared to a thread. shares code, data, and resources.
Process switching uses an Thread switching may not require calling
interface in an operating system. involvement of operating system.
If one process is blocked, then it
If a user-level thread is blocked, then all other user-
will not affect the execution of
level threads are blocked.
other processes.
A process has its own Process
Thread has Parents' PCB, its own Thread Control
Control Block, Stack, and Address
Block, and Stack and common Address space.
Space.
Since all threads of the same process share
Changes to the parent process do address space and other resources so any changes
not affect child processes. to the main thread may affect the behavior of the
other threads of the process.
A system call is involved in it. No system call is involved, it is created using APIs.
OS Sem notes 1
A process does not share data
Threads share data with each other.
with each other.
Monolithic Operating System
1. Introduction & Definition
A Monolithic Operating System is a system where the entire OS runs in
kernel mode.
The kernel handles all services like memory management, device control,
file system, and process management.
Also called a monolithic kernel.
Originated in the 1970s, used in banking, batch processing, and time-
sharing systems.
🔑 Keyword: “One Big Kernel Controls All”
2. Architecture & Working
All system functionalities are in a single large binary file.
No separation between kernel space and user space.
All components directly communicate via function calls, no message-
passing like in microkernels.
🛠️ Monolithic = All-in-one OS kernel
OS Sem notes 2
3. CP/M & DOS Examples (Real Systems)
CP/M uses:
BIOS (Basic Input/Output),
BDOS (Disk Ops),
CCP (Console).
DOS layout:
Interrupt table → Application area → Resident DOS → BIOS.
💡 Simple 16-bit/20-bit address space sharing.
4. Characteristics of Monolithic Architecture
📦 Single Executable: Everything packaged together.
🔄 Tightly Coupled: One module depends on the others.
🧠 Shared Memory: All modules share same memory.
🚀 Fast Function Calls: No message overhead.
🎮 Centralized Control Flow: One main controller.
🧠 Trick to Remember: "STaSH Control" = Single, Tightly-coupled, Shared
memory, High performance, Central flow
5. E-Commerce App Example (Easy recall)
Imagine a shop app where UI, Catalog, Cart, Discount, Orders = All in one
block.
Single codebase, single deployment.
Any small change (e.g., Discount module) → redeploy everything.
📌 Real-life picture of monolithic system.
6. Advantages of Monolithic OS
⚡ High Performance: Direct system calls = Fast execution.
🛠️ Simpler Design: Easy to build & test.
🔁 Low Overhead: No need for message-passing.
OS Sem notes 3
💾 Hardware Friendly: Works on a wide variety of devices.
👨🔧 Driver Friendly: Device drivers integrate directly with the kernel.
🧰 Efficient Resource Use: No extra interfaces or daemons.
🧠 Mnemonic: “Hi-Speed SHaDE”
(Hardware, Simplicity, High performance, Drivers, Efficiency)
7. Disadvantages of Monolithic OS
🔗 Too Dependent: Modules tightly coupled.
🐌 Slow Development: Redeploy entire app for minor changes.
📈 Unscalable: Cannot scale parts independently.
💥 Less Reliable: Crash in one module = full system crash.
🔄 Hard to Upgrade: Difficult to adopt new tech.
🧠 Trick: “TUSCH” = Tightly coupled, Unscalable, Slow to update, Crash risk,
Hard upgrades
8. Monolithic vs Microkernel (Bonus Insight)
Microkernel separates kernel & user services → uses IPC.
Monolithic keeps all services in kernel → no separation.
Microkernel = safer but slower.
Monolithic = faster but riskier.
🧠 Think: Monolithic = Muscle, Microkernel = Modular
✅ Final Wrap-up Line (to impress examiner):
"Monolithic OS offers speed and simplicity but sacrifices
flexibility, reliability, and modularity—making it ideal for small
systems, but less suited for modern distributed apps."
Layered Structure of Operating System – Pointwise Answer
OS Sem notes 4
1. Definition:
The Layered Structure is a type of system structure where the operating
system is divided into multiple layers, each performing a specific and well-
defined task.
2. Purpose:
Designed to improve previous OS structures like:
Monolithic Structure (e.g., UNIX)
Simple Structure (e.g., MS-DOS)
3. Example:
The Windows NT operating system uses the layered approach.
4. Design Layout:
The OS is separated into layers (0 to n).
Each layer performs a unique function.
5. Hierarchy Rules:
a. The outermost layer must be the User Interface layer.
b. The innermost layer must be the Hardware layer.
c. A particular layer can access all the layers present below it but it cannot
access the layers present above it. That is layer n-1 can access all the
layers from n-2 to 0 but it cannot access the nth layer.
Thus if the user layer wants to interact with the hardware layer, the
response will be traveled through all the layers from n-1 to 1. Each layer
must be designed and implemented such that it will need only the services
provided by the layers below it.
OS Sem notes 5
6. Modularity:
Each layer is independent and modular.
Allows for easier debugging, testing, and maintenance.
7. Security & Control:
Since access is limited to the lower layers only,
this provides security, data abstraction, and clear structure.
✅ Advantages (Pros)
1. Simplified Debugging:
Since layers are modular, bugs are easier to locate and fix.
2. Enhanced Maintainability:
Modifications in one layer don’t affect others, improving stability.
❌ Disadvantages (Cons)
1. Performance Overhead:
Each request passes through multiple layers, which can slow down
performance.
2. Complex Layer Design:
Designing proper layer boundaries is difficult, and poor design may cause
inefficiency.
Microkernel
OS Sem notes 6
✅ 1. What is a Kernel?
The kernel is the core part of an operating system.
It acts as a bridge between applications and hardware, managing
system resources like CPU, memory, I/O devices, etc.
It is one of the first programs loaded during system startup, right after
the bootloader.
✅ 2. What is a Microkernel? (💡 Expanded)
A microkernel is a minimalist version of the kernel that provides only
the essential services required by the OS.
These core services include:
Basic memory management
CPU task scheduling
Inter-process communication (IPC)
Other services like device drivers, file systems, and networking are
moved out of the kernel into user space, unlike in monolithic kernels
where everything runs in kernel space.
Communication between user services and the microkernel is done
through message passing, not direct system calls.
This makes the OS more secure, modular, and fault-tolerant.
✅ 3. Microkernel Architecture (💡 Expanded)
The architecture is designed to keep the kernel size small by including
only the most critical components.
The kernel handles:
1. Inter-Process Communication (IPC) – For communication between
user-space services.
2. Memory Management – Allocating and protecting memory for
processes.
3. CPU Scheduling – Managing process execution on the CPU.
OS Sem notes 7
All other services (device drivers, file systems, GUI, etc.) run in user
space as separate processes.
This modular separation ensures that a failure in one service doesn't
crash the entire system, enhancing system stability.
✅ 4. Features of Microkernel
🔹 Minimal Core: Only runs necessary kernel functions.
🔹 Modular: Services separated into independent modules.
🔹 Fault Isolation: One service crash ≠ whole system crash.
🔹 Easy Maintenance: New features don’t need kernel changes.
✅ 5. Kernel Mode vs User Mode
Kernel Mode: Can run privileged instructions.
User Mode: For applications, restricted from direct hardware access.
Switching from user to kernel mode is done via system calls (software
interrupts).
✅ 6. Advantages of Microkernel
1. Modularity – Easy to update/replace services.
2. Security – Small attack surface due to minimal kernel.
3. Stability & Reliability – Fault in user service ≠ crash system.
4. Portability & Scalability – Easily portable to other platforms.
❌ 7. Disadvantages of Microkernel
1. Slower Message Passing – IPC adds overhead.
2. More Complex Design – Harder to develop/maintain.
3. Higher Memory Use – Due to duplicated services in user space.
4. Lower Performance – Compared to monolithic kernels in some cases.
✅ 8. Examples of Microkernel OS
QNX, MINIX, L4
OS Sem notes 8
✅ 9. Conclusion
Microkernel offers security, stability, and modularity.
Only core services run in kernel space.
Other services in user space improve isolation and maintainability.
Slight performance trade-off due to message passing.
System Calls :`
A system call is a programmatic way in which a computer program requests a
service from the kernel of the operating system on which it is executed.
A system call is a way for programs to interact with the operating system. A
computer program makes a system call when it requests the operating
system's kernel.
System call provides the services of the operating system to the 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 can interact with the operating system using a system call.
A number of services are requested by the program, and the OS responds
by launching a number of systems calls to fulfill the request.
A system call can be written in high-level languages like C or Pascal or in
assembly language. If a high-level language is used, the operating system
may directly invoke system calls, which are predefined functions.
A system call is initiated by the program executing a specific instruction,
which triggers a switch to kernel mode, allowing the program to request a
service from the OS. The OS then handles the request, performs the
necessary operations, and returns the result back to the program.
System calls are essential for the proper functioning of an operating
system, as they provide a standardized way for programs to access system
resources. Without system calls, each program would need to implement its
methods for accessing hardware and system services, leading to
inconsistent and error-prone behavior.
Types :
OS Sem notes 9
OS Sem notes 10
Services Provided by System Calls
Process Creation and Management
Main Memory Management
File Access, Directory, and File System Management
Device Handling(I/O)
Protection
Networking, etc.
Process Control: end, abort, create, terminate, allocate, and free
memory.
File Management: create, open, close, delete, read files, etc.
Device Management
Information Maintenance
Communication
Features of System Calls
Interface: System calls provide a well-defined interface between user
programs and the operating system. Programs make requests by calling
specific functions, and the operating system responds by executing the
requested service and returning a result.
Protection: System calls are used to access privileged operations that are
not available to normal user programs. The operating system uses this
privilege to protect the system from malicious or unauthorized access.
Kernel Mode: When a system call is made, the program is temporarily
switched from user mode to kernel mode. In kernel mode, the program has
access to all system resources, including hardware, memory, and other
processes.
Context Switching: A system call requires a context switch, which involves
saving the state of the current process and switching to the kernel mode to
execute the requested service. This can introduce overhead, which can
impact system performance.
OS Sem notes 11
Error Handling: System calls can return error codes to indicate problems
with the requested service. Programs must check for these errors and
handle them appropriately.
Synchronization: System calls can be used to synchronize access to
shared resources, such as files or network connections. The operating
system provides synchronization mechanisms, such as locks
or semaphores, to ensure that multiple programs can access these
resources safely.
How does System Call Work?
Here is a detailed explanation step by step how system calls work:
Users need special resources: Sometimes programs need to do some
special things that can't be done without the permission of the OS like
reading from a file, writing to a file, getting any information from the
hardware, or requesting a space in memory.
The program makes a system call request: There are special predefined
instructions to make a request to the operating system. These instructions
are nothing but just a "system call". The program uses these system calls in
its code when needed.
Operating system sees the system call: When the OS sees the system call
then it recognizes that the program needs help at this time so it temporarily
stops the program execution and gives all the control to a special part of
itself called 'Kernel'. Now 'Kernel' solves the need of the program.
The operating system performs the operations: Now the operating system
performs the operation that is requested by the program. Example: reading
content from a file etc.
Operating system give control back to the program : After performing the
special operation, OS give control back to the program for further execution
of program.
Context Swit`ching
OS Sem notes 12
Process in Operating System
A process is a program in execution. For example, when we write a program in
C or C++ and compile it, the compiler creates binary code. The original code
and binary code are both programs. When we actually run the binary code, it
becomes a process.
A process is an 'active' entity instead of a program, which is considered a
'passive' entity.
A single program can create many processes when run multiple times; for
example, when we open a .exe or binary file multiple times, multiple
instances begin (multiple processes are created). .
OS Sem notes 13
How Does a Process Look Like in
Memory?
A process in memory is divided into several distinct sections, each serving a
different purpose. Here's how a process typically looks in memory:
Text Section: A text or code segment contains executable instructions. It is
typically a read only section
Stack: The stack contains temporary data, such as function parameters,
returns addresses, and local variables.
Data Section: Contains the global variable.
Heap Section: Dynamically memory allocated to process during its run
time.
Attributes of a Process
A process has several important attributes that help the operating system
manage and control it. These attributes are stored in a structure called
the Process Control Block (PCB) (sometimes called a task control block). The
PCB keeps all the key information about the process, including:
OS Sem notes 14
1. Process ID (PID): A unique number assigned to each process so the
operating system can identify it.
2. Process State: This shows the current status of the process, like whether it
is running, waiting, or ready to execute.
3. Priority and other CPU Scheduling Information: Data that helps the
operating system decide which process should run next, like priority levels
and pointers to scheduling queues.
4. I/O Information: Information about input/output devices the process is
using.
5. File Descriptors: Information about open files files and network
connections.
6. Accounting Information: Tracks how long the process has run, the amount
of CPU time used, and other resource usage data.
7. Memory Management Information: Details about the memory space
allocated to the process, including where it is loaded in memory and the
structure of its memory layout (stack, heap, etc.).
What is a Process Control Block(PCB)?
A Process Control Block (PCB) is a data structure that is used by an Operating
System to manage and regulate how processes are carried out.
OS Sem notes 15
In operating systems, managing the process and scheduling them properly play
the most significant role in the efficient usage of memory and other system
resources.
In the process control block, all the details regarding the process
corresponding to it like its current status, its program counter, its memory use,
its open files, and details about CPU scheduling are stored.
A process control block (PCB) contains information about the process, i.e.
registers, quantum, priority, etc. The process table is an array of PCBs, which
logically contains a PCB for all of the current processes in the system.
Primary Terminologies Related to Process
Control Block
OS Sem notes 16
Process State: The state of the process is stored in the PCB which helps to
manage the processes and schedule them. There are different states for a
process which are "running," "waiting," "ready," or "terminated."
Process ID: The OS assigns a unique identifier to every process as soon as
it is created which is known as Process ID, this helps to distinguish between
processes.
Program Counter: While running processes when the context switch
occurs the last instruction to be executed is stored in the program counter
which helps in resuming the execution of the process from where it left off.
CPU Registers: The CPU registers of the process helps to restore the state
of the process so the PCB stores a copy of them.
Memory Information: The information like the base address or total
memory allocated to a process is stored in PCB which helps in efficient
memory allocation to the processes.
Process Scheduling Information: The priority of the processes or the
algorithm of scheduling is stored in the PCB to help in making scheduling
decisions of the OS.
Accounting Information: The information such as CPU time, memory
usage, etc helps the OS to monitor the performance of the process.
OS Sem notes 17
OS Sem notes 18