środa, 3 września 2014

CPU access in NOT like File Access

Yesterday on a meeting, someone mentioned, that CPU is like File access, that if we have ex: 4 threads system. Having 2 processes accessing the all 4 threads would be on first-come-first-serve basis.
That first process will utilize almost 100% CPU power (will be resource hog). Resulting huge overhead.

That is not the case.

Modern CPU's are very efficient in switching between threads.
The CPU time (computation time) of both processes would be divided almost equally.
The computation time of each processes would be ca. twice slower. Than running them separetly.
The total computation time of both processes would be (almost) equal to time of running them sequentially.

So CPU access in nothing like File Access

BTW: Modern kernels also can give multiple file descriptors so even File access would not be on first come-first-serve-basis

It all would be ok, I mean, all people can have false assumptions, but the person stating such bologna is Head of IT Unit :(...


Further reading:
http://en.wikipedia.org/wiki/Hyper-threading
http://en.wikipedia.org/wiki/Thread_%28computing%29