OS CT Sol
OS CT Sol
:03SK_CDEFGHIJKL_221024
Operating System
COMPUTER SCIENCE & IT
Date of Test : 22/10/2024
ANSWER KEY h
D E TA I L E D E X P L A N AT I O N S
1. (b)
1. Using First Fit:
500
2. (d)
Suppose, page size = P Bytes
Process overhead = Page table overhead + Overhead due to internal fragmentation
Page table overhead = Number of pages per process × Page table entry size
Process size 32 MB
= × 4B = × 4B
Page size PB
0+P P
Average overhead due to internal fragmentation = =
2 2
0 = Minimal internal fragmentation
P = Maximum internal fragmentation
32 M × 4 P
Overhead is paging = +
P 2
To minimize overhead i.e. take differentiation with respect to ‘P’.
−128 M 1
+ = 0
P2 2
P2 = 2 × 128 MB
P = 256 MB
P = 16 KB
3. (a)
Size of virtual addresses = 48 bits
Page size = 8 KB
Page offset = 213 = 13 bits
© Copyright : www.madeeasy.in
10 Computer Science & IT
4. (b)
Option (a) and (c) do not satisfy progress condition since (a), (c) leads to deadlock.
Option (b) is correct to satisfy progress condition.
5. (d)
Considering each option of List-I:
• Mutual exclusion can be solved by spooling everything.
• Hold and wait can be solved by requesting all the resources before hand.
• No preemption can be solved by taking request away or by releasing all resources.
• Circular wait can be solved by numbering the resources in some order.
6. (b)
Gantt chart:
P1 P2 P3 P2 P4 P1
0 2 4 5 7 11 16
P4 5 4 11 – 9 = 2
Average = 3
7. (c)
Initial value of semaphore = x
3rd step: 22 V operations = x + 22
2nd step: 12 P operations = x + 22 – 12 = x + 10
1st step: 3 V operations = x + 10 + 3 = x + 13
As per question, x + 13 = 20
⇒ x = 7
8. (a)
S1 : If the time quantum of the Round-Robin scheduling algorithm is larger than the longest CPU
burst time of processes. Then, it will works as FCFS only. Hence, this is not always correct
that RR give better performance compared to FCFS. S1 incorrect
S2 : An advantage of system call to provide the interface between program and operating system.
www.madeeasy.in © Copyright :
CS • Operating System 11
9. (c)
The exec( ) system call replaces the current process image with a new process image. It loads the
program into the current process space and runs it from the entry point.
Kill( )
In Unix and Unix-like operating systems, kill is a command used to send a signal to a process. By
default, the message sent is the termination signal, which requests that the process exit. But kill is
something of a misnomer; the signal sent may have nothing to do with process killing.
10. (a)
• S1 is correct, if the file is very-very large indexed allocation will fail to accommodate then we
will use unix inode.
• S2 is false because metadata does not include the actual data or contents of files, it only
includes the file system structure.
11. (b)
Effective Memory Access Time = (1 – P) × Memory Access Time + P(Non modified% × Page fault
service time + Modified% × Page fault service time with page modified)
= 0.80 × 120 nsec + 0.20 (0.15 × 800 nsec + 0.85 × 950 nsec)
= 96 nsec + 0.20 (120 nsec + 807.5)
= 96 nsec + 185.5 nsec
= 281.5 nsec
12. (c)
• In given solution, atleast one process will enter into critical section i.e. process which arrive
late enter first. So, not deadlock.
• Only one process can enter into critical section at any time because of checking of turn variable
in while loop.
13. (c)
Gantt chart:
P1 P2 P3 P1 P2 P1 P4 P5 P1 P4 P5 P1 P5 P1 P5
P4 80 20 55
P5 85 50 105
Average = 87 msec
© Copyright : www.madeeasy.in
12 Computer Science & IT
14. (a)
Cylinder number : 5, 17, 60, 125, 28, 170, 8, 32
In SCAN algorithm disk head move till the last cylinder with servicing the requests then change
the direction move till inner most cylinder with servicing requests.
0 199
35
60
125
170
199
28 32
5 8 17
Total moves = (199 – 35) + (199 – 5) = 358
15. (b)
Using LRU:
9 8 7 9 3 0 2 9 8 3 9 2 0 9
0 0 0 0 0 0 0 0 0
3 3 3 3 3 3 3 3 3 3
7 7 7 7 7 7 8 8 8 8 8 8
8 8 8 8 8 2 2 2 2 2 2 2 2
9 9 9 9 9 9 9 9 9 9 9 9 9 9
F F F F F F F
= 7 faults
By using FIFO:
9 8 7 9 3 0 2 9 8 3 9 2 0 9
0 0 0 0 0 0 0 0 0
3 3 3 3 3 3 3 3 3 3
7 7 7 7 7 7 8 8 8 8 8 8
8 8 8 8 8 8 9 9 9 9 9 9 9
9 9 9 9 9 9 2 2 2 2 2 2 2 2
F F F F F F F F
= 8 faults
16. (d)
R1 R2 R3 R1 R2 R3
P1 1 0 1 0 0 1
P2 1 0 0 0 1 1
P3 0 1 1 0 1 0
P4 0 0 0 0 1 1
R1 R2 R3
Available = (0 1 0)
P3 need = (0, 1, 0) so P3 can execute, after that available resources (0, 2, 1).
Now, anyone of P1 or P2 or P4 can execute.
www.madeeasy.in © Copyright :
CS • Operating System 13
17. (d)
S1 = 4, S2 = 3, S3 = 2, S4 = 1
Suppose P1 first enters critical section.
P(S1);
P(S2);
P(S3);
P(S4);
C.S. P1 C.S.
18. (a)
When both process P0 and P1 executing concurrently P0 and P1 make turn_0 = true and turn_1 =
true respectively process P0 execute while loop before executing turn_0 = false it preempted and
P1 start executing it make turn_1 = false and preempted. P0 make turn_0 = false, both process
enter into critical section.
Therefore it does not ensure mutual exclusion.
19. (a)
• Some system calls are blocking, while some are non-blocking. When a process makes a blocking
system call, the process cannot proceed further immediately, as the result from the system
call will take a little while to be ready.
• Context switching happens from the Kernel mode of one process to the Kernel mode of another:
the scheduler never switches from the user mode of one process to the user mode of another.
A process in user mode must first save the user context, shift to Kernel mode, save the Kernel
context, and switch to the Kernel context of another process.
20. (b)
P2 P1 P3 P4 P0
0 1 5 8 10 15 21
10 + 3 + 0 + 2 + 2 17
= = = 3.4 ms
5 5
21. (b)
There are these fork calls. So, 2n – 1 child process will be created i.e. 7.
And we have to include parent process also, so total 8 processes are there.
© Copyright : www.madeeasy.in
14 Computer Science & IT
22. (d)
23. (d)
The purpose of dynamic loading is optimal utilization of memory.
Option (a) all routine are kept on disk in a relocatable load format.
Option (b) is property of static loading
24. (d)
(a) The CPU utilization increases as the degree of multiprogramming increase up to threshold
(some limit), after that utilization start decreasing.
(b) Test and set is a special hardware instruction that does two operations atomically but does
not to avoid busy wait.
(c) User level threads are faster to switch among them than kernel level thread since user level
thread have less context.
25. (b)
Page size = 1 KB = 210 bytes
Virtual address space = 4 GB = 232 bytes
32
22 10
offset
26. (d)
Round Robin with quantum 6
P1 P1 P3 P2 P3 P4 P2 P4 P2
0 6 10 12 18 24 26 32 38 41 44
P1 P1 P3 P2 P3 P4 P2 P4 P2
2 18 44 26
3 12 26 14
4 20 41 21
71
Average = = 17.75
4
www.madeeasy.in © Copyright :
CS • Operating System 15
SJF
P1 P3 P4 P2
0 10 12 20 29 44
2 18 44 26
3 12 20 8
4 20 29 9
53
Average = = 13.25
4
SRTF
P1 P3 P4 P2
0 10 12 20 29 44
2 18 44 26
3 12 20 8
4 20 29 9
53
Average = = 13.25
4
27. (d)
• Since 430 < 600, So , Physical address: 219 + 430 = 649
• Since 10 < 14 , So, Physical address: 2300 + 10 = 2310
• Since 500 >100, So, illegal reference and traps to operating system.
• Since 400 < 580 , So, Physical address: 1327 + 400 = 1727
• Since 112 > 96, So, illegal reference and traps to operating system
28. (d)
Disk size = 40 GB
Block size = 1 KB
40 × 2 30
Number of blocks =
8 × 2 10
= 5 MB
© Copyright : www.madeeasy.in
16 Computer Science & IT
29. (b)
CSCAN: 5
5
16
9
60
4
199
30
25
30
Total distance traversed by R/W head = (105 – 100) + (110 – 105) + (126 – 110) + (135 – 126) + (195
– 135) + (199 – 195) + (199 – 0) + (30 – 0) + (55 – 30) + (85 – 55)
= 5 + 5 + 16 + 9 + 60 + 4 + 199 + 30 + 25 + 30
= 383
30. (b)
Initially, there is compulsory miss from page number 1 to 30, at 31 there is miss page and page 1
is replaced and so on. Total 80 page fault.
On second access of 80 there is hit from 80 to 51. After 50 to 1 there are total 50 page faults.
Total page fault = 80 + 50 = 130
www.madeeasy.in © Copyright :