Вы находитесь на странице: 1из 5

CPU Scheduling:

1. FCFS: The process that request the CPU first is allocated the CPU first.
Processes P1, P2, P3 arrive at the same time, but enter the job queue in the order presented in the
table.

Average waiting time:

2. FCFS: The process that request the CPU first is allocated the CPU first.
Processes P1, P2, P3 arrive at the same time, but enter the job queue in the order presented in the
table.

Average waiting time:

Compare this example with the previous example, what do you observe?
3. Shortest Job First: When the CPU is available, it is assigned to the process that has the smallest
CPU burst.

Average waiting time:

4. Shortest Remaining Time Next: A preemptive version of the shortest job first algorithm.

Compare this example with the result from the SJF example, what do you observe?
5. Consider a small memory model consisting of 32kB divided into 32 allocation units of 1kB
each. Assume that three processes PA (size 7kB), PB (size 6kB) and PC (size 4kB) are loaded
into memory at addresses 0, 15 and 26 respectively.

(A) Represent the existing memory using a:

i. Bit Map
ii. Linked List

B) Assume process PD (size 4kB) is scheduled for execution. Show the linked list structure created
by the memory manager using:
iii. First Fit
iv. Best Fit
6. Consider the following reference string,

70120304230321201701

list the total number of page faults and fill in the contents of the page frames of memory after each
memory reference using 3 frames. Calculate total number of page faults.

FIFO

LRU

7. Consider the following code:


Thread 1:
1 lock(L1);
2 lock(L2);
3 // critical section requiring L1 and L2 locked.
4 unlock(L2);
5 unlock(L1);

Thread 2:
6 lock(L3);
7 lock(L1);
8 // critical section requiring l3 and l1 locked.
9 unlock(L1);
10 unlock(L3);
Thread 3:
11 lock(L2);
12 lock(L3);
13 // critical section requiring l2 and l3 locked.
14 unlock(L3);
15 unlock(L2);

In the beginning, all three locks are initialized as “not locked”. Also assume the threads
can execute in any arbitrary interleavings.
(a)Will there be any problem with this code? If yes, show an interleaving. If no,
why?

(b)If there is a problem, how do you fix it? (Note, each critical section requires
two different locks, you cannot change this assumption)

8. Given the process/resource statements, draw the model of the system. Is the system deadlocked
and if so which processes and resources are involved?

Process A holds R
Process B holds for T but wants R and S
Process C holds for U but wants R
Process D holds S and wants nothing
Process E holds nothing but wants T and U

Вам также может понравиться