OS CIAT 2 Ans Key
OS CIAT 2 Ans Key
Deadlock detection involves identifying when a system is in a deadlock state. In the case
of processes and resources, we often detect deadlocks by constructing a resource
allocation graph (RAG) or utilizing wait-for graphs.
(i) With a neat sketch, explain how logical address is translated into physical
address using paging mechanism.
Paging Mechanism: Translation of Logical Address to Physical Address
Architecture: (5 Marks)
13 a.
Components Involved:
❌ No (3 reused, just
6 3 2453
reordered)
7 4 2534 ❌ No
12 7 1687 ❌ No
13 8 1678 ❌ No
15 7 6897 ❌ No
16 8 6978 ❌ No
17 9 6789 ❌ No
20 4 8954 ❌ No
21 5 8945 ❌ No
15 a. 1. Host Machine
2. Hypervisor (Virtual Machine Monitor - VMM)
3. Guest Machine (Virtual Machine - VM)
4. Virtual Hardware
5. Virtual Machine Manager / Orchestration Tools
6. Storage Virtualization
7. Network Virtualization
8. Snapshot and Cloning
b . Analyze
(i) Mobile OS
Primary Market Share
OS Developer Core Kernel
Language (2024 est.)
Google (Open Java, Kotlin, C+
Android Linux ~70-75%
Source) +
Darwin (BSD + Objective-C,
iOS Apple ~25-30%
Mach) Swift
Hybrid (LiteOS <2% (regional
HarmonyOS Huawei C/C++, Java
+ AOSP) use)
KaiOS HTML5, <1% (feature
KaiOS Linux
Technologies JavaScript phones)
(ii) Desktop OS
OS Developer Kernel Type Common Use Case
General-purpose,
Windows Microsoft Hybrid
gaming, enterprise
Creative work,
macOS Apple Hybrid (XNU) Apple ecosystem
users
(iii) Multi-user OS
OS Description Use Case
Process P0:
Need = Max - Allocation = (0, 0, 1, 2) - (0, 0, 1, 2) = (0, 0, 0, 0)
Process P1:
(1, 7, 5, 0) - (1, 0, 0, 0) = (0, 7, 5, 0)
Process P2:
(2, 3, 5, 6) - (1, 3, 5, 4) = (1, 0, 0, 2)
Process P3:
(0, 6, 5, 2) - (0, 6, 3, 2) = (0, 0, 2, 0)
Process P4:
(0, 6, 5, 6) - (0, 0, 1, 4) = (0, 6, 4, 2)
Need Matrix
Process A B C D
P0 0 0 0 0
P1 0 7 5 0
P2 1 0 0 2
P3 0 0 2 0
P4 0 6 4 2
(ii) Is the system in a safe state?
The system is in a safe state.
(iii) If a request from thread T₁ arrives for (0,4,2,0), can the request be granted
immediately?
The request (0,4,2,0) cannot be granted immediately because it would lead to an unsafe
state.
OR
b. Suppose that the disk drive has 5000 cylinders number 0 to 4999. The drive is serving a
request at cylinder 145. The queue of pending request in FIFO order is 86, 1470, 913,
1774, 948, 1509, 1022, 1750, 130 starting from the head position, what is the total
distance (cylinder) that the disk arm moves to satisfy all the pending request for each of
the disk scheduling algorithms. FCFS, SSTF, SCAN, CSCAN, LOOK, CLOOK.
Explain the pros and cons of all the disk scheduling algorithm.
FCFS (First Come First Serve)
Sequence:
Start at 145 → 86 → 1470 → 913 → 1774 → 948 → 1509 → 1022 → 1750 → 130
Head Movements:
145 → 86 = 59
86 → 1470 = 1384
1470 → 913 = 557
913 → 1774 = 861
1774 → 948 = 826
948 → 1509 = 561
1509 → 1022 = 487
1022 → 1750 = 728
1750 → 130 = 1620
Total = 59 + 1384 + 557 + 861 + 826 + 561 + 487 + 728 + 1620 = 7083 cylinders.
SSTF (Shortest Seek Time First)
Always go to the closest request from the current position.
Start at 145
Queue: [86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130]
Steps:
From 145 → 130 (15)
From 130 → 86 (44)
From 86 → 913 (827)
From 913 → 948 (35)
From 948 → 1022 (74)
From 1022 → 1470 (448)
From 1470 → 1509 (39)
From 1509 → 1750 (241)
From 1750 → 1774 (24)
Total = 15 + 44 + 827 + 35 + 74 + 448 + 39 + 241 + 24 = 1747 cylinders
SCAN
Moves in one direction (e.g., toward 0), servicing requests, then reverses at the end.
Assume initial direction is toward 0
Sorted queue: [86, 130, 913, 948, 1022, 1470, 1509, 1750, 1774]
Split:
Left of 145: [130, 86]
Right of 145: [913, 948, 1022, 1470, 1509, 1750, 1774]
Sequence: 145 → 130 → 86 → 0 (end) → 913 → ... → 1774
Movements:
145 → 130 = 15
130 → 86 = 44
86 → 0 = 86
0 → 913 = 913
913 → 948 = 35
948 → 1022 = 74
1022 → 1470 = 448
1470 → 1509 = 39
1509 → 1750 = 241
1750 → 1774 = 24
Total = 15 + 44 + 86 + 913 + 35 + 74 + 448 + 39 + 241 + 24 = 1919 cylinders
C-SCAN (Circular SCAN)
Like SCAN but after reaching end, jumps to beginning without servicing during the
return.
Direction: Toward 0
Sequence:
145 → 130 → 86 → 0 → jump to 4999 → 913 → ... → 1774
Movements:
145 → 130 = 15
130 → 86 = 44
86 → 0 = 86
Jump from 0 → 4999 = 4999
4999 → 913 = 4086
913 → 948 = 35
948 → 1022 = 74
1022 → 1470 = 448
1470 → 1509 = 39
1509 → 1750 = 241
1750 → 1774 = 24
Total = 15 + 44 + 86 + 4999 + 4086 + 35 + 74 + 448 + 39 + 241 + 24 = 11,091
cylinders
LOOK
Like SCAN but only goes as far as the last request in the direction before reversing (not
to 0 or 4999).
Sorted Requests:
[86, 130, 913, 948, 1022, 1470, 1509, 1750, 1774]
Start at 145, direction toward 0 → 130 → 86
Then reverse: 913 → ... → 1774
Movements:
145 → 130 = 15
130 → 86 = 44
86 → 913 = 827
913 → 948 = 35
948 → 1022 = 74
1022 → 1470 = 448
1470 → 1509 = 39
1509 → 1750 = 241
1750 → 1774 = 24
Total = 15 + 44 + 827 + 35 + 74 + 448 + 39 + 241 + 24 = 1747 cylinders
C-LOOK
Like C-SCAN, but only jumps to lowest request after servicing highest one (no full
jump to 4999).
Sequence:
145 → 130 → 86 → jump to 913 → ... → 1774
Movements:
145 → 130 = 15
130 → 86 = 44
Jump from 86 → 913 = 827
913 → 948 = 35
948 → 1022 = 74
1022 → 1470 = 448
1470 → 1509 = 39
1509 → 1750 = 241
1750 → 1774 = 24
Total = 15 + 44 + 827 + 35 + 74 + 448 + 39 + 241 + 24 = 1747 cylinders
COURSE FACULTY HOD