Starting from:

$24.99

CS3510 Quiz 2 Solution


1. You must submit your final answer copy as a pdf named <Rollnumber>.pdf
2. You should avoid submitting scan copies of hand-written notes. Only if you wish to attach any figure, you can attach the scans of the figures in your pdf.
3. Please give justification for all your answers.
1. On early computers, every byte of data read or written was handled by the CPU (i.e., there wasno DMA). What implications does this have for multiprogramming? [3 pts]
2. Consider a computer system that has cache memory, main memory (RAM) and disk, and anoperating system that uses virtual memory. Assume that it takes 1 nsec to access a word from the cache, 10 nsec to access a word from the RAM, and 10 ms to access a word from the disk. If the cache hit rate is 95% and main memory hit rate (after a cache miss) is 99%, what is the average time to access a word? [5 pts]
3. An application has 30% of code that is inherently serial. Theoretically, what will its maximumspeedup be using Amdahl’s law if it is run on a multicore system with (a) four processors and (b) Eight processors. [4 pts]
4. In this problem you are to compare reading a file using a single-threaded file server and amultithreaded server. It takes 12 msec to get a request for work, dispatch it, and do the rest of the necessary processing, assuming that the data needed are in the cache. If a disk operation is needed, as is the case one-third of the time, an additional 75 msec is required, during which time the thread sleeps. How many requests/sec can the server handle (a) if the server is single threaded (b) if it is multithreaded assuming that whenever a thread is stuck waiting for data another thread executes? [6 pts]
5. Linux supports two modes of cancellation: Asynchronous & Deferred.
(a) Explain the difficulty with asynchronous cancellation in threads using an example. [3 pts] (b) Deferred cancellation is ensured by cancellation points. When a thread reaches a cancellation point, it gets terminated. How do you think are the cancellation points are internally implemented [4 pts]
6. In some systems, a spawned process is destroyed automatically when its parent is destroyed; in other systems, spawned processes proceed independently of their parents, and the destruction of a parent has no effect on its children.
(a) Give an example where this situation is beneficial. [3 pts]
(b) Give an example of a situation in which destroying a parent should specifically not result in thedestruction of its children. [3 pts]
7. In the class, we described a multithreaded Web server, showing why it is better than a singlethreaded server and a finite-state machine server. Are there any circumstances in which a singlethreaded server might be better? Give an example. [4 pts]
1

More products