Operating systems miscellaneous
- Consider the following proposed solution for the critical section problem. There are n processes: P0 ...Pn - 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero.
Code for Pi:
do {
c[i] = 1; t[i] = pmax (t[0],..., t[n – 1]) + 1; c[i] = 0;
for every j ≠ i in{0,..., n–1} {
while(c[j]);
while(t[j] != 0 && t[j] <= t[i]);
}
Critical Section;
t[i] = 0;
Remainder Section;
} while (true);
Which one of the following is TRUE about the above solution?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
NA
- Using a larger block size in a fixed block size file system leads to
-
View Hint View Answer Discuss in Forum
Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.
Correct Option: A
Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.
- A unix-style I-node has 10 direct pointers and one single, one double and one triple indirect pointers. Disk block size is 1 kbyte, disk block address is 32 bit, and 48-bit integers are used. What is the maximum possible file size?
-
View Hint View Answer Discuss in Forum
Size of 1 block = 1 kB
Block addresses size 1 pointer size = 32 bit = 4 bytes.So , no. of pointers in = 210 B 22
1 block = 256
So direct pointer will have = 10 × 1kB = 10kB
Double will have = 256 × 256 × 1 kB
Triple will have = 256 × 256 × 256 × 1 kB = 28 × 28 × 28 × 210 B = 234 B
Hence (c) is correct option.Correct Option: C
Size of 1 block = 1 kB
Block addresses size 1 pointer size = 32 bit = 4 bytes.So , no. of pointers in = 210 B 22
1 block = 256
So direct pointer will have = 10 × 1kB = 10kB
Double will have = 256 × 256 × 1 kB
Triple will have = 256 × 256 × 256 × 1 kB = 28 × 28 × 28 × 210 B = 234 B
Hence (c) is correct option.
- Consider a typical disk that rotates at 150000 Rotations Per Minute (RPM) and has a transfer rate of 50 × 106 bytes/sec. If the average seek time of the disk is twice the average rotation delay and the controller's transfer time is 10 times the disk transfer time, the average time (in milliseconds) to read or write a 512-byte sector of the disk is _____.
-
View Hint View Answer Discuss in Forum
60sec → 15000 rotations
1 sector → 60 = 4 ms ← 1 rotation 15000 ∴ Average rotational delay = 1 × 4 ms = 2 ms 2
⇒ As per question, average seek time = 2 × Avg. rotational delay
= 2 × 2 = 4ms
⇒ As per question, controller's transfer time is = 10 × 0.01 ms = 0.1 ms
∴ Avg. Time = 4ms + 0.1 ms + 2ms = 6.1 msCorrect Option: D
60sec → 15000 rotations
1 sector → 60 = 4 ms ← 1 rotation 15000 ∴ Average rotational delay = 1 × 4 ms = 2 ms 2
⇒ As per question, average seek time = 2 × Avg. rotational delay
= 2 × 2 = 4ms
⇒ As per question, controller's transfer time is = 10 × 0.01 ms = 0.1 ms
∴ Avg. Time = 4ms + 0.1 ms + 2ms = 6.1 ms
- A shared variable x, initialised to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory and then terminates. Each process before reading x invokes the P operation (i.e. wait) on a counting semaphore S and invokes the V operation (i.e. signal) on the semaphore S after storing x to memory. Semaphore S is initialised to two. What is the maximum possible value of x after all processes complete execution?
-
View Hint View Answer Discuss in Forum
Each of the processes W and X reads x from memory and .increment x by .1.
Each of the processes Y and Z reads x from memory, and decrement by 2.
1. Start with X and perform P(S) then S = 1 read x = 0 x = x + 1 = 1
2. Then Y will perform P(S) then S = 0 read X = 0 x = x–2 = –2 then store x. V(S),S = 1
3. Then Z will perform P(S) then S = 0, read x = – 2 x = x – 2 = – 4 then store x, V(S).S = 1.
4. Then x will store x.V(S), S = 2, X = 1
5. Then W will perform P(S),S = 1, read x = 1 x = x + 1 = 2, store x, V(S),S = 2, x = 2
Hence, answer is option (d)Correct Option: D
Each of the processes W and X reads x from memory and .increment x by .1.
Each of the processes Y and Z reads x from memory, and decrement by 2.
1. Start with X and perform P(S) then S = 1 read x = 0 x = x + 1 = 1
2. Then Y will perform P(S) then S = 0 read X = 0 x = x–2 = –2 then store x. V(S),S = 1
3. Then Z will perform P(S) then S = 0, read x = – 2 x = x – 2 = – 4 then store x, V(S).S = 1.
4. Then x will store x.V(S), S = 2, X = 1
5. Then W will perform P(S),S = 1, read x = 1 x = x + 1 = 2, store x, V(S),S = 2, x = 2
Hence, answer is option (d)