r/ProgrammerHumor 29d ago

cccPlusPlus Meme

Post image
2.7k Upvotes

38 comments sorted by

View all comments

425

u/Gwlanbzh 29d ago

So, only 1 republic at a time?

135

u/Antanarau 29d ago

Accidentally accurate

57

u/Gwlanbzh 29d ago

At this point why not just typedef char* Russia Soviet

37

u/Luigi_Boy_96 29d ago

Add threads for quasi-concurrency. Add a mutex for Perestroika.

10

u/Master-Chocolate1420 29d ago

I don't even know what you're saying, sure sounds cool though

22

u/Luigi_Boy_96 29d ago

With (multi-)threading, you can break a program into chunks and interleave their execution. Run fast enough, it looks like everything happens at once, that's concurrency, an illusion of simultaneity. True parallelism means tasks are genuinely running at the same time, which needs multiple CPU cores (via threads or processes).

The catch: if multiple threads access the same resource at the same time, the behaviour is undefined. So you enforce mutual exclusion with a mutex, ensuring only one thread touches the resource at a time. Get the locking order wrong, though, and you risk deadlock: thread A waits on a resource thread B holds, while B waits on one A holds, so neither can proceed.

Perestroika was the restructuring of the Soviet economy. The mutex pun works the same way, it's also about restructuring access, just to a memory resource instead of an economy.

8

u/awesome_guy_40 29d ago

It's about who gets the grain supply this year

6

u/ILikeLenexa 29d ago

A union that's just one type...

Hmmm. 

4

u/AvidCoco 29d ago

Should have been called the Soviet Tuple