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


In an i-node based file system implementation, the i-node typically stores 12 direct block pointers, one
1-indirect block pointer, one 2-indirect block pointer, and one 3-indirect block pointer. An indirect
block is a disk block storing an array of disk block addresses (i.e. pointers). The pointers in a 1-indirect
block point to disk blocks that store file data. The pointers in a 2-indirect (or 3-indirect) block point to
other 1-indirect (or 2-indirect) blocks. Suppose the file system is configured to use a block size of 210
bytes and each pointer takes up 4-bytes. What is the maximum file size that can be supported in the
file system?
(a) 2 GB (b) 4 GB (c) 8 GB (d) 16 GB

Number of addresses in a block = = 28
 Maximum size of the file
= (12+28+28 *28 +28 *28*28)210
234 16 GB

2. Consider the following resource allocation state involving five processes P0,…, P4, and five resources
R0,…, R4. Total[j] specifies the total number of units of resource Rj (including both allocated and free
units). Alloc[i][j] denotes the number of units of resource Rj currently allocated to process Pi. Req[i][j]
denotes the number of units of resource Rj that process Pi is currently requesting.
Total[] = [11, 10, 6, 9, 6]
Alloc[][] = [ [1, 0, 2, 4, 1], [0, 1, 0, 2, 3], [0, 0, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 1, 2] ]
Req[][] = [ [1, 5, 4, 2, 2], [1, 0, 0, 7, 2], [8, 8, 2, 0, 0], [6, 6, 6, 6, 6], [7, 3, 0, 1, 0] ]
Which processes (if any) are deadlocked?
(a) P0, P1 and P3 only (b) P1 and P3 only
(c) P1 only (d) P3 only

𝑃0 1 0 2 4 1
𝑃1 0 1 0 2 3
𝑃2 0 0 1 0 0
𝑃3 0 1 0 1 0
𝑃4 [1 0 0 1 2]
Request (Need)
𝑃0 1 5 4 2 2
𝑃1 1 0 0 7 2
𝑃2 8 8 2 0 0
𝑃3 6 6 6 6 6
𝑃4 [7 3 0 1 0]
Total [11 10 6 9 6]
Available [9 8 3 1 0]
Now we can satisfy either request of P2 or P4.
Let us suppose we are satisfying request of P2.
Hence now total available resources will be:-
(available) 9 8 3 1 0
+ 0 0 1 0 0
allocation of 9 8 4 1 0
Now total available: - 9 8 4 1 0
Now we can satisfy request of P4
Total available = Allocation of P4 + Total available
Now =
1 0 0 1 2
+9 8 4 1 0
10 8 4 2 2
Now we can satisfy request of P1.
10 8 4 2 2
+1 0 2 4 1
11 8 6 6 3
Now further we cannot satisfy request of any other process.
The remaining processes i.eP1 and P3 will remain blocked.
Answer: B

The following is a solution to the 2-process critical section problem. Assume that initially x
[0] = x [1] = false.
Process P0: Process P1:
While(1){ While(1){
x[0] = true; start: x[1] = true;
while (x[1]) do-nothing; if (x[0]){
<critical section>; x[1] = false;
x[0] = false; while (x[0]) do-nothing;
} goto start;
<critical section>;
x[1] = false;
Consider the following statements.
i. It is possible for both P0 and P1 to access critical section concurrently.
ii. This may lead to a deadlock.
iii. This may lead to a starvation.
Which of the following holds?
(a) (i) is false, (ii) is true and (iii) is true
(b) Both (i) and (ii) are false, (iii) is true
(c) (i) is true (ii) is false, (iii) is false
(d) Both (i) and (ii) are true, (iii) is false
(i) Both process P0 and P1 does not access critical section concurrently.
(ii) This will not lead to deadlock.
(iii)This may lead to starvation as:-
P0 got a chance again.
Answer: B
Consider a system with 128 MB of physical memory, of which the first 8 MB are allocated to the kernel.
The remaining 120 MB memory is allocated to processes in contiguous chunks. The start times,
finishing times, and memory sizes of five processes are given below:
Process Start time Finish time Memory (MB)
P1 10:00 AM 10:05 AM 70
P2 10:02 AM 10:10 AM 30
P3 10:04 AM 10:15 AM 30
P4 10:06 AM 10:20 AM 30
P5 10:08 AM 10:25 AM 25
At what point in time process P5 finish.
(a) 10: 25 AM (b) 10: 30 AM
(c) 10: 33 AM (d) 10: 27 AM

“Process needs contiguous chunks of memory”.
Free Start time
Finish time(will
Process (will start Memory (MB)
finish at)
120- 70=50MB cont P1 10:00 AM 10:05 AM 70
50-30=20MB cont P2 10:02 AM 10:10 AM 30
2 chunks free one of 40
P3 10:05 AM 10:16 AM 30
MB and other of 20MB
2chunks free one of 10
P4 10:06 AM 10:20 AM 30
MB and other of 20 B.
P5 10:08 AM 10:27 AM 25
P5 cannot be allocated memory at 10:08, as there is no continuous chunk available of 25 MB.
At time 10:10 AM P2 will terminate and hence free the space of 30MB.
at this time P5 can be allocated memory space of 25MB.Answer:D

Suppose we are in a segmentation system. A process has five segments, 0 – 4. The size of segment i is
(2(10 + i) + i) bytes. They are allocated in the main memory at megabyte boundary starting from the
second mega. Match the following logical address to its physical address correctly. Assume that all the
segments are store continuously.
Logical address Physical address
I. Segment fault
1. <0, 211>
II. 0x103C03
2. <1, 211>
III. 0x100C00
3. <3, 213>
IV. 0x100800
4. <4, 215>
V. 0x10DC07
1 2 3 4
(c) I III II I
(d) I II III I

(1) <0,211 >  segmentation fault
as size will be of ith segment (2(10 +i) +i) bytes = 210 bytes (i=0)
and the request is of 211 hence segmentation fault. (Size of offset greater than size of segment).
(2) <1,211>:- Size = 211 +1 = 2049 bytes
“Segments are allocated at megabytes. (Staring from 2nd megabyte )
 0th segment base address = 1MB
1st segment base address = 1MB +1024 byte= 1049600
address of <1, 211> = 1049600+2048
= (1051648) = (100C00)16
(3) <3,213> base address of 3rd segment = 1MB +1024 bytes+ 2049 byte +4098 byte = 1055747
Address of <3, 2, 13> = (1055747+18192)
=1063939 = (103c03)16
(d) <4,215> size = 214 +4
Segmentation fault.
(Because size of offset is greater than size of segment).
Answer: C

6. In a file allocation scheme, there are several ways that disk blocks can be allocated to a file. We could
 A linked allocation where the last word of a block is a disk address of another block, and
 An indexed allocation where the first block, called index block, has a set of pointers to the other
blocks for data.
Assume that a disk block is 10 bytes and a word, a disk address, is 1 byte. If you want to access the
50th byte in a file, then what is the numbers of disk accesses are required for linked allocation and for
indexed allocation respectively?
(a) 5, 2 (b) 6, 2 (c) 6, 6 (d) 5, 6

For linked allocation
Disk block size = 10 bytes
Disk address size =1 bytes
Data that can be stored in one block= 9 bytes= (10-1) bytes
 50 byte of data will be stored in ⌈ 9 ⌉ blocks = 6
6 disk access are required for link allocation (Because in linked list allocation, we have to do
sequential access)
For indexed allocation.
One access for index block, one access for data block (for 50th byte)
=2 access.
7. Consider the C program below.
int main()
if (fork() == 0){
if (fork() == 0)
else {
wait(); //wait for the termination of child
else {
if (fork() == 0){
exit(0); }
return 0;
Assume that all processes run to normal completion. Consider the following outputs:
1. 2030401
2. 2300140
3. 3200410
Which of the above is/are the valid outputs of this program?
(a) 1 only (b) 2 and 3 only
(c) 1 and 3 only (d) All the above


After 3, 0 only 4,0.Can be printed as the parent (a) has to wait at line till the child (b) has completed
it’s execution .All the others can be printed in any order.
(1) 2030401Possible
(2) 2300140Possible
(3) 3200410 possible.

Consider the following solution for readers and writers problem.
Shared variables
1. semaphoremutex = 1;
2. semaphorewrt = 1;
3. intreadcount = 0;
/* writer process */ /* reader process */
7. acquire(mutex);
8. readcount = readcount + 1;
9. if (readcount == 1) then acquire(wrt);
4. acquire(wrt);
10. release(mutex);
5. --- writing is performed ---
11. --- reading is performed ---
6. release(wrt);
12. acquire(mutex);
13. readcount = readcount - 1;
14. if (readcount == 0) then release(wrt);
15. release(mutex);
Suppose in reader process if we change the “if condition to ‘readcount == 1’ of statement 14 and swap
with statements 13 i.e.
New 13 Line: if(readcount == 1)then release(wrt);
New 14 Line: readcount = readcount - 1;
Then this code could results in
(A) Deadlock
(B) illegal access (a writer is active at the same time that another writer or reader is active)
(C) A loss of parallelism (readers are not allowed to be active simultaneously)
(D) No problem code is still working correctly

(1) False: - There won’t be deadlock
(2) False as:-There writer and the reader or the write and any other are not active at same time.
(3) False: - Readers are allowed to be active simultaneously.
(4) True: - code is still working correctly.
Answer: D

Three processes arrive at time zero with CPU bursts 10, 20, 30. What is average waiting time per
process if the shortest-remaining time first scheduling algorithm is used?
(a) 20/3 (b) 40/3 (c) 50/3 (d) 60/3


P1= 10
P0+P1+P2= 40
Average waiting time = 3

Which of the following statements about page tables is true?
(a) Multi-level page tables always require more space than single-level page tables.
(b) Multi-level page tables generally have a slower look-up time than single-level page tables.
(c) All page table structures that are not a simple single-level page table have the fundamental
structure of an array of arrays.
(d) Page tables need to be invalidated on a context switch.

(a) False :- Multilevel page tables requires less space than single level page tables.
(b) True:- multilevel page table generally have a slower look-up time than single level page tables.
(c) False:-
(d) False:- Page table does not needs to be invalidated on a context switch.
Answer: B
Three concurrent processes X, Y, and Z execute three different code segments that access and update
certain shared variables. Process X executes the P operation (i.e., wait) on semaphores a, b and c;
process Y executes the P operation on semaphores b, c and d; process Z executes the P operation on
semaphores c, d, and a before entering the respective code segments. After completing the execution
of its code segment, each process invokes the V operation (i.e., signal) on its three semaphores. All
semaphores are binary semaphores initialized to one. Which one of the following represents a
deadlock-free order of invoking the P operations by the processes?
(a) X: P(a)P(b)P(c) Y: P(b)P(c)P(d) Z: P(c)P(d)P(a)
(b) X: P(b)P(a)P(c) Y: P(b)P(c)P(d) Z: P(a)P(c)P(d)
(c) X: P(b)P(a)P(c) Y: P(c)P(b)P(d) Z: P(a)P(c)P(d)
(d) X: P(a)P(b)P(c) Y: P(c)P(b)P(d) Z: P(c)P(d)P(a)

p(a) p(b) p(c)
p(b) p(c) p(d)
p(c) p(d) p(a)
If the order of execution be:-
P(b)Lock b
p(c) Lock c
p(b)cannot move forward
p( c)cannot move forward
p(d) Locked
p( c)
p(a)cannot move
for warded.
Hence deadlock.
(b) There is no possibility of deadlock.
p(b) cannot move forward
p(a) lock(a)
cannot move forward
p(c) p(d) p(d)lock(d)

Now as z gets complete locks can be acquired by either X and Y.

The one which gets lock first will get chance first, will execute and terminate and will give chance to
the other process.
x y z
Lock (b) P(b)
p(c) Lock(c )
p(a) lock(a)
cannot move forward
p(b) cannot proceed p( c) Cannot proceed
further further .
p( c)
hence deadlock.
p(a)lock (a)
locks (c)
p( c)
P( c) not proceed
P(b)  lock (b)
cannot proceed further
p(c) cannot proceed

Hence deadlock. Answer:B

If the number of frames allocated to a process is actually less than this minimum number, and if the
frame allocation is fixed and cannot be increased, what is the worst that could happen when such an
instruction executes?
(a) An infinite loop could occur.
(b) The process will eventually execute to completion, but execution will be severely slowed
(c) The process will eventually execute to completion, and execution will be slowed by just a little.
(d) The page replacement routine within the page-fault service routine will execute more slowly, but
will have almost no effect on the speed of execution of the process.

Thrashing can occur:-
(a) An infinite loop could occur.
Answer: A
An advantage of user-level threads over kernel-level threads is:
(a) The kernel is not involved in thread switching.
(b) Better performance on multiprocessors.
(c) When a thread blocks on a system call other threads in the process can continue to run.
(d) When a thread blocks on a system call other threads in the process cannot continue to run.

An advantage of user level threads over kernel level threads is that the kernel is no involved in thread
Therefore Time for context switching is less, (as if kernel is involved then the time for mode switching
will also add)
more over user can do thread switching as he wants to do.
Answer: A

14. Consider the classical sleeping barber problem. A barbershop consists of a waiting room with s seats
and a barber room with one barber chair. There are c customers and one barber. Customers alternate
between growing hair and getting a haircut. The barber sleeps and cuts hair.
 If there are no customers to be served, the barber sleeps.
 If a customer wants a haircut and all chairs are occupied, then the customer leaves the shop and
skips the haircut.
 If chairs are available but the barber is busy, then the customer waits in one of the available
chairs until the barber is free.
 If the barber is asleep, the customer wakes up the barber.
The following pseudocode shows one implementation of the sleeping barber problem using

Semaphore Customers = 0;
Semaphore Barber = 0;
Mutex Seats = 1;
int FreeSeats = N;
void Barbar(){ Void Customer() {
while(true) { while(true) {
wait(Customers); L2:_____________
L1:____________ if(FreeSeats > 0){
FreeSeats++; FreeSeats--;
signal(Barber); signal(Customers);
signal(Seats); signal(Seats);
cut_hair() wait(Barber);
} get_haircut();
} } else {
In order to work correctly, the statements at L1 and L2 are respectively
(a) wait(Seats), wait(Customers) (b) wait(Seats), signal(Barber)
(c) wait(Seats), wait(Seats) (d) wait(Barber), wait(Seats)
L1:- wait (seats)
L2:- wait (seats)
L1:- wait (seats)
Mutex to prevent number of available seats.
L2:- wait(seats)
Mutex to prevent number of available seats.
(Before updating free seats, we have to use wait (seats) as free seats is shared variable ).
Answer: C

15. The working set model for page replacement is based upon the “principle of locality”. Under the
working set model, the number of physical frames assigned to a job is based on a system parameter N.
Which is TRUE with respect to the working set model for page replacement?
(a) The last N pages referenced for the job are kept in physical memory.
(b) The number of frames is dynamically adjusted to assure that N percent of the page references will
not fault.
(c) The pages referenced during the last N memory references for the job are kept in physical memory.
(d) The job is allocated enough frames to maintain N percent of its virtual pages in physical memory.
(a) False
We doesn’t keep last N pages referenced for the job we keep last N pages referenced for the job we
keep last N memory referenced for the jobs. Hence( c) is true.
(b) False
( c) False.
ex.:- 1 2 3 4 5 5 5 6 (window size 4)
We will keep 5 & 6 in the main memory (last N reference)
Last N pages3,4, 5,6Answer:C
16. A chord AB of a circle of radius 5.25 cm makes an angle of 60 at the center of the circle. What will be
the area of the major segment?
(a) 168 cm2 (b) 100 cm2 (c) 84 cm2 (d) 70 cm2

Answer: C
17. A cone and a hemisphere have equal bases and equal volumes. What will be the ratio of their
(a) 1 : 3 (b) 1 : 2 (c) 3 : 1 (d) 2 : 1

Answer: D

18. 𝜋/2
The value of the integral ∫−𝜋/2 𝑠𝑖𝑛4 𝑥. 𝑐𝑜𝑠 3 𝑥. 𝑑𝑥 is equal to
2 4 8
(a) 0 (b)35 (c) 35 (d) 35
Answer: c
Solution: ∫−𝜋/2 𝑠𝑖𝑛4 𝑥. 𝑐𝑜𝑠 3 𝑥. 𝑑𝑥
= 2  ∫0 𝑠𝑖𝑛4 𝑥. 𝑐𝑜𝑠 3 𝑥. 𝑑𝑥 (Because, 𝑠𝑖𝑛4 𝑥. 𝑐𝑜𝑠 3 𝑥 is even function)
4+1 3+1
𝑔𝑎𝑚𝑚𝑎( ).𝑔𝑎𝑚𝑚𝑎( ) 4
=2 2
= 35
2.𝑔𝑎𝑚𝑚𝑎( )

19. Consider function f(x) = (x2 – 25)2 where x is a real number. Then the function has
(a) Only one minima (b) Only two minima
(c) Three minima (d) three maxima

Answer: B
Solution: f(x) = x4 – 50x2 + 625
f ’(x) = 4x3 – 100x = 0  x = 0, 5, -5
 f ’’(x) = 12x – 100

Now, f ”(0) = -100 < 0  It has maxima at x = 0

f ”(5) = 300 – 100 = 200 > 0  It has minima at x = 5
and f ”(-5) = 300 – 100 = 200 > 0  It has also minima at x = -5
Thus we can say that f(x) has only two minima.
20. Consider three threads T1, T2 and T3:
T1 T2 T3
wait(S) wait(S) wait(S)
print('*') print('$') print('#')
print('*') print('$') print('#')
signal(S) signal(S) signal(S)

Which is executed concurrently. If the counting semaphore S is initialized to 2; which of the

following cannot produced by concurrent execution?
(a) ##$$** (b) *$*$## (c) *##*$$ (d) *$#*$#

S=2 that means two process can concurrently print.
T1 T2 T3
1) wait(s) 5) wait(s) 9) wait(s)
2) print(‘*’) 6) print(‘$’) 10) print(‘#’ )
3) print(‘*’) 7) print(‘$’) 11) print(‘#’)
4) signal(s) 8) signal(s) 12 signal(s)
(a) If the execution takes places in the order.
then output will be # # $$**.
(b) If the execution takes place in the order.
then output will be:-
(c) If the execution be in the order:-
1,2,9,10,11,12,3,4,5,6,7,8 then (* # # * $ $) is a possible output .
(d)For * $#*$ # all the three process should be able to print concurrently , but only two process can
print concurrently hence this output is not possible.

Consider the following CPU-scheduling scheme. When a process is created or has become ready after
a wait, it is added to the end of the ready queue. When the scheduler runs, it selects a ready process
with the highest priority (ties are broken using FCFS ordering) and gives the CPU to this process for a
maximum of 5 ms. At the end of 5 ms (or earlier, if the process wants to do an I/O), the scheduler runs
again. If the process is preempted, it is added to the end of the ready queue. The priority of a process
is calculated using the following rules. (The lower the number, the lower the priority.)
• The initial priority of all processes is 5.
• At the end of a CPU burst, the priority of the process that was running is updated using the
following formula:
New priority = old priority + 2 * (5 — duration of CPU burst just completed).
Processes Pl, P2, P3, and P4 are created simultaneously in the said order. Their CPU-burst and I/O-
burst time spans are given in the following table. Assume that all I/O requests are for different devices.
P1 2 1 2
P2 7 3 4
P3 2 3 5 4 8
P4 6 1 4 2 1
The average waiting time of all processes is ___________
Ready queue :-
(at following time process arrives in ready queue)

At time 2 P1completed its first CPU burst.

New priority of P1=5+2*(5-2)
P1 is the highest priority process for now.
At time unit 7 P3 completes its first CPU burst.
New priority of P3 = 5+2*(5-2)
P1 is already completed, hence now P3 is the highest priority process.
At time unit 15, 2nd CPU burst of P3 gets completed
hence new priority of P3
P3 is still highest priority process in the system
(P3 gets complete at 27 units)
At time unit 30, P4 completed its first CPU burst.
Hence priority of P4
= 5+2*(5-6)
Now the highest priority process is P2 which has priority as 5.
At time unit 32 processes P2 completes its first CPU burst.
Now priority of P2= 5+2*(5-7)= 5-4=1
Now highest priority process in the system is P4 with priority (3)
At time unit 36 P4 completes its second CPU burst Now priority of the process P4=
Priority =3+2*(5-4) =3+2=5
Now, again P4 is the highest priority process in the system.
Answer: 13.75
22. A processor uses 2-level page tables for virtual to physical address translation. Initially page tables for
both levels are stored in the main memory (i.e. not in the cache memory). The processor has a
translation look-aside buffer (TLB), with a hit rate of 95%. The TLB caches recently used virtual page
numbers and the corresponding physical page numbers. The processor also has a physically addressed
cache with a hit rate of 95%. Both TLB and cache access time is 10 ns and main memory access time is
100 ns. Assuming that page faults rate is 0.01%, page fault service time is 10ms and the processor used
parallel search algorithm, the average time taken to access a virtual address is (in microseconds)
(a) 74.97 (b)74.44 (c)75.45 (d)75.97

TLB access time =10ns
Cache access =10ns
Memory access time= 100ns
Page fault services time 10ms
=10*106 ns
= 107 ns
TLB hit rate = 95%
Cache hit rate = 95%= 0.95
Page fault rate = 0.01%= 100
Parallel search algorithm is used.
Effective access time :-

99.99 0..01
=0.95(24.5)+0.05*(29+ *14.5+ *107)
100 100
23. Suppose the syntax "P(1)||P(2)" means processes P(1) and P(2) are concurrently call to function P.
Consider the following concurrent programs.
const int n = 5;
volatile int total = 0;
void P(int i) {
for (int count = 1; count <= n; count = count + 1){
total = 2 * total + i;
void main() {
P(1) || P(2);
The Print function just prints out its argument value in some user readable form. Assume that count is
a local variable to each process. Let x and y are the lower and upper bounds on the final value of shared
variable total. The value of x + y is___________
Min value = 31
Max value= 2015
For min value
If both the process runs in the following ways:-
(1)Process 1 runs
(2) Read the value of total does the arithmetic 2*total +i, but does not save in total.
(3) P1 context switches and P2 gets the chance.
(4) P2 reads the value of total does not the arithmetic.
2*total +i; and then saves it in total.
(5) Then context switching takes place and P1 gets the chance.
Now P1 saves the calculated value in total.
(loop will execute 5 times)
P1 P2
const int n=5 “
volatile int total =0
void P(int 1) void P(int 2)
for(int count=1;count<=n; count=
count+1) “
total =2*total +i;
total =2*0+1 Total =2*total +i;
=1(not saved yet in total)
context switch
total =2*0+2
total =1 (saved in total) total =2
Now value of total =1 saved in total context
The update made by P2 is lost.
After 2nd iteration.
Total= 2*1+1
after 3rd iteration
total =2*3 +1
After 4th iteration
total =2*7 +1
After 5th iteration
Total =15*2+1
hence min value =31
for max value
P2 is runs completely than P1 gets chance.
After 1st liberation
Total =2*total+2
After 2nd iteration.
total =6
After 3rditeration
total =14
After 4th iteration
After 5th iteration.
Total =2*30 +2
Now P1 gets the chance after 1st iteration
Total=2*62 +1
After 2nd iteration
Total =251
After 3rd iteration
Total = 503
After 4th iteration
Total 1007
After 5th iteration
Total =2015
The value X+Y= 31+2015= 2046
Answer: 2046

24. The memory architecture of a machine is summarized in the following table.

Virtual address 54 bits
Page Size 16 Kbytes
PTE Size 4 bytes
Assume that there are 8 bits reserved for the operating system functions (protection, replacement,
valid, modified, and Hit/Miss - All overhead bits) other than required by the hardware translation
algorithm. The largest physical memory size (in Gbytes) allowed by this PTE format is ______256______
PTE= 4bytes = 4*8 = 32 bits
Bits for frame number = 32-8
= 24
Bits for frame size (offset) = 14
(frame size = page size
Memory size = 224 *214 = 238 = 28 GB = 256GB
Answer: 256

25. Assuming a page size of 4 KB and that each page table entry (PTE) takes 4 bytes, how many levels of
page tables would be required to map a 62-bit address if the first level page table fits into a single

Solution :
𝐵𝑖𝑡𝑠 𝑓𝑜𝑟 𝑣𝑖𝑟𝑡𝑢𝑎𝑙 𝑎𝑑𝑑−𝑏𝑖𝑡𝑠 𝑓𝑜𝑟 𝑜𝑓𝑓𝑠𝑒𝑡
Number of level = 𝑏𝑖𝑡𝑠 𝑓𝑜𝑟 𝑜𝑓𝑓𝑠𝑒𝑡−𝑏𝑖𝑡𝑠 𝑓𝑜𝑟 𝑒𝑛𝑡𝑟𝑦 𝑠𝑖𝑧𝑒
62−12 50
= = 10 = 5.0 levels
 5 levels
Answer: 5

Consider the following
 Virtual addresses are 36 bits.
 The page frame size is 1024 bytes.
 The physical page number (PPN) is 32 bits.
 The TLB is fully associative containing a total of 512 lines
How many bit long TLB tag will be? _____________
TLB is fully associative containing a total of 512 lines
Bits for offset =10 bits as page size =1024 bytes
Virtual addresses are 36 bits
TLB (Tag bits)  36-10 =26
Answer: 26

27. Suppose a system has only four physical pages and all the frames are initially empty. Given the
following sequence of virtual page references:
What is the difference of the number of page faults that are required using the Optimal Page
Replacement policy to the number of page faults that are required using the Least Recent Used
Replacement policy? ___________
Optimal page replacement
✔ ✔ ✔ ✔ ✔ ✔
1 2 1 1 3 2 1 4 3 1 1 2 4 1 5 6 2 1 1 2 3 4 5 6
Page fault= 6
Least recently used replacement policy.

Page faults =7
Difference = 7-6= 1
Assume that you have 4 Gbytes of main memory at your disposal out of which 1 Gbyte has been
reserved for process page table storage. Each page table entry consists of a physical frame number
with 1 valid bit, 1 dirty bit, 1 LRU status bit. The virtual addresses and physical addresses are 32 bits
and 26 bit long respectively and the page size is 8 Kbytes. How many processes page table can be fit in
1 Gbytes space? _________

Size of one page table = number of entries *entry size
𝐵𝑖𝑡𝑠 𝑓𝑜𝑟 𝑓𝑟𝑎𝑚𝑒+𝑒𝑥𝑡𝑟𝑎 𝑏𝑖𝑡𝑠
Entry size (in bytes ) = 8

Extra bits = 1 valid bit +1 dirty bit+ 1LRU bit

= 3 bits
13+3 16
Entry size = 8 = 8 = 2 bytes
Number of entries = number of pages.
Number of pages = 213
= 219
Size of page table = 219 *2
= 220 bytes
1Gbyte been reserved for page table.
= 220= number of process page table that can be fit in 1Gbyte space.
= 210 =1024
Answer: 1024

Consider a virtual memory system with the following parameters:
 32 KB direct mapped cache with 32 byte blocks
 48 bit virtual addresses
 32 bit physical addresses
 4 KB page size
 A fully associative TLB with 256 entries
 Memory is byte addressable
Let x, y and z bits are needed for the page offset, virtual page number, and physical page number
respectively, then the value of x + y + z is________
X= number of bits for page offset
Page size = 4KB = 212 bytes
X= 12
Y= bits for virtual page number.
Virtual address space= 248
Number of pages = 212 = 236
y= 36
Z= bits for physical page number.
Physical address space = 232
Number of frames = 212 = 220
Z= 20
X+Y+Z= 12+36+20 = 68
Answer: 68

Consider the following 3-process concurrent process which uses semaphores S1, S2, and S3. The
semaphore operation, which are sometimes called “wait” and “signal”, are denoted here with the
classical notation of “P” and “V”.
Process 1 Process 2 Process 3
L1:P(S3); L2:P(S1); L3:P(S2);
print(“T”); print(“U”); print(“B”);
V(S2); V(S3); V(S1);
goto L1; goto L2; goto L3;
Let the initial values that can be given to the semaphores S1, S2 and S3 so that the processes cooperate
to print the string BUTBUTBUTBU is x, y and z respectively then x+y+z =_____

The output string is BUTBUTBUT.
That means first process 3 should run, after that process 2, which is followed by process1 and then
process 3 should get chance again
S2=1  (because process 3 should run)
Hence x=0
X+Y+Z=0+1+0 =1

Consider a machine with a 32-bit processor (with virtual addresses and physical addresses both stored
on 32 bits). An overview of the paging structures is provided in Figures given below, for a page size of
4 kilobytes (212 bytes) assume page table entry size 4 bytes.

There is only one valid address range (0x00000000 to 0x003FFFFF) in the process address space,
whose mapping uses 4 KB pages. Let the number of valid pages of a process address space are P and
the amount of space required to store the paging data structures for the above process is Q bytes. The
value of ⌊log 2 𝑃⌋ + ⌈log 2 𝑄⌉ is __________
valid address range
0x00000000 to 0x003FFFFF
P = Number of valid pages of process address space.
= (pages of data )
Pages of data = number of valid entries in second level page tables i.e. (page table)

First level only one entry

that means at second level there only one page .
At second level there are.
Total = (11 11 11 1111)2 – (00 0000 0000 )2 +1
entries = 1023+1 = 1024
 Total 1024 page of data
P= 1024
Q= amount of space required to store paging data structure.
1 entry at level 1 hence 1 page at level 1.
2048 entries at level 2, and one page can accommodate 1024 entries hence 2 pages at second level .
Total page =1+1=2
Total space = 2*212 = Q
⌊𝑙𝑜𝑔2 𝑃⌋+⌈𝑙𝑜𝑔2 𝑄⌉ = ⌊𝑙𝑜𝑔2 1024⌋+ ⌈𝑙𝑜𝑔2 2 ∗ 212 ⌉
= 10+13= 23Answer:23
Five batch jobs A through E, arrive at a computer center at almost the same time. They have estimated
running times of 11, 6, 2, 4, and 8 minutes. Their (externally determined) priorities are 3, 5, 2, 1, and
4, respectively, with 5 being the highest priority. If the preemptive priority based scheduling is used
then the mean process turnaround time (in minutes) is_______
Process Priority Running time (in mins)
A 3 11
B 5 (highest priority ) 6
C 2 2
D 1 4
E 4 8

Turnaround time:-
Process A= 25
Process B= 6
Process C= 27
Process D= 31
Process E= 14
Total = 103
Average Turnaround time = 5 = 20.6
Answer: 20.6

Consider a new scheduling policy: Least Used First (LUF). When given the choice to schedule two
processes (jobs) on the run queue, the scheduler will select the one that has used the fewest CPU cycles
thus far. In case of a tie, the queue is otherwise FIFO. When a process is descheduled it goes to the end
of the queue. The CPU should not site idle when there are processes on the run queue. Consider the
following jobs with arrival time and a duration (the amount of CPU time it will need, in time units).
Job Arrival Time Duration
A 0 25
B 15 25
C 25 5
D 40 5
Supposing a running job is only pre-empted when a new job arrives (no interrupts), then the average
turnaround time of all jobs is__________

Job Arrival time Duration
A 0 25
B 15 25
C 25 5
D 40 5
Turnaround time
Process A= 55-0 = 55
Process B= 60 -15 = 45
Process C =30- 25= 5
Process D= 45-40 =5
Total turnaround time = 110
Average TAT = 4 = 27.5

Consider the set of six processes whose arrival time and burst time are given below-
Process Id Arrival time Burst time
P1 5 5
P2 4 6
P3 3 7
P4 1 9
P5 2 2
P6 6 3
Assume that the context-switching overhead is 0.1 time units. If the CPU scheduling policy is Round
Robin with time quantum = 3, the average waiting time of process is_________


Ready Queue

P5 P3 P2 P4 P1 P6 P3 P2 P4 P1 P3

Waiting time :-
Process P1= 30.6 - 5-5 = 20.6
Process P2 = 24.6-3-4 = 17.6
Process P3= 32.6-6-3= 23.6
Process P4 = 27.6-6-1 = 20.6
Process P5 = 4.1-2= 2.1
Process P6 = 18.5-6= 12.5
Total = 97
Average = 6 16.17
Answer: 16.17

Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently serving a
request at cylinder 2150, and the previous request was at cylinder 1805. The queue of pending
requests, in FIFO order, is: 2069, 1212, 2296, 2800, 544, 1618, 356, 1523, 4965, 3681. Starting from
the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy
all the pending requests for each of the C-LOOK disk-scheduling algorithms?_______ ______
C- Look disk scheduling Algorithm :-

Disk arm moves total = 4965-2150+4965-356+2069 -356

= 9137Answer: 9137

If the virtual address space supported is 243 bits, the page size is 1Kbyte, the size of the physical
memory is 64Kbyte, the size of a PTE is two bytes, and the addressing is at the byte level, what is the
size of the page table (in MB) required for single level page table?________
Size of page table = number of entries *entry size
Virtual address space = 243 bits
Number of entries = number of pages
243 233
∴ Number of entries = 210 ∗23 = = 230
entry size = 2bytes
size of page table = 230*2
= 231 bytes
= 220 MB
= 211MB= 2048
Answer: 2048

Consider three threads that arrive at the same time and they are enqueued in the ready queue in the
order T1, T2, T3. Thread T1 runs a four-iteration loop, with each iteration taking one time unit. At the
end of each iteration, T1 calls yield; as a result, T1 is placed at the end of the ready queue. Threads T2
and T3 both run a two iteration loop, which each iteration taking three time units. At the end of first
iteration, T2 synchronizes with T3, i.e., T2 cannot start the second iteration before T3 finishes the first
iteration, and vice versa. While waiting, T2 (T3) is placed in the waiting queue; once T3 (T2) finishes
its first iteration, T2 (T3) is placed at the end of the ready queue. Each process exits after finishing its
loop. Assume the system has one CPU and A thread only stops running when it calls yield or waits to
synchronize with another thread. What is the average completion time if the FCFS scheduling is
used?_____ ____(Rounded off to two decimal places)

Completion time =
T2= 11
Total =41
Average = 3 = 13.67

Answer: 13.67

38. Consider a memory system with a TLB access time of 10ns and a memory access time of 110ns –
assume the memory access time includes the time to check the TLB. If the effective access time is 20%
greater than the TLB access time, what is the hit ratio HTLB of TLB in percentage? ________

Memory access time =100 ns
Effective access time = 100 *1.20
= 120 ns
Effective access time = HTLB (TLB time+memory access (for page table) + (1- HTLB) (TLB time+
memory access (for data))
120 = HTLB(10+100)+(1-HTLB) (10+100+100)
120=110+(1-HTLB) *100
10= 100-HTLB*(100)
-90= -100 HTLB
0.9= HTLB = 90%

39. How many times does the 29th day of the month occur in 400 consecutive years? ______________
Answer: 4497
Solution: In 400 consecutive years, number of leap years = 244 + 1 = 97
and in every non-leap year, 11 times occurs 29th day of the month.
Therefore, in 400 consecutive years = 400  11 + 97 = 4497

40. How many times in a day, are the hands of a clock in straight line but opposite in direction?

Answer: 22
Solution: The hands of a clock point in opposite directions (in the same straight line) 11 times
in every 12 hours. (Because between 5 and 7 they point in opposite directions at 6 o’clock
So, in a day, the hands point in the opposite directions 22 times.