You are on page 1of 2

Roll.

# _______________ Section A Name _________________________

Department: Telecommunication Engineering Program: B.S (MCS)


Assignment 3
CE-231 Operating System I

Announced date: 04/01/2022 Due Date: 12/01/2022 Total Marks = 2


Marks Obtained =
Teacher Name: Ayesha Rafique

Sr. No Course Learning Outcomes PLOs Blooms


Taxonomy

CLO_ PLO_4 C6
Integrate the knowledge in applying system software
3 Investigation ( Creating )
and tools available in modern operating systems.

Q#1
(a) Suppose there are n =10 passenger threads and a car thread. The passengers repeatedly wait
to take rides in the car, which can hold C=3 passengers, where C < n. The car can go around
the tracks only when it is full. Here are some additional details:
(i) Passengers should invoke board and un board.
(ii) The car should invoke load, run and unload.
(iii) Passengers cannot board until the car has invoked load
(iv) The car cannot depart until C passengers have boarded.
(v) Passengers cannot un board until the car has invoked unload.
Synchronize the processes. Write the code using Semaphore and illustrate how your solution can
provide synchronization correctly.
Q#1(b) The program follows to use a shared binary semaphore T.
Process A
int Y;
A1: Y = X*2;
A2: X = Y;
signal(T);
Process B
int Z;
B1: wait(T);
B2: Z = X+1;
X = Z;
T is set to 0 before either process begins execution and, as before, X is set to 5.
Now, how many different values of X are possible after both processes finish executing?

Q3: Examine six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250
KB. These partitions need to be allocated to four processes of sizes 357 KB, 210 KB, 468 KB and
491 KB in that order.

Perform the allocation of processes using-

1. First Fit Algorithm


2. Best Fit Algorithm
3. Worst Fit Algorithm

Q4: Calculate the effective access time (in ns) if the TLB hit ratio is 90% and a paging scheme uses
a Translation Lookaside buffer (TLB). A TLB access takes 10 ns and a main memory access takes
50 ns.

Q.5 Detect a deadlock in the system depicted by the following resource allocation graph?

You might also like