Computer Science, asked by Gokulroshin4918, 10 months ago

Consider a disk with a single platter, 5 tracks, no zoning effects. On average, what is the seek distance (in tracks and in percentage of total tracks) between two disk accesses?

Answers

Answered by Anonymous
0
Find a creative/funny example of synchronization that can demonstrate the difficulty of developing a monitor-based solution (in pseudocode) similar to the "Readers-Writers." 
Make sure that you vigorously discuss the correctness and pitfalls of your solution.

There is a common price for gas
Consumers never modify the price - they just pump gas
Owners read modify the price
We want one owner at a time, but many consumers at the same time
Consumer() {
lock.Acquire();
while (activeOwners > 0 
|| waitingOwners > 0) {
++waitingConsumers;
okToPump.Wait(&lock);
--waitingConsumers;
}
++activeConsumers;
lock.Release();
// access price and pumps
lock.Acquire();
--activeConsumers;
if (activeConsumers == 0 &&
waitingOwners > 0) {
okToChangePrice.Signal(&lock); 
}
lock.Release();
}
Writer() {
lock.Acquire();
while (activeOwners > 0 
|| activeConsumers > 0) {
++waitingOwners;
okToChangePrice.Wait(&lock);
--waitingOwners;

Similar questions