If a machine takes 3min to process 1 byte, how many machines are required to process 1000 bytes in 30min?

83 Views Asked by At

We have a machine that takes 3 minutes to process a byte. Now if I send 1000 bytes together the machine will take 3000 minutes to process them serially. If we want to do that in 3 minutes only we need 1000 such a machines operating in parallel. In 1 minute we need 3000 machines operating in parallel.

Now how to calculate this. If we want to process that 1000 bytes in 30 minutes completely how many machines do we need.

2

There are 2 best solutions below

2
On

Hint: How many bytes can one machine process in 30 minutes? Also, for the future, try to create topics with titles that are actually meaningful.

2
On

I assume, though it is unstated, that the problem is embarrassingly parallel: that processing the second byte does not depend on and can be done independently of processing the first byte.

If so, what is the granularity of the problem? Can you process both halves of the byte independently (certainly this does not extend all the way to the bit level, otherwise there are only four possible program and they would not take anywhere close to 3 minutes to run on a byte of data)? If the granularity is one byte, there is no way you can ever do better than 3 minutes, short of switching to a faster machine.

Finally, keep in mind that a linear relationship between machines and speedup is overly optimistic even for the simplest of parallel problem: there is network latency to deal with, and overhead associated to splitting up the data and collating the results at the end, etc. (Although admittedly in this case this overhead should be small relative to the computation, which is seemingly very slow.) Moreover, it is very common for such calculations to have some common initialization that must be done, or some intermediate results that can be cached and reused during later computation. There may be an economy of scale to asking fewer machines to process more data vs. distributing out fewer data to more machines.