beginner99
Diamond Member
Not sure if this is the right forum (OS forum?) but I have a question about my homework for a CS-class.
It's about multi-threading.
A server takes 15 ms to process a request for a file if it is in cache, in 1/3 of the cases it takes an additional 75 ms to get the file from the disk. In that time the thread sleeps.
a) Requests per second with 1 server thread?
-> 15 ms * 1/3 * 75 ms = 40 ms per request -> 25 Requests per second
b) with multiple threads?
Is there a formula for this? I only came with following idea:
A thread sleeps 1/3* 75 ms on average per request. So a second thread on average has 25 ms execution time while first thread sleeps. So we can execute 25 ms / 40ms +1 = 1.625 requests in the same time (40.635/s). Correct?
How do i generalize this for n-threads?
It's about multi-threading.
A server takes 15 ms to process a request for a file if it is in cache, in 1/3 of the cases it takes an additional 75 ms to get the file from the disk. In that time the thread sleeps.
a) Requests per second with 1 server thread?
-> 15 ms * 1/3 * 75 ms = 40 ms per request -> 25 Requests per second
b) with multiple threads?
Is there a formula for this? I only came with following idea:
A thread sleeps 1/3* 75 ms on average per request. So a second thread on average has 25 ms execution time while first thread sleeps. So we can execute 25 ms / 40ms +1 = 1.625 requests in the same time (40.635/s). Correct?
How do i generalize this for n-threads?