OS Module1 Notes
OS Module1 Notes
OPERATING SYSTEM
24CS410
Page 1
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
TABLE OF CONTENTS
1. What is an Operating System?
2. Computer System Structure
Hardware & Software Layers
Computer Startup & Bootstrap
3. Computer-System Organization
Interrupts
I/O Structure
DMA
4. Storage Hierarchy
Storage Definitions
Types of Storage
5. Computer-System Architecture
Single-Processor
Multiprocessor
Clustered Systems
6. Operating System Operations
Dual-Mode Operation
Timer
7. Process Management
8. Memory Management
9. Storage Management
File System
Mass Storage
Caching
10. Protection and Security
11. Computing Environments
Traditional
Mobile
Distributed
Client-Server
Cloud
12. OS Services & System Calls
OS Services
System Call Types
System Programs
13. OS Design & Structures
Page 2
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Simple
Layered
Microkernels
Modules
Hybrid
14. Virtual Machines
15. OS Generation & System Boot
16. Predicted Exam Questions (5 Marks Each)
Page 3
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
An Operating System is a system software that acts as an interface (middleman) between the
user and the computer hardware. It manages ALL the resources of the computer — CPU, memory,
files, and devices.
Page 4
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Users cannot interact directly with hardware (hardware speaks binary, not English!)
• Running multiple programs at the same time would be impossible
• Memory and CPU would not be managed — programs would crash into each other
• No security — anyone could access anyone's files
Think of the OS like a hotel manager. You (the user) just walk in and ask for a room. The manager
(OS) handles keys, room assignments, cleaning (memory), and makes sure guests (programs) don't
disturb each other. You don't need to know how the plumbing works!
• Process Management: Handles running programs. Decides which program gets the CPU and
for how long. Think: a teacher managing students taking turns to speak in class.
• Memory Management: Keeps track of which part of RAM is used and which is free. Ensures
programs don't accidentally read each other's data. Think: a library where each book has a fixed
shelf — no one grabs someone else's book.
• File System Management: Organizes all your files and folders on disk. Controls who can read,
write, or delete files. Think: a filing cabinet with folders.
• Device Management: Controls all hardware devices — keyboard, mouse, printer, USB, etc. Uses
special programs called device drivers for each device.
• Security & Access Control: Protects your data from unauthorized users. Uses passwords, user
IDs, and permissions. Think: a security guard at the door.
Page 5
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Mobile OS: Designed for smartphones/tablets. Android and iOS are examples.
Page 6
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
1B
COMPUTER SYSTEM STRUCTURE &
ORGANIZATION
Fig 1.2 — Computer System Organization showing CPU, Memory, Device Controllers on a shared bus
Page 7
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Simple Analogy: Turning on a computer is like waking up. The alarm (power button) triggers your body to run its
startup routine: eyes open brain starts legs move go make coffee. The bootstrap is your brain's startup routine!
Fig 1.3 — Interrupt Timeline showing CPU handling interrupts from I/O devices
Types of Interrupts:
• Hardware Interrupt: Triggered by hardware devices (e.g., keyboard press, mouse click, disk
done reading). The device sends a signal on the system bus.
• Software Interrupt (Trap/Exception): Triggered by software — either a system call (user
requesting OS service) or a program error (division by zero, illegal memory access).
• Interrupt Vector: A table that contains the addresses of all service routines. When an interrupt
occurs, the CPU looks up this table to find where to go.
• An OS is interrupt-driven — it spends most of its time waiting for interrupts!
Page 8
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Each I/O device has a device controller — a mini-computer that manages the device.
• Each device controller has its own local buffer (small temporary storage).
• The OS has a device driver for each device controller (software that 'speaks' to the controller).
• CPU moves data between main memory and the device controller's local buffer.
• When an I/O operation finishes, the device controller sends an interrupt to notify the CPU.
• Device controller transfers entire blocks of data directly to/from main memory
• No CPU intervention needed for each byte — CPU does other work meanwhile
• Only ONE interrupt per block transferred (not one per byte!)
• Result: Huge speed improvement for bulk data operations
Page 9
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
1C
STORAGE & COMPUTER
ARCHITECTURE
• Registers: Fastest, smallest. Inside the CPU itself. Only a few bytes. Used for immediate
calculations. Extremely expensive per byte.
• Cache: Super-fast temporary storage. Stores frequently used data to avoid slow RAM access.
Several MB in modern CPUs. Think of it as your desk — quick access.
• Main Memory (RAM): All currently running programs are here. Faster than disk but volatile
(data lost when power off). Gigabytes in size. Think of it as a workbench.
• Electronic Disk (SSD): Non-volatile, fast secondary storage. No moving parts. Much faster
than HDD. Think of it as your bookshelf — organized, quick.
• Magnetic Disk (HDD): Most common secondary storage. Uses spinning magnetic platters.
Large capacity but slower than SSD. Like a filing cabinet.
• Optical Disk: CDs, DVDs, Blu-ray. Uses laser to read/write. Mostly for archiving/distribution.
• Magnetic Tape: Slowest. Used for backups. Sequential access only (must wind to find data).
Very cheap per GB. Like a cassette tape.
Page 10
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
A) Single-Processor Systems
Most basic setup. ONE main CPU that executes all user programs. May also have special-purpose
processors for specific devices (disk controller, keyboard controller) but those don't run user code. If
there's only ONE general-purpose CPU, it's single-processor.
Types of Multiprocessing:
• Asymmetric Multiprocessing (Master/Slave): One master CPU assigns work to slave CPUs.
Master controls everything. Slaves do the assigned tasks.
• Symmetric Multiprocessing (SMP): ALL CPUs are equals — no master. Each CPU has its own
registers. Only memory is shared. N processes can run on N CPUs simultaneously. Used by
Windows, Linux, macOS.
Reliability Concepts:
• Graceful Degradation: When a CPU fails, other CPUs take its work. System slows down
gradually instead of crashing suddenly.
• Fault Tolerant: System detects, diagnoses, and corrects failures automatically. More advanced
than graceful degradation.
C) Clustered Systems
Page 11
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Two or more separate complete computers (nodes) connected via a network, sharing software
resources. Each computer is called a node. They work together as one system.
• Goal: High availability — if one node fails, others continue serving users
• Asymmetric Clustering: One node in hot-standby mode (just watching). If active server fails,
hot-standby immediately takes over.
• Symmetric Clustering: All nodes run applications AND monitor each other. More efficient —
uses all hardware.
• SAN (Storage Area Network): Allows cluster nodes to share storage across miles.
Page 12
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
1D
OS OPERATIONS, PROCESS &
MEMORY MANAGEMENT
Fig 1.7 — Transition between User Mode and Kernel Mode via System Calls and Interrupts
• User Mode (mode bit = 1): Normal programs run here. Limited access to hardware and OS
resources. Can't execute privileged instructions.
• Kernel Mode (mode bit = 0): OS itself runs here. Full access to everything — hardware,
memory, all instructions. Also called supervisor mode, system mode, or privileged mode.
• Mode Bit: A hardware bit that tells the CPU which mode it's in. 0 = Kernel, 1 = User.
Why is this important? Without dual-mode, a buggy program could accidentally overwrite OS memory or crash
the entire system. Dual-mode prevents this!
• Fixed Timer: Interrupts every fixed period (e.g., every 1/60 second)
Page 13
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Variable Timer: Implemented with a clock + counter. OS sets the counter. Clock ticks
decrement it. When counter = 0, interrupt fires!
• Before switching to user mode, OS always sets the timer
• When timer fires, control returns to OS automatically
• OS then decides: give program more time, or switch to another program
Process vs Program:
• Program on disk: Passive — just sitting there (a recipe in a book)
• Process in memory: Active — currently executing (actually cooking the recipe)
Page 14
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Think of RAM as a hotel with rooms. Each process gets a room. When it leaves, the room is freed for the next
process. The OS is the front desk manager!
Page 15
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
1E
STORAGE, PROTECTION, SECURITY
& ENVIRONMENTS
OS handles:
• Creating and deleting files and directories
• Reading, writing, and repositioning files
• Mapping files onto physical disk storage
• Backing up files to stable storage
OS handles:
• Free-space management: Tracking which disk sectors are empty
• Storage allocation: Deciding where to store new files
• Disk scheduling: Ordering disk read/write requests for efficiency
Fig 1.8 — Caching: Data copied to faster storage for quick access
Caching = copying frequently used data to faster storage so you don't have to go to the slow
original source every time.
Page 16
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• If not there (cache miss), get it from slower storage AND store a copy in cache
• Cache is small needs smart management to decide what to keep
• Cache Coherency: In multiprocessor systems, if one CPU updates data in its cache, all other
CPU caches must be updated too (usually done by hardware)
Key Terms:
• Buffering: Temporarily storing data while it moves between devices
• Caching: Keeping a copy of data in fast storage
• Spooling: Overlapping output for one job with input for another (e.g., printer queues multiple
documents)
If a computer has multiple users, we must control who can access what.
Protection vs Security:
• Protection: Internal mechanism — ensures processes/users only access authorized resources.
Memory addressing hardware ensures process stays in its own space.
• Security: External mechanism — defends against external attacks (viruses, worms,
denial-of-service attacks, hacking).
Page 17
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
A) Traditional Computing
• Early offices: PCs connected to network, servers provide file/print services
• Today: Web portals, thin clients, WAN connectivity, home networks with firewalls
• Batch systems (no interaction) Time-sharing systems Modern interactive systems
B) Mobile Computing
• Smartphones and tablets — portable, lightweight, battery-powered
• Connectivity via WiFi (802.11) and cellular data networks
• Dominant mobile OSes: Apple iOS and Google Android
• Apps include: music, video, photos, HD video recording, augmented reality
C) Distributed Systems
• Multiple computers connected via a network, sharing resources
• LAN: Local Area Network — same room, floor, or building
• WAN: Wide Area Network — between cities or countries
• MAN: Metropolitan Area Network — within a city
• Bluetooth / 802.11: Small area wireless networks
D) Client-Server Computing
Page 18
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
F) Cloud Computing
Page 19
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Fig 1.11 — Cloud Computing Types (Public, Private, Hybrid, SaaS, PaaS, IaaS)
• Public Cloud: Available to anyone via the Internet (pay per use). Example: Amazon AWS,
Google Cloud.
• Private Cloud: Run by a company for its own use only. More control, more expensive.
• Hybrid Cloud: Mix of public and private cloud components.
• SaaS (Software as a Service): Applications available via Internet (e.g., Google Docs, Office
365).
• PaaS (Platform as a Service): A software stack ready for your app (e.g., database server in
cloud).
• IaaS (Infrastructure as a Service): Raw servers or storage available over Internet (e.g., AWS
EC2).
H) Virtualization
• Technology that allows one physical machine to run multiple operating systems
simultaneously
• Host OS: The main OS installed on the physical machine
• Guest OS: OS instances running inside virtual machines
• VMM (Virtual Machine Monitor): Software that manages guest OSes (e.g., VMware,
VirtualBox)
Page 20
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Each guest thinks it has its own private computer — it's an illusion!
Page 21
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER 2
OPERATING SYSTEM STRUCTURES
Services, System Calls, and Design — Chapter 2
Page 22
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Page 23
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Fig 2.3 — System call sequence for copying a file from input to output
A system call is how a user program requests a service from the OS. It's the ONLY official way to
get OS services. Think of it as calling customer service — you (user program) can't go to the
warehouse (hardware) yourself; you have to call customer service (OS) to do it for you.
• Usually written in C or C++
• Each system call has a number — stored in a system call table in the kernel
• When a library function like open() is called, the CPU switches to kernel mode and executes
the corresponding system call
Fig 2.4 — System Call Implementation flow between user mode and kernel mode
Page 24
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Memory Block: Parameters stored in memory, address of that block passed in register (used
by Linux and Solaris for large parameter sets)
• Stack: Parameters pushed onto the program stack by the program, OS pops them off when
needed
Page 25
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Functions: end, abort, load, execute, create/terminate process, get/set attributes, wait for
time/event, signal event, allocate/free memory
• Examples: fork(), exec(), exit(), wait()
(5) Communications:
• Functions: create/delete connection, send/receive messages, transfer status, attach/detach
remote devices; message-passing and shared memory models
• Examples: socket(), send(), recv()
(6) Protection:
• Functions: Control access to resources; get/set permissions for files and system resources
• Examples: chmod(), umask()
Communication Models:
• Message Passing: Processes send/receive packaged messages through the OS. Simpler, easier
to implement. Good for small data and inter-computer communication. More system calls
needed (for each read/write).
• Shared Memory: Processes share a common memory region. Faster — less OS involvement.
Good for large amounts of data. Harder to implement, fewer system calls.
Page 26
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
2B SYSTEM PROGRAMS & OS DESIGN
Mechanisms vs Policies:
This is a KEY principle in OS design! Separate the HOW from the WHAT.
• Policy: WHAT should be done. (e.g., How long should a process run before it's switched out?)
• Mechanism: HOW it is done. (e.g., The timer counter that actually measures time)
• Keeping them separate is powerful: policies can CHANGE without rewriting the mechanism
code
• Example: Timer mechanism (counter + clock) stays same; policy (time limit) can change easily
Page 27
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Implementation:
• Old days: OS written entirely in assembly language
• Modern OS: Written in C or C++ (faster to write, easier to port, easier to understand)
• Critical sections (like interrupt handlers) still in assembly for performance
• First OS not in assembly: MCP (Master Control Program)
• Higher-level language tradeoffs: Slightly slower & more storage, BUT much faster to develop
and debug
Page 28
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
2C OS STRUCTURE TYPES
b) Layered Approach
Page 29
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
c) Microkernel
Developed at Carnegie Mellon University in the mid-1980s. The idea: make the kernel as small as
possible. Remove everything non-essential!
• Only keep the ESSENTIAL in the kernel: basic process management, memory management,
message passing
Page 30
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• All other services (file system, device drivers, networking) run as user-space applications
• Communication between components via message passing
• Advantage: Easy to extend — just add a new user-space service program
• Advantage: More reliable — a failing service doesn't crash the kernel
• Disadvantage: Performance overhead from message passing between user-space services
• Famous microkernel: Mach — now forms the base of Mac OS X
d) Modules
Modern approach. Small core kernel + dynamically loadable modules. Think of it as a plugin
architecture.
e) Hybrid Systems
Real-world OSes combine multiple approaches:
i) Mac OS X:
Page 31
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Based on Mac OS X but designed for mobile (no direct Mac OS X apps)
• Cocoa Touch: API for Objective-C — supports touch screens
• Media Services: Graphics, audio, video
• Core Services: Cloud computing, databases
• Core OS: Based on Mac OS X kernel environment
iii) Android:
Page 32
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Page 33
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
2D
VIRTUAL MACHINES & SYSTEM
BOOT
Fig 2.14 — Virtual Machine concept (one physical machine hosts multiple guest OSes)
A Virtual Machine creates the illusion that one physical computer is actually MANY computers.
Each virtual machine thinks it has its own private hardware!
Emulation vs Virtualization:
• Virtualization: Guest runs the SAME CPU architecture as host (just isolated). Fast.
Page 34
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
• Emulation: Guest runs on DIFFERENT CPU type (e.g., running ARM app on x86). Slower
because every instruction must be translated.
Configuration Approaches:
• Edit OS source code recompile link new kernel (most flexible, slowest)
• Modify configuration tables run make to generate new kernel
• System entirely defined by table data (fastest — just edit tables, no recompile)
Page 35
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
CHAPTER
Q PREDICTED EXAM QUESTIONS
10 Questions × 5 Marks Each — With Detailed Answers
These questions are predicted based on common exam patterns for this subject. Each answer is written to score
full 5 marks. Study these carefully!
Function 2 — Memory Management: OS keeps track of which parts of RAM are in use and by
whom. It allocates and deallocates memory space and decides what moves in/out of memory.
Function 3 — File System Management: OS creates/deletes files and directories, supports reading,
writing, mapping files to disk, and backs up data.
Function 4 — Device Management: OS controls hardware devices via device drivers. It manages
I/O operations through device controllers and uses DMA for bulk transfers.
Function 5 — Security & Access Control: OS protects data using user IDs, group IDs, and access
permissions. It defends against external attacks (viruses, hackers) and ensures processes don't
interfere with each other.
User Mode (mode bit = 1): Normal programs execute here with limited privileges. Cannot execute
privileged instructions (direct hardware access). If attempted, hardware traps it as illegal.
Kernel Mode (mode bit = 0): OS itself executes here with full privileges. Can execute any
instruction, access all memory, and control hardware directly. Also called supervisor or privileged
mode.
Mode Bit: A single hardware bit controls the current mode. The CPU checks this bit before
executing privileged instructions.
Switching Mechanism: At boot kernel mode. OS starts user app user mode. System call /
interrupt occurs switches to kernel mode. OS completes service returns to user mode.
Importance: Dual-mode protects the OS from user programs, prevents one user's bug from crashing
another user's programs, and ensures OS maintains control of the system at all times.
Page 36
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Types of Multiprocessing: Asymmetric — master CPU assigns work to slave CPUs. Symmetric
(SMP) — all CPUs are peers, share only memory, all run OS code. SMP used in Windows, Linux,
macOS.
Clustered Systems: Two or more complete computers (nodes) connected via network sharing
software resources. Goal: high availability.
Asymmetric Clustering: One node in hot-standby mode. If active server fails, standby takes over
immediately.
Symmetric Clustering: All nodes run applications and monitor each other. More efficient. Uses SAN
(Storage Area Networks) for shared storage across distributed nodes.
Q4. What are system calls? Explain the different types of system calls with examples. (5
Marks)
Answer:
System Call Definition: A system call is the programmatic interface between user programs and
the OS kernel. It's the only official way for a user program to request OS services. Usually written in
C/C++.
Process Control: end(), abort(), fork(), exec(), wait() — create/terminate processes, wait for events,
set process attributes.
File Management: open(), read(), write(), close(), stat() — create, delete, open, read, write,
reposition files and get/set file attributes.
Device Management: ioctl(), read(), write() — request/release devices, read/write to devices,
get/set device attributes.
Page 37
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Q5. Explain the different types of Operating System Structures: Simple, Layered,
Microkernel, and Module-based. (5 Marks)
Answer:
Simple Structure: No well-defined structure. Grew organically (e.g., MS-DOS). Application
programs can directly access hardware. Vulnerable — one user program crash can crash entire
system. UNIX also started similarly.
Layered Approach: OS divided into numbered layers (Layer 0 = hardware, top = user interface).
Each layer uses only lower-layer services. Advantage: Easy debugging (fix one layer at a time).
Disadvantage: Strict layer ordering limits flexibility; performance overhead as system calls pass
through all layers.
Microkernel: Keep only essentials in kernel (process management, memory, message passing). All
other services run as user-space programs. Communication via message passing. Advantage: Easy to
extend, more reliable. Disadvantage: Performance overhead. Example: Mach (now in macOS).
Modules: Modern approach. Small core kernel + dynamically loadable modules (plug-in
architecture). Any module can communicate directly with any other — no layering restrictions, no
message-passing overhead. Examples: Solaris, Linux, macOS.
Hybrid Systems: Real OSes combine approaches. Mac OS X = layered + microkernel (Mach) +
BSD + modules. Android = Linux kernel + Java runtime (Dalvik VM) + Android API. iOS = Mac OS X
base + Cocoa Touch for mobile.
Multiprogramming: OS keeps multiple programs (job pool) in memory simultaneously. When one
program waits for I/O, OS switches CPU to execute another program. CPU is always busy — no idle
time. Result: much better CPU utilization.
Job Pool: The set of all jobs waiting to run is in secondary storage (job pool). OS picks a subset to
load into main memory. When current job waits for I/O, CPU switches to next job.
Time-Sharing (Multitasking): Extends multiprogramming for interactive use. CPU switches among
jobs so FREQUENTLY that users can interact with each program while it runs. User feels the system
is dedicated to them alone.
Interactive System: User communicates directly via keyboard/mouse and expects immediate
response (< 1 second response time). Each user gets a tiny time slice of CPU.
Key Difference: Multiprogramming optimizes CPU utilization for batch processing. Time-sharing
optimizes for user interaction and response time. Time-sharing is real-time enough for conversation
with the computer.
Page 38
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Q7. Explain the concept of Virtual Machines. What are their benefits? (5 Marks)
Answer:
Virtual Machine Concept: Abstracts the hardware of one physical computer into several execution
environments, giving each the illusion it has its own private computer. Physical resources (CPU,
memory, disk) are shared among all VMs.
Host OS: The main OS running on the physical hardware. Guest OS: OS instances running inside
virtual machines. VMM (Virtual Machine Monitor/Hypervisor): Software managing VMs (e.g.,
VMware, VirtualBox).
Benefit 1 — Multiple OSes: Run Windows and Linux simultaneously on one machine. Useful for
testing compatibility or using OS-specific software.
Benefit 2 — Protection/Isolation: VMs are completely isolated. A virus or crash in one guest OS
does NOT affect other guests or the host. System security is improved.
Benefit 3 — Development and Testing: Developers can test code on different OS environments
without multiple physical machines. No need to stop the system — do development in a separate VM.
Benefit 4 — System Consolidation: Run multiple server applications (each needing different OS)
on one physical machine. Saves hardware cost, power, and space. Software sharing between VMs via
shared file volumes or virtual networks.
Q8. What is an Interrupt? Explain Hardware and Software Interrupts with Interrupt
Handling. (5 Marks)
Answer:
Interrupt Definition: A signal to the CPU to immediately suspend its current program and handle
an urgent, higher-priority event. An OS is interrupt-driven — it waits for interrupts to respond to
events.
Hardware Interrupt: Generated by hardware devices (keyboard, mouse, disk, network). Device
sends signal to CPU via system bus at any time. Example: When you press a key, the keyboard
controller sends a hardware interrupt.
Software Interrupt (Trap/Exception): Generated by software. Two types: (1) System call — user
program intentionally requests OS service. (2) Exception — error in user program (division by zero,
illegal memory access, page fault).
Interrupt Vector: A table storing addresses of all Interrupt Service Routines (ISRs). When interrupt
occurs, CPU looks up the vector to find where to jump.
Interrupt Handling Steps: (1) Device sends interrupt signal. (2) CPU saves current state (registers,
program counter). (3) CPU identifies interrupt type (polling or vectored). (4) CPU jumps to ISR via
interrupt vector. (5) ISR handles the interrupt. (6) CPU restores saved state and resumes original
program.
Interrupt-Driven OS: Without interrupts, OS would have to constantly poll (check) each device —
wasteful. With interrupts, CPU does real work and only responds when a device actually needs
attention.
Page 39
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
Q9. Explain the concept of Caching and its importance in a computer system. (5 Marks)
Answer:
Caching Definition: Caching is copying frequently used data from a slower storage to a faster
storage (cache) so future accesses are faster. The cache acts as a high-speed buffer between the
CPU and slower memory/disk.
Cache Hit vs Cache Miss: When requested data is IN the cache cache hit use it directly (fast!).
When NOT in cache cache miss fetch from slower source, copy to cache, then use it.
Storage Hierarchy: Registers (fastest) Cache RAM SSD HDD Tape (slowest). Data moves
up the hierarchy as it becomes more frequently used.
Cache Management Challenge: Cache is small, so OS must decide what to keep (replacement
policy). If cache is full, something must be evicted to make room for new data.
Cache Coherency: In multiprocessor systems, each CPU has its own local cache. If CPU1 updates
data in its cache, CPU2's cache might have a stale (old) copy. All caches must be updated — this is
cache coherency. Usually handled by hardware.
Importance: Without caching, every CPU instruction fetch and data access would go to slow RAM
or disk. Caching makes modern systems hundreds of times faster. The OS manages cache at multiple
levels (RAM acts as cache for disk; CPU cache handles RAM).
Client-Server Computing: Dedicated servers provide services to client machines. Compute servers
execute actions for clients (client sends request server executes returns result). File servers provide
file system interface (clients can create, read, write, delete files). Example: web server delivering
pages to browsers.
Peer-to-Peer (P2P): No distinction between client and server. All nodes are peers. Each can request
(act as client) or provide (act as server) services. No central bottleneck. Service discovery: either
register with centralized lookup, or broadcast requests to all peers. More resilient than client-server.
Cloud Computing: Computing, storage, and applications delivered as services over the network.
Types: Public cloud (anyone pays to use — AWS, Google Cloud), Private cloud (company's own cloud),
Hybrid cloud (mix of both), SaaS (software like Google Docs), PaaS (platform like database server),
IaaS (raw servers/storage like AWS EC2).
Mobile Computing: Smartphones and tablets using iOS or Android. Connect via IEEE 802.11 WiFi
or cellular data. Optimized for battery life, touch interface, and portability.
Virtualization: Running multiple OSes on one physical machine. Enables cloud services (many
virtual servers on one physical server). Host OS runs VMM which manages guest OSes. Each guest is
fully isolated.
Page 40
24CS410 — OPERATING SYSTEM | MODULE 1 NOTES JSS Science & Technology University
DMA Direct Memory Access — bulk I/O without CPU per byte
Cache Coherency All CPU caches must agree on current data values
Time-Sharing CPU switches so fast users can interact with all programs
Page 41