0% found this document useful (0 votes)
3 views3 pages

os2

The document covers key concepts in operating systems, including multiprogramming, critical sections, page replacement algorithms, and context switching. It also discusses memory management techniques, process synchronization, file system operations, and scheduling algorithms. Additionally, it addresses deadlock conditions, memory allocation techniques, and file access methods.
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)
3 views3 pages

os2

The document covers key concepts in operating systems, including multiprogramming, critical sections, page replacement algorithms, and context switching. It also discusses memory management techniques, process synchronization, file system operations, and scheduling algorithms. Additionally, it addresses deadlock conditions, memory allocation techniques, and file access methods.
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
You are on page 1/ 3

1. What is multiprogramming?

 Multiprogramming allows multiple programs to reside in memory at the same time.


 CPU executes one program while others wait for I/O.
2. Define a critical section.
 A critical section is a part of a program where shared resources are accessed.
 Only one process should execute in its critical section at a time to avoid conflicts.
3. List any two page replacement algorithms.
 FIFO (First-In-First-Out)
 LRU (Least Recently Used)
4. What is context switching in a CPU?
 The process of saving the state of one process and loading the state of another.
 Happens during multitasking and scheduling.
5. Mention two advantages of virtual memory.
 Allows larger programs to run than physical memory can hold.
 Provides memory isolation between processes for protection.
6. What is file protection?
 Mechanism to control access to files.
 Prevents unauthorized reading, writing, or execution.
7. Define deadlock prevention.
 A method to ensure at least one of the necessary conditions for deadlock never occurs.
 Avoids deadlock by design.
8. What is the role of a scheduler?
 Selects which process will run next on the CPU.
 Manages CPU time to optimize performance.
9. Define swapping in memory management.
 Moving a process between main memory and disk.
 Used to manage memory when there is not enough RAM.

10. Process Creation and Termination:


 Process Creation:
1. Parent creates child process using system call (e.g., fork).
2. OS assigns PID and allocates resources.
3. PCB (Process Control Block) created.
4. Process is moved to Ready Queue.
 Process Termination:
1. Process finishes or is terminated.
2. OS deallocates resources.
3. PCB is removed.
4. Exit status sent to parent.

11. Real-Time CPU Scheduling:


 Definition: Ensures processes meet timing constraints.
 Requirements:
1. Predictable response times.
2. Priorities for urgent tasks.
3. Preemption support.
4. Real-time clock access.
 Types: Hard and Soft real-time scheduling.
 Algorithms: Rate Monotonic, EDF (Earliest Deadline First).
12. Segmentation vs Paging:
Aspect Segmentation Paging
Division Based on logical segments Divided into equal-size pages
Size Variable Fixed
Fragmentation External Internal
Address Segment No + Offset Page No + Offset
Example Code, Stack, Data segments Page 0, Page 1, etc.

13. Process Synchronization Techniques:


 Semaphores: Integer variables for signaling.
 Mutex: Locks used to ensure one process enters the critical section.
 Monitors: High-level abstraction with condition variables.
 Busy Waiting vs Blocking: Polling wastes CPU time; blocking is efficient.

14. File System Structure and Operations:


 Structure:
1. File Control Block (FCB)
2. Directory structure
3. Volume Control Block
 File Operations:
o Create, Open, Read, Write, Close, Delete
 File Types: Text, Binary, Executable, etc.

➕ 15. (New Additional Question)


Explain any three memory allocation techniques with examples.
1. Contiguous Allocation:
o Allocates single continuous memory block.
o Example: Base + limit.
2. Paging:
o Memory divided into fixed-size pages and frames.
o Logical and physical addresses mapped.
3. Segmentation:
o Divided based on program's logical parts.
o Example: Stack, Code, Data segments.

15. a) Thread Lifecycle:


1. New: Thread is created.
2. Runnable: Ready to run.
3. Running: CPU assigned.
4. Waiting/Blocked: Waiting for I/O or signal.
5. Terminated: Execution completed.
Diagram:
sql
CopyEdit
New → Runnable → Running → Terminated
↘ Blocked ↗
b) Multithreading Models:
1. Many-to-One: Many user threads to one kernel thread.
2. One-to-One: One user thread maps to one kernel thread.
3. Many-to-Many: Many user threads mapped to a pool of kernel threads.
16. a) FCFS Gantt Chart:
Processes:
P1: 10ms, P2: 1ms, P3: 2ms, P4: 5ms (all arrive at 0)
Gantt Chart:
0---P1---10--P2--11--P3--13---P4---18
Waiting Time: 0, 10, 11, 13 → Avg = 8.5 ms
Turnaround Time: 10, 11, 13, 18 → Avg = 13 ms
b) SJF Scheduling Example:
Processes (Arrival Time = 0):
P1: 6ms, P2: 8ms, P3: 7ms, P4: 3ms
SJF Order: P4 → P1 → P3 → P2
Gantt Chart:
0--P4--3--P1--9--P3--16--P2--24

17. a) Deadlock Conditions:


1. Mutual Exclusion
2. Hold and Wait
3. No Preemption
4. Circular Wait
b) Banker’s Algorithm:
 Checks for safe state before allocating resources.
 Steps:
1. Need = Max – Allocation
2. If Need ≤ Available, then safe.
3. Otherwise, wait.

18. a) Paging with Diagram:


 Logical Address = Page Number + Offset
 Physical Address = Frame Number + Offset
 Uses Page Table for translation
Diagram (Simple):
Logical → Page Table → Frame → Physical
b) Thrashing:
 Too much paging, CPU spends more time swapping.
 Control:
o Increase RAM
o Use Working Set model
o Good page replacement algorithm

19. a) File Access Methods:


 Sequential: Data accessed in order. (e.g., tape)
 Indexed: Index table for direct access. (e.g., DBMS)
b) File Allocation Methods:
1. Contiguous: All blocks in sequence.
2. Linked: Each block has pointer to next.
3. Indexed: Uses index block pointing to all file blocks.

You might also like