Operating Systems
ART-A (Short Answers)
Each carries 1 mark.
1. a) Assume system calls and explain
System calls provide the interface between a process and the OS.
Example: read(), write(), fork().
2. b) Conclude a Real-time system?
A system with strict timing constraints.
Must respond within a defined time limit (e.g., pacemakers, industrial control).
3. c) Brief note on deadlock detection
Uses algorithms like Resource Allocation Graph.
Detects circular wait among processes.
4. d) Different methods for deadlock
Prevention, Avoidance, Detection & Recovery.
Example: Banker's algorithm (Avoidance).
5. e) Semaphores
Synchronization tool.
wait() and signal() operations prevent race conditions.
6. f) Shared memory
Memory accessible by multiple processes.
Fastest …
7. g) Segmentation
Memory divided into segments (code, data, stack).
Logical view of memory.
8. h) Free space management
Tracks disk blocks not allocated.
Techniques: Bitmaps, Linked list, Grouping.
9. i) ioctl system call
I/O control for device-specific operations.
Example: Changing terminal modes.
Part B
2. a) Explain Distributed Systems?
A Distributed System is a collection of independent computers that appear to the users as a single
coherent system.
Characteristics:
Resource Sharing: Printers, files, and other resources shared over the network.
Concurrency: Multiple processes run simultaneously on different machines.
Scalability: Easy to add more systems to improve performance.
Fault Tolerance: Failure of one node doesn’t bring down the whole system.
Transparency: Location and access transparency hide the complexity from users.
Q2. b) Describe Characteristics:
i) Multiprogramming System
Allows multiple jobs to reside in memory at the same time.
The CPU switches from one job to another to increase CPU utilization.
It reduces idle time of CPU.
Characteristics: Efficient CPU use, increased throughput.
ii) Distributed System
Network of independent computers communicating and coordinating.
No shared memory; all interaction is via message passing.
Ensures load balancing and fault isolation.
Examples: Google Search, Amazon Web Services.
Q3. a) What is Process and Scheduling?
Process:
A process is an active instance of a program.
Includes Process Control Block (PCB) which holds process state, registers, memory info.
Process States: New → Ready → Running → Waiting → Terminated.
Scheduling:
Determines the order of execution for processes.
Key for multiprogramming to maximize CPU efficiency.
Criteria: CPU utilization, throughput, waiting time, etc.
Q3. b) i) Process and ii) Thread
i) Process:
Has its own address space, memory, and resources.
Heavier to create, switch context.
ii) Thread:
Light-weight process that shares memory with other threads of the same process.
Faster to create and manage.
Threads are used for multitasking within a single application (e.g., browser tabs).
Q4. a) Explain Scheduling Algorithms
1. FCFS (First Come First Serve):
Jobs are executed in the order they arrive.
Non-preemptive; simple but can cause long waiting time.
2. SJF (Shortest Job First):
Executes the process with the smallest burst time.
Can be preemptive (SRTF) or non-preemptive.
May cause starvation.
3. Round Robin:
Each process gets a fixed time quantum.
Preemptive and good for time-sharing systems.
4. Priority Scheduling:
Each process is assigned a priority.
Higher priority executed first.
Can be preemptive or non-preemptive.
Q4. b) What is Deadlock Avoidance and Explain?
Deadlock Avoidance ensures the system never enters an unsafe state.
Banker’s Algorithm is commonly used.
Requires advance knowledge of resources needed by each process.
Conditions for Deadlock:
1. Mutual Exclusion
2. Hold and Wait
3. No Preemption
4. Circular Wait
Deadlock avoidance ensures at least one condition is always false.
Q5. a) Multiple-Processor Scheduling & Real-Time Scheduling
Multiple-Processor Scheduling:
Applies when more than one CPU is available.
Symmetric Multiprocessing (SMP): All processors run a common OS.
Load balancing and processor affinity are key issues.
Real-Time Scheduling:
Used in systems where response time is critical (e.g., medical, robotics).
Hard Real-Time: Deadline must be met.
Soft Real-Time: Occasional misses tolerable.
Algorithms: Rate Monotonic, EDF (Earliest Deadline First).
Q5. b) i) How Deadlock Can Be Detected
Deadlock Detection:
Allows system to enter deadlock, then detects and recovers.
Uses Resource Allocation Graph (RAG) and Wait-For Graph.
Recovery:
Abort one or more processes.
Preempt resources from processes.
Rollback partially completed processes.
Q5. b) ii) Classical Problems of Synchronization
1. Producer-Consumer Problem:
Shared buffer between producer and consumer.
Needs semaphores to avoid race conditions.
2. Dining Philosopher Problem:
Philosophers alternately eat and think.
Need forks (resources), causing potential deadlock.
3. Readers-Writers Problem:
Multiple readers can read, but writers need exclusive access.
Solutions use:
Semaphores
Mutex
Monitors
6 a) i) FIFO
FIFO (First-In, First-Out) is a special file used in Inter-Process Communication (IPC) . Data written first
into the FIFO is the first to be read.
Used for communication between unrelated processes.
Created using mkfifo() system call in UNIX.
Acts like a pipe but persists in the file system.
Example use: One process writes to the FIFO, another reads from it.
ii) Message Queues
A Message Queue is an IPC mechanism where messages are sent to a queue and retrieved
asynchronously.
Managed by the kernel.
Messages include a type, size, and content.
System calls: msgget(), msgsnd(), msgrcv(), msgctl().
Supports synchronization, priority, and message filtering.
7 a) Explain the Critical Section Problems
The critical section is the part of a program that accesses shared resources (like memory or files). If
multiple processes enter the critical section simultaneously, it may lead to race conditions.
Requirements to solve:
1. Mutual Exclusion – Only one process in the critical section.
2. Progress – Others wait only if necessary.
3. Bounded Waiting – No process waits forever.
Solutions: Mutex, semaphores, Peterson’s algorithm, etc.
7 b) Explain Synchronization of Hardware
Hardware synchronization uses atomic instructions provided by CPUs to implement synchronization
primitives.
Examples:
Test-and-Set: Checks and sets a lock in one step.
Compare-and-Swap: Compares and changes value atomically.
Interrupt Disabling: Prevents context switching temporarily (used in kernels).
Used to build mutex locks and semaphores.
8 a) Why do we need a Demand Paging System?
Demand paging loads pages into memory only when required , instead of loading the whole program.
Advantages:
Saves memory.
Allows large programs to run.
Reduces startup time.
Mechanism: Page fault occurs → OS loads required page → resumes execution.
8 b) Functions of Virtual File System (VFS) Layer
VFS provides a common interface for various file systems.
Functions:
Abstracts file system operations.
Allows coexistence of multiple file systems (e.g., ext4, NTFS).
Provides uniform system calls like open(), read(), write().
Manages file metadata and inode operations.
9 a) Explain Segmentation with Paging
Segmentation divides memory into logical segments (code, data, stack). Paging divides each segment
into fixed-size pages.
Benefits:
Combines benefits of segmentation and paging.
Reduces fragmentation.
Provides logical memory management.
Used in Intel x86 architecture.
9 b) Explain Page Replacement Algorithm
Used when a page needs to be swapped out of memory.
Common Algorithms:
FIFO – Oldest page is replaced.
LRU (Least Recently Used) – Page not used for longest time.
Optimal – Replace page not needed for longest future time.
Clock (Second-Chance) – Improved FIFO using a reference bit.
Goal: Minimize page faults.
10 a) Explain File System Structure
File system manages how data is stored and retrieved.
Layers:
1. Application Layer – User interaction.
2. Logical File System – Metadata, directory management.
3. File Organization Module – File and block allocation.
4. Basic File System – Handles requests to block I/O.
5. I/O Control Layer – Drivers and device I/O.
10 b) Explain Forms of File Allocation Methods
File allocation manages how files are stored on disk blocks.
Methods:
1. Contiguous Allocation – Blocks stored sequentially. Fast, but causes fragmentation.
2. Linked Allocation – Each block links to the next. No fragmentation, but slow access.
3. Indexed Allocation – Uses index block to store pointers. Random access possible.
11 a) What is Free-Space Management?
Tracks which disk blocks are free and available for new files.
Techniques:
Bitmaps – 1 for used, 0 for free.
Linked list– Free blocks linked together.
Grouping – Stores addresses of free blocks in groups.
Counting – Tracks block number and count of free blocks.
11 b) Explain File Access Methods
Access methods define how data in files is accessed.
Types:
1. Sequential Access – Data is read/written in order.
2. Direct Access – Data is accessed using block numbers.
3. Indexed Access – Uses an index for random access.