Instructions:: Q1. Answer The Following Questions: (Marks 10)
Instructions:: Q1. Answer The Following Questions: (Marks 10)
Spring-2020 CS-Department
Final Examination
22nd June 2020, 9:00 am – 12:30 pm
Instructions:
Start of Exam: 9:00 am; End of Exam: 12:30 pm including submission time
Read each question completely before answering it. There are 11 question and 3 pages.
In case of any ambiguity, you may make assumptions. But your assumption should not
contradict any statement in the question paper.
You will attempt this paper offline, in your hand writing.
You may use cam-scanner, MS lens or any equivalent application to scan and convert your
hand-written answer sheets in a single PDF file.
The paper should be submitted using Google Classroom. You are given 30 minutes for this
purpose, which is already included in the exam time mentioned above. Additionally, after
submitting, you should email it to your instructor which should be exactly same pdf as
uploaded earlier.
WRITE YOUR ID ON TOP OF EVERY PAGE by your hand. Write also page # on every
page. You should also sign on every page.
Q2. Draw block diagram using fork( ) and exec ( ) for the following concatenated commands.
ps | sort | less [Marks=5]
Q3. A single-lane bridge connects the two Vermont villages of North Tunbridge and South
Tunbridge. Farmers in the two villages use this bridge to deliver their produce to the neighboring
town. The bridge can become deadlocked if a northbound and a southbound farmer get on the bridge
at the same time. (Vermont farmers are stubborn and are unable to back up.) Using semaphores and/or
mutex locks, design an algorithm in pseudo code that prevents deadlock. Initially, do not be concerned
about starvation (the situation in which northbound farmers prevent southbound farmers from using
the bridge or vice versa). [Marks=5]
Q4. Consider the following set of processes, with the length of the CPU burst given in milliseconds:
Draw Gantt charts that illustrate the execution of these processes. Calculate average turnaround
time, and average waiting time using the following scheduling algorithms: [Marks=15]
1 OF 3
I) Preemptive Priority (Consider the lowest integer as a high priority).
II) Round Robin (quantum = 3).
III) Shortest Remaining Time First
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
How many page faults and page hits would occur for the following replacement algorithms, assuming
three frames? Remember that all frames are initially empty, so your first unique pages will cost one
fault each.
a) LRU replacement
b) Optimal replacement
c) Second Chance
Q6. Assuming a 4-KB page size, what are the page numbers and offsets for the following address
references (provided as decimal numbers): [Marks=5]
a. 3085
b. 42095
c. 215201
d. 650000
e. 2000001
Q7. Consider a computer system with a 32-bit logical address and 4-KB page size. The system
supports up to 512 MB of physical memory. How many entries are there in each of the following?
[Marks=5]
Q8. A 1MB block of memory is allocated to using buddy system: [Marks=5]
a) Show the binary tree representation
b) Show the how buddy system satisfy the following request: R1 = 70KB, R2 = 35KB,
R3= 80KB, R4=60KB.
Q9. Assume a memory access takes 40 ns, and the machine provides a Translation Lookaside Buffer
(TLB) with a hit rate of 90% and a search time of 10 ns. What is the effective memory access time?
[Marks=5]
Deadlock
2 OF 3
a) Calculate the need matrix
b) Show the safe sequence of processes. In addition to the sequence show the Available (Work
Array) changes as each process terminates.
Q11. Dining Philosopher problem states that there are 5 philosophers and 5 chopsticks. Using
resource allocation graph, show how a deadlock occurs? [Marks=5]
--------------Best of Luck----------------
3 OF 3