Have fun learning about computers!
For the last ten years or so, we have been hearing about “dual-core” or “multi-core” processors.
-I have two cores!
So, what’s the point of having multi-core processors?
Let’s ask some mainstream consumer electronic retailer.
– Why shall I get a computer with a multi-core processor?
– Well, this allows you to launch two applications at the same time.
NO. FUCKING. SHIT.
This is a genuine answer that was given in a well-known electronic shop.
If you still had doubt about it: this is bullshit.
Before multi-core processors existed, did that seller imagine that things were like this?
– Boss’s coming!
– Whoops, I have to close Solitaire to launch Word again! Aah, if only we could have two applications running at the same time, I could switch from one window to another!
Do you mean that Alt+Tab didn’t exist at the time?!
Of couse, that’s not how it happened!
Desktop computers’ main advantage has always been to be able to run several tasks at the same time — well before multi-core processors were even invented!
Let’s keep in mind that a processor, at its core, so to speak, only does one simple thing at a time. As it does those simple tasks extremely fast many times though, the end product is something more complex.
– Gee recycles his article Computers Are Stupids for the 200,000th time!
– Sure, why not? It’s more eco-friendly.
or us to believe that two tasks (or more) are run at the same time, the computer simply doesn’t stop switching from one to the other so fast that it creates the illusion that both tasks are run at the same time.
– Imagine Superman building two houses, switching from one to the other at the speed of light and by adding one brick at a time. You would see both houses being built at the same time, although technically only one of them is being built at any given time.
– Are you kidding me? Is that the best use of my time?
How come, then? Since we have been able to handle multi-tasks for decades, why have we been trying for the last few years to multiply the number of cores of processors?
Because we can’t increase their speed.
– Faster. Faster
– I’m at max speed! I have only one pair of hands.
– Ok, well…let’s fix that.
If you were paying attention to computing before 2000, you probably remember people saying that processors’ speed was doubling every two years.
Haaa, still using a 150 MHz Pentium? Ha ha, it’s no longer 1995! My Pentium II runs at 300 MHz !
Is your sister still using MS-DOS though?
Moore’s law stipulated that we would double the number of transistors in a processor every 2 years, thanks to ever more efficient miniaturization.
The only thing is that we started reaching physical limits…. Making things smaller becomes even more complex when the size of transistors approaches the size of a few atoms…
– Was I the only one to think that transistors were radios for old people…?
What’s even more problematic, though, is that when we reach such a density of transistors, it’s a challenge to keep things cool: the smaller, the faster, the hotter!
– Faster. Faster.
– Haaaa, toooo hooooooot I’m melting!
Note that the speed record is of 500 GHz. But it’s the same as for high speed train records: it’s only a show off. We show that we can do it, but it’s not for the general public.
– Yeah, if we needed to have a liquid nitrogen factory to keep every computer cool, it wouldn’t really be practical.
For mainstream computers, it seems that we have been hitting a 2-GHz ceiling (approximately) for several years now.
To keep improving the overall system’s speed, we multiply the number of processing units (yeah, those “cores” we’ve been talking about).
– Doctor! I can’t handle all those programs anymore. It’s too much emotion. Give me a second heart!
– Getting confused with analogies here. Does it need another core, another pair of hands,
or another heart?
– “Core” originally comes from Latin and means “heart”.
So, everything is fine then, right?
We just need to increase the number of cores to increase the performance, right?
By doing this, we have simply increased the overall performance by sharing the workload between several processing units.
A single program, however, is still run sequentially on only one core at a time. It’s not as if you just needed to have four cores to have things run four times faster.
– Well, we’ve gathered 9 of you because we would want you to have a baby in one month.
– Err. Is he crazy?
Indeed, to make a task run in parallel, while it was supposed to be executed sequentially (one operation after the other, in a given order), is not only not always possible, but it also often requires a great deal of coordination so that it works, because the different cores deal with shared memory.
For example, if a core reads data, it will take a certain amount of time.
– So this famous French poem goes like this: “Les sanglots longs… “.
… during that time, a second core may want to change that data!
– Let’s write this down: “les… sanglots… longs…”
So the first core may end up with erronous data. For computers, this means that it may not work as expected or even crash the system.
– “D’une langueur monotone.” So: “Les sanglots longs d’une langueur monote.” Beautiful! But it’s pure
non-sense, isn’t it?
– That’s the art of poetry…
– Yeah, I also thought that that verb was not right, but apparently not!
For that reason, we have to add synchronization mechanism like “mutex” (which means “mutual exclusion”).
Basically, imagine a guard protecting the data while a core is reading or writing it.
– I’d like to write there…
– Busy. Wait for your turn.
– What a lousy bouncer…
Of course, this kind of mechanism isn’t effortless and “lowers” the performance gain that we could wish for when making things run in parallel. Without even mentioning numerous problems which can occur, like such “deadlocks”:
– I’ve blocked mutex A and I need to reach B to end my task and free A.
– Not possible. B is blocked.
– I’ve blocked mutex B and I need to reach A to end my task and free B.
– Not possible. A is blocked.
– In real life, we wouldn’t stay stuck forever, but computers are quite… Well you know.
In short, processors have several cores. It’s a solution to continue increasing computer performance when facing a physical challenge… But it doesn’t solve everything, and more importantly, it changes the way we write programs.
– Oh, yeah! It’s not so easy to handle three cores.
Grise Bouille – http://grisebouille.net/
Translated and adapted by Jonathan Pierrel – https://www.comicsenglish.com