Compre IIsem 2003-04 Sol
Compre IIsem 2003-04 Sol
Que #1 3 Marks
Disk requests come into the disk driver for cylinders 10,22,55,2,28,12,6,40 and 38
in that order. The disk drive has 60 cylinders numbered 0 to 59 and the current head
position is 26. A seek takes 6 millisecond / cylinder moved. How much seek time is
needed for
(A) FCFS (B) SSTF
(C) SCAN, (D) C SCAN
(E) LOOK (F) C LOOK
Answers
16+12+33+53+26+16+6+34+2 = 198
Answer
a. Find the number of disk block pointers, which fit in one block by dividing the block
size by the pointer size:
Which is HUGE.
b. There are 24 bits for identifying blocks within a partition, so that leads to:
c. Using the information from (a), we see that the direct blocks only cover the first
96KB, while the first indirect block covers the next 16MB. the requested file
position is 13M and change, which clearly falls within the range of the first
indirect block. There will thus be two disk accesses. One for the first indirect
block, and one for the block containing the required data.
Que #3 4 Marks
A multilevel feedback queue algorithm works with the following condition
Number of queues 3 (Q1,Q2 and Q3)
Scheduling algorithm Q1 R R, Q2 preemptive priority
& Q3 FCFS
Method used to upgrade a process No upgrading among queues
Method to demote a process Q1After 2 units of time, Q2 When the Priority
becomes 0 (Priority of the process reduced by 1 for every 1 units of execution in CPU, if
2 processes have the same priority then the process came first to the queue), Q3The
Process who came first to the queue will get the first chance.
Method used to determine which queue a process will enter
P1, P3 are entering through Queue #2 (Q2)
P2 & P4 are entering through Queue #1 (Q1)
Process T.CPU burst CPU burst I/O burst Priority Arrival time
P1 14 7 6 6 0
P2 13 8 1 5 1
P3 10 4 3 4 4
P4 13 8 4 4 6
Calculate Average waiting time, average turn around time, and CPU utilization
P1 P2 P2 P1 P2 P2 P4 P4 P1 P3 P4 P4 P1
P2 P3 P3 P1 P2 P4 P4 P1 P2 P3* P4 P4* P1*
P3 P3 P3 P4 P4 P4 P1 P1 P1 P1 P4 P4** P1
P1 P3** P2* P1** P2 P2 P2 P2 P3 P3*** P2**
Que #4 4 Marks
Consider the following test program for an implementation of join. When parent
thread calls join on a child thread the parent does the following
1. If the child is still running the parent blocks until the child finishes
2. If the child has finished the parent continues to execute without blocking.
int x=10;
pthread_t tid[25];
void main()
{ void *fun1(void *a)
int i,j=0; {
for(i=0;i<3;i++) { x = x /2 ;
if(fork()) { x=x 3;
x=x + 5; x=x*3;
pthread_setPriority(tid[I],x); }
pthread_create(tid[i],NULL,fun1,0);
x = x+10;
}
else { void *fun2(void *a)
x = x 5; {
pthread_setPriority(tid[I],x); x = x /4 ;
x=x + 2;
pthread_create(tid[i],NULL,fun2,1); x=x*3;
x=x - 20; }
}
x=x + 10;
}
for(i=0;i<3;i++) {
pthread_join(tid[i]);
}
printf(%d\n,x);
}
Assume that the scheduler run threads in non-preemptive Priority scheduling (the
more the priority number the higher the priority is). Main thread is having the priority
value 5.What will be the values of x (all copies of x) after execution?
Answer
P1 237
P2 63
P3 48
P4 39
P5 3
P6 9
P7 9
P8 -18
Que #5 4 Marks
Consider the following page reference string
2,3,1,2,4,5,1,2,3,4,5,2,6,2,1,2,3,1,4,5,6
How many page faults would occur for the following page fault algorithms,
assuming 3 and 4 available frames. In the beginning the frames are empty.
(A) Optimal replacement
(B) LRU replacement
(C) FIFO replacement
(D) Second chance replacement
Answer
Answer
(A) 2 ^ 44 / 2 ^ 16 = 2 ^ 28
(B) 2,13,13,16
(C) 2 ^ 16 + 3
Que #7 2 Marks
A computer with 32-bit address uses 3 level page tables. Virtual addresses are
split into 3-bit outer and 9 bit and 9 bit inner levels and an offset (inner page table are
designed to fit exactly in one frame).
(A) How large the pages are?
(B) How many are there in the address space?
(C) How long is one entry in page table?
Answers
(A) 2K
(B) 2 ^ 32 / 2 ^ 11 = 2 ^ 21
(C) 4 byte
Que #8 4 Marks
Answer
Because storing the name in the file descriptor would not allow links two different
directories referring to the same file, but by different names.