Hi! On the following question I calculated for the a) that it would be 20 reques
ID: 644974 • Letter: H
Question
Hi! On the following question I calculated for the a) that it would be 20 requests per second, however I can't figure out how to do b). Can you help me?
A file server receives requests via a network. It takes 20 ms to dispatch the requested data and do the necessary processing, assuming that the data needed are in the cache. If a disk operation is needed, as is the case in one third of the time, an additional 90ms is required, during which time the thread sleeps.
a) How many request/sec can the server handle if it is single threaded?
b) How many request/sec can the server handle if it is multithreaded (one thread popping up at each request)?
Explanation / Answer
In a single threaded case,
the time taken by each request on an average considering both type of requests i.e cache and disk operations is
(2/3) * 20ms + (1/3) * (20 + 90)ms = 150 / 3 ms
So number of requests server can handle in a sec is 1000ms / (150 / 3) ms = 20
In the multithreaded case:
during the time the thread sleeps i.e 90 ms, other thread is handled i.e other request is taken up.
So the waiting time of 90ms wont be there in this case (assuming we have sufficient number of requests)
So the average time now per request will be 20 ms (2/3 * 20 ms + 1/3 * 20 ms)
So number of requests server can handle in a sec in multithreaded case is 1000ms / 20ms = 50
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.