0% found this document useful (0 votes)
70 views4 pages

Operating Systems Test 3: Number of Questions: 25 Section Marks: 30

This document contains a 25 question multiple choice test on operating system concepts like scheduling algorithms, processes, threads, deadlocks, and more. The questions assess understanding of key terms, analyzing examples to identify scheduling techniques used, calculating metrics like waiting times, and identifying conditions that could lead to deadlocks. The test contains both conceptual questions and those involving analyzing provided data in tables or graphs.

Uploaded by

AKASH PAL
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)
70 views4 pages

Operating Systems Test 3: Number of Questions: 25 Section Marks: 30

This document contains a 25 question multiple choice test on operating system concepts like scheduling algorithms, processes, threads, deadlocks, and more. The questions assess understanding of key terms, analyzing examples to identify scheduling techniques used, calculating metrics like waiting times, and identifying conditions that could lead to deadlocks. The test contains both conceptual questions and those involving analyzing provided data in tables or graphs.

Uploaded by

AKASH PAL
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/ 4

Operating Systems Test 3

Number of Questions: 25 Section Marks: 30

Directions for questions 1 to 25: Select the correct alterna- (A) 15 (B) 13
tive from the given choices. (C) 8 (D) 3
1. Round Robin scheduling with large time slice behaves 6. As the time quantum increases for Round Robin sched-
as: uling, generally the average waiting time:
(A) FCFS (A) Increases
(B) Priority based scheduling (B) Decreases
(C) Multi-level queue scheduling (C) Unchanged
(D) Preemptive SJF (D) Cannot be determined
2. Priority inversion means: 7. Consider three processes P0, P1, P2 arrived at Time 0,
(A) Shortest Job waits for longest job with the burst times x, y, z respectively. x < z < y. What
(B) High priority process waits for low priority pro- is the average waiting, if SJF is used for scheduling?
cess x+y+z x+z
(A) (B)
(C) Longest job waits for shortest job 2 3
(D) both (A) and (C). 2x + z x+z+y
(C) (D)
3. Consider the following table with 4 processes: 3 3

Process Arrived Time Burst Time


8. Consider the following table:
P1 0 5 Process Arrival Time Burst Time
P2 1 4 P0 0 8
P3 2 2 P1 1 4
P4 3 3 P2 2 2

If Longest Remaining Time scheduling (Preemptive What is average waiting time of processes which have
longest Job First) is used, then the average turnaround taken more than one slot for completion, When SRTF
time is _____. is used for scheduling?
(A) 11 (B) 12 (A) 2.66 (B) 3.0
(C) 13 (D) 14 (C) 4.0 (D) 3.33
4. Consider the following table: 9. Match the following:
List 1 List 2
Process Arrival Time Burst Time
(a) Ready → Running 1. Dispatching
P0 0 4
(b) Running → Waiting 2. Preemption
P1 1 3
(c) Waiting → Ready 3 Completion
P2 1 3
(d) Running → Terminate 4. I/O Request
P3 2 5
(e) Running → Ready 5 Event occurred
If Longest Job First scheduling is used then the average
waiting time is _____. a b c d e
(A) 5.00 (B) 5.25 (A) 1 2 3 4 5
(C) 5.50 (D) 5.75 (B) 1 4 5 3 2
(C) 1 4 2 3 5
5. Consider the following table: (D) 1 2 5 4 3
Process Arrival Time Turn around Time 10. Consider the following:
P0 0 15
Process Arrival Time Burst Time
P1 0 2
A 0 4
P2 0 18
B 1 6
P3 0 20
C 5 3
P4 0 7
D 7 2
If priority scheduling is used for scheduling, what is the What is the waiting time of process D, if FIFO schedul-
burst time of process Po? ing is used?
Operating Systems Test 3 | 3.179

(A) 3 (B) 2 (A) 7 (B) 16


(C) 6 (D) 12 (C) 19 (D) 15
11. Preemptive scheduling takes place when _____. 17. Which of the following system state may lead to dead-
(I) process switches from Running to Ready lock? Let the system contains ‘r’ instances of resources
(II) process switches from Waiting to Ready with ‘n’ processes.
(III) process switches from Running to waiting (Resource requests of each process represented in sets)
(IV) process terminates (A) n = 5, r = 20, {5, 5, 5, 5, 5}
(A) I, II (B) I, II, IV (B) n = 5, r = 20, {5, 5, 4, 5, 5}
(C) I, II, III (D) I, II, III and IV (C) n = 6, r = 26, {6, 6, 4, 3, 3, 2}
12. Blocking and Non-blocking message passing is also (D) n = 6, r = 26, {6, 6, 4, 3, 3, 3}
known as: 18. Consider the following Resource allocation Graph:
(A) Synchronous and Asynchronous
R1 P5
(B) Direct and Indirect
(C) Limited Buffer and Zero buffer R2
(D) Pipes and FIFO R3

13. Number of child processes created for the following P1


P2
code segment is _____. P4
fork();
fork(); R4 P3 R5
fork();
fork();
Which of the following cycle exist in it’s equivalent
(A) 4 (B) 8
wait-for-Graph?
(C) 15 (D) 16
(A) P1 → P2 → P3 → P4 → P5 → P1
14. Which of the following statements are TRUE about (B) P1 → P2 → P3 → P5 → P1
threads? (C) P1 → P3 → P4 → P5 → P1
I. Thread library provides support to both user and (D) P2 → P3 → P4 → P5 → P1 → P2
kernel level threads.
19. Consider the following Resource allocation graph:
II. Threads improves the Responsiveness and Re-
source sharing. R1 R2
III. Kernel level thread switching is faster than user
level switching.
IV. User level thread maintenance is faster than kernel P2 P3
level threads. P1
(A) I and III (B) II and IV
(C) II and III (D) I, II and III
15. Match the following:
List 1 List 2 R4 R5

P. Starvation 1. FCFS P4
Q. Ageing 2. Round Robin
R. Context switching 3. Preemptive Priority
Which of the following dead lock cycle occurs in the
overhead
given graph?
(A) P2 → P3 → P2 (B) P2 → P1 → P4 → P2
S. Batch processing 4. Highest Response Ratio next
(C) Both (A) and (B) (D) None of the above
P Q R S 20. A counting semaphore has a value—a at a certain time,
(A) 1 4 2 3 it represents:
(B) 4 1 3 2 (A) ‘a’ number of processes waiting
(C) 3 4 2 1 (B) ‘a’ number of process in critical section
(D) 1 4 3 2 (C) Either (A) or (B)
16. Consider a system with four processes A, B, C and D (D) None, negative values are not allowed on Count-
and ‘m’ instances of resource ‘r’. The resource require- ing semaphore
ments are 5, 7, 3 and 4 instances of resource ‘r’ respec- 21. Semaphores _____.
tively. What is the minimum value of ‘m’, hence system (A) are process synchronization tools to avoid dead-
is dead lock free? lock.
3.180 | Operating Systems Test 3

(B) are process synchronization tools to avoid race Consider the following code segments:
condition. I. wait (s1); wait (s2);
(C) uses Test And Set for synchronization. II. wait (s2); wait (s1);
(D) All the above III. signal (s1); signal (s2);
22. The system is running with 5 processes. Consider the IV. signal (s2); signal (s1);
following code segments for synchronization: Which of the following may lead to deadlock?
process 1: X Y W Z
while(1) (A) I III II IV
{ (B) I III I III
signal (mutex);
(C) II IV II IV
<Critical Section; >
(D) I III I IV
signal (mutex);
} 24. Consider the following snapshot of a system:
Process i where i = 2,3,4,5.
Max Allocation
while (1)
{ Process R1 R2 R3 R1 R2 R3
wait (mutex); a 3 2 4 1 1 1
< Critical Section > b 5 5 2 2 3 2
signal (mutex); c 4 4 3 3 1 1
} d 3 4 4 1 0 1
‘mutex’ is a binary semaphore.
Atmost how many processes can enter into the critical Available = {5, 3, 2}
section? Which of the following is not a safe sequence?
(A) 1 (B) 2 (A) a b c d (B) b c d a
(C) 3 (D) 5 (C) b a c d (D) c a d b
23. Let P0 and P1 are two processes, each accesses two 25. In the above system, if process ‘A’ requests for {0, 1, 2}
binary semaphores s1 and s2 to enter critical section. resources and if the request is granted, then the system
s1 and s2 are initialized to 1. state is _____.
P0: P1: (A) safe state
X; W; (B) unsafe state
<critical section> <critical section> (C) deadlock
Y; Z; (D) either (B) or (C)

Answer Keys
1. A 2. B 3. A 4. B 5. C 6. A 7. C 8. C 9. B 10. C
11. D 12. A 13. C 14. B 15. C 16. B 17. A 18. C 19. D 20. A
21. B 22. D 23. A 24. A 25. A

Hints and Explanations


1. Choice (A) 11 + 11 + 11 + 11
Average TAT = = 11 Choice (A)
2. Choice (B) 4
3. 4.
P1 P1 P2 P1 P2 P4 P1 P2 P3 P4 P1 P2 P3 P4 0 4 9 12 15
P0 P3 P1 P2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Process AT CT TAT Process AT BT CT TAT WT


P1 0 11 11 P0 0 4 4 4 0
P2 1 12 11 P1 1 3 12 11 8
P3 2 13 11 P2 1 3 15 14 11
P4 3 14 11 P3 2 5 9 7 2
Operating Systems Test 3 | 3.181

(0 + 8 + 11 + 2) 21 This system state result in deadlock i.e., the system


Average WT = = = 5.25 with ≤15 resources may lead to deadlock.
4 4
Choice (B) If atleast one extra resource available in this state, the
5. Gantt Chart: system becomes deadlock free.
0 2 7 15 18 20 ∴ 16 resources required.
P1 P4 P0 P2 P3 Method 2:
n
∑ Si < ( m + n)
i =1
Waiting Time of P0 is 7. Si – resources required for process ‘i’.
BT = TAT – WT = 15 – 7 = 8 Choice (C) m – number of resources in system
6. Choice (A) n – number of process in system.
7. Choice (C) (5 + 7 + 3 + 4) < m + 4 ⇒ m = 16 Choice (B)
8. 17. Use this formula to check deadlock state.
n
0 1 2 4 7 14
P0 P1 P2 P1 P0 ∑ Si < ( m + n)
i =1

Si – Resources required for process ‘i’.


m – Number of resources
Process AT TAT WT n – Number of process Choice (A)
P0 0 14 6 18. The wait-for-graph for given resource allocation graph
P1 1 6 2 is shown below:
P2 2 2 0
P5
Processes P0 and P1 executed in multiple slots.
P2
6+2
Hence average waiting time of (P0 and P1) = =4
2 P1 P3 P4
Choice (C)
9. Choice (B) Choice (C)
10. Processes ‘D’ schedules at time 13. 19. No dead lock exists in given graph. Choice (D)
Waiting Time = 13 – 7 (AT) = 6 Choice (C) 20. Choice (A)
11. Choice (D)
21. Choice (B)
12. Choice (A)
22. Assume that process 2 entered critical section that
13. Choice (C) results in wait of process 3, 4 and 5. But process 1 can
14. Choice (B) enter. Then one more process can enter C.S. If process
1 leaves C.S., then again one more process can enter
15. Choice (C)
C.S. Similarly if process 1 enters and exits the C.S.
16. Method 1: again, 2 more processes can enter C.S. Choice (D)
Each process requirement is Si for process ‘i’.
23. Semaphores may be signalled in any order. But sema-
i – A B C D
phores must be locked in same order. Choice (A)
Si – 5 7 3 4
Assume for each process i, (Si – 1) resources are al- 24. Need of process ‘A’ is {2, 1, 3}, which is greater than
located. available. Choice (A)
A B C D 25. Process ‘B’ can execute in resultant state, which leads
4 6 2 3 allocated to completion of A, C and D. Choice (A)

You might also like