OS QuestionBank Answers
OS QuestionBank Answers
(Detailed Answers)
1. Describe the content of Process Control Block (PCB)?
A Process Control Block (PCB) is a data structure used by the operating system to store all
information about a process.
Contents include:
- Process ID
- Process State (new, ready, running, waiting, terminated)
- Program Counter
- CPU Registers
- Memory Management Info (base & limit registers)
- Accounting Information (CPU usage, time limits)
- I/O Status Info (list of I/O devices allocated).
Diagram:
P1 → R1 → P2 → R2 → P1 (cycle)
4. What is system call with neat diagram? Explain any two system call.
System calls provide the interface between a process and the OS. Types include:
1. **Process Control**: fork(), exit()
2. **File Management**: open(), read(), write()
3. **Device Management**: ioctl(), read(), write()
4. **Information Maintenance**: getpid(), alarm()
5. **Communication**: pipe(), shmget()
Diagram:
User Mode → Trap → Kernel Mode → System Call → Return to User
Includes saving:
- Program counter
- Registers
- Stack pointer
**Mutual Exclusion**: A technique to prevent race conditions by ensuring only one process
accesses a critical section at a time. Achieved via semaphores, mutexes, monitors etc.
7. State and explain Multithreading models with neat diagram?
Multithreading allows multiple threads in a process to execute concurrently.
**Models:**
1. **Many-to-One**: Many user-level threads mapped to one kernel thread. Efficient but no
true concurrency.
2. **One-to-One**: Each user thread maps to a kernel thread. More concurrency but heavier.
3. **Many-to-Many**: Many user threads mapped to many kernel threads. Good balance.
Diagram:
```
User Threads → Kernel Threads
[1→1], [M→1], [M→M]
```
Example Queues:
- System Processes (Highest priority)
- Interactive Processes
- Batch Processes
CPU is assigned to highest priority queue. Lower queues only run when higher are empty.
Characteristics:
- Multiple queues with different priorities and algorithms.
- Aging and feedback move processes.
- High priority short jobs are finished fast.