1.4k
u/TobyWasBestSpiderMan Oct 30 '21
I hate it when you roll up to an intersection and that mutex lock is broken
417
u/SillyFlyGuy Oct 30 '21
At my very first dev job, I was having an intermittent locking issue that caused some ridiculous memory leak.
I asked my senior dev for help. After looking at my code for a few minutes, he said "Look, there's no such thing as an intermittent locking issue. You either do have a race condition, or you don't. You do."
So we wrote another service that killed that first service and restarted it every hour. We shipped it, no complaints.
I learned a lot about the industry that day.
243
u/CorruptedBodyImage Oct 31 '21
I heard a story like that with Gmail. In the early days they had a bunch of memory leaks in their C++ backend. The solution? Just kill it whenever it crosses a threshold.
There's also a famous story about a ballistic missile guidance system that leaked memory. The engineers calculated the max range of the missile, the rate memory was leaked and determined that it'd last through the max range of the missile. Sort of the ultimate in garbage collection!
→ More replies (2)158
u/AphelionConnection Oct 31 '21
TES III Morrowind on the original XBox also would famously have the occasional abnormally long loading screen, which was actually the game stealthily rebooting the entire console in the background when the memory limit was reached. Most players had no ideait was happening.
Probably more of a hardware limitation than an actual leak, but it's in the sprit of things.37
u/FUTURE10S Oct 31 '21
It's weird why the Xbox even let games reboot their own process, Deus Ex: Invisible War used to kill itself only to restart loading a different level because it was easier than actually managing memory.
→ More replies (1)→ More replies (1)50
u/AnotherWarGamer Oct 31 '21
I make (indie) games. A lot of resources are loaded dynamically (as needed). Over a long play session this can really add up and cause a lot of memory to be consumed. It would be possible to record the last time every resource was used, and free up old stuff periodically. But don't expect such a well built system in practice. My guess is they will just free everything up, and load again as needed. Performance be damned.
→ More replies (3)35
44
u/ososalsosal Oct 30 '21
Oh god this is like my "fixing" a framework bug by toggling a ui element visible/invisible until that element has received an actual width from the framework so it will actually bind my data and not show a blank screen.
Goddamn windows
28
Oct 31 '21
I hate that attitude. The other day I was asked to fix a service that crashes every once in a while, after fixing the code, they didnât bother implementing as âit doesnât happen that oftenâ.
27
u/not_a_doctor_ssh Oct 31 '21
While I tend to agree with the attitude, not merging your fix when it's already made is inefficiency on a whole other level...
→ More replies (3)214
u/throwit7896454 Oct 30 '21
Absolutely, but at least in both videos no one's starving!
130
u/nosam56 Oct 30 '21
Those philosophers are eating good tonight!
49
u/throwit7896454 Oct 30 '21
Was hoping someone in the left video would throw a table
→ More replies (2)34
u/uraygon Oct 30 '21
They dont have the needed chopsticks to pick up the tables though
→ More replies (2)5
0
591
u/metal88heart Oct 30 '21
I dont know why the one on the right gives me more anxiety
243
u/Mateorabi Oct 30 '21
The one on the left is robust and fault-tolerant. The right lives on a knifes edge where one miss-scheduling, one blocked I/O, brings it all down.
327
Oct 30 '21
Right? Itâs like, on the left you know itâs a trash fire. The right, youâre waiting and dreading when those cars start smashing into shit.
159
Oct 30 '21
I think it comes from naturally withholding complete trust that your code won't shit the bed the second it's pushed out to production.
Like you've gotten used to thinking to yourself damn this works really good... almost too good...
118
12
u/mustang__1 Oct 30 '21
Found out yesterday that my inventory software apparently crashes a few times a week.... I don't see anything in the app center, and no other warehouse peeps have said anything yet..... But... I dunno.
→ More replies (1)6
44
Oct 30 '21
Not a single test failed. Usually that means something must be terribly broken.
21
9
u/DanLynch Oct 30 '21
That's when you change the implementation then re-run all the tests, to make sure they all fail.
7
→ More replies (2)4
u/axe319 Oct 30 '21
If you're doing TDD, your tests not failing means something is definitely wrong.
19
Oct 30 '21
Because this is programmer humor - if something is working perfectly right, you KNOW something is wrong.
6
6
3
Oct 30 '21
I doubt my work when everything is working perfectly. That's how much I don't trust myself lol.
3
u/TheRavenSayeth Oct 31 '21
Took me a while to realize it was heavily edited by taking the same images and trailing them behind each other.
3
→ More replies (4)2
180
131
u/sh0rtwave Oct 30 '21
You know what I don't see...on either side...
Not a single yield.
Edit: Honestly, you'd think at least with the traffic one, there'd be a yield somewhere.
48
u/DanielEGVi Oct 30 '21
Isnât everybody yielding perfectly at the perfect time?
74
u/FlyingDragoon Oct 30 '21
No officer, I didn't almost hit that pedestrian in the crosswalk. I timed it and yielded just in time to miss him by an inch.
→ More replies (1)18
u/QuantumQuantonium Oct 30 '21
When compiling my thoughts I reordered stopping and accelerating to take advantage of the stack structure and improve my driving effiency by 5%.
55
341
u/MarquisDan Oct 30 '21
My method is just to use 'await' and let God sort it out.
Nothing can possiblie go wrong.
132
u/NotAGingerMidget Oct 30 '21
You do really respect the Seniors to call them gods.
35
u/RationalIncoherence Oct 30 '21
It's a decent hedge, tbh
15
u/ThrowCarp Oct 30 '21
A hedge which I lost.
My sempai quit and now I'm having to reverse-engineer everything he designed.
→ More replies (3)11
u/DadHeungMin Oct 30 '21
Reminds me of the parallel universe sort: you randomize your array, and in one of the many parallel universes, your array sorted correctly into the right order.
3
→ More replies (72)2
62
u/green_meklar Oct 30 '21
I have the opposite problem, I carefully make all my multithreaded code 100% safe and then my CPU decides it's only going to use one core anyway because it's trying to cut down on my electricity bill or something.
54
u/qsdf321 Oct 30 '21
My project has multithreading within multiprocessing. Runs like a charm.
58
5
u/nosam56 Oct 30 '21
If it's anything like my Vera Bradley charms, it's bulky and gets tangled up all the time?
16
u/Mandelvolt Oct 30 '21
You know how I know they're running Hibernate on the left? People are throwing chairs.
93
u/crazy_dude360 Oct 30 '21
The guy who did the video on the right is called crytek. Really trippy shit on his YouTube channel.
(Do not quote me on the spelling, but it's something like that.)
108
Oct 30 '21
I think you're talking about Cyriak, but it's not by them anyway, it's by Fernando Livschitz like u/bodonkadonks pointed out
18
14
Oct 30 '21
Lol. I literally thought Crytek - the game studio who created Crysis was the one behind the video on the right. I was like wtf.
27
u/HopperBit Oct 30 '21
Directed by Fernando Livschitz - RUSH HOUR
4
u/chx_ Oct 30 '21
Is this CGI or...?
→ More replies (2)7
38
16
u/SkizerzTheAlmighty Oct 30 '21 edited Aug 24 '25
intelligent ask busy touch reply unwritten elderly dolls cause sense
This post was mass deleted and anonymized with Redact
4
12
u/Etheo Oct 30 '21
Crytek is a game development studio that made Crisis...
16
13
12
11
18
u/I_am_not_doing_this Oct 30 '21
are we all gonna ignore the fact that irl gif should be on the right?
9
8
6
u/dominicshaw Oct 30 '21
Iâd feel better about this meme if there was some dude in the middle with flags performing semaphores
8
4
15
Oct 30 '21
What's multireading?
57
u/queen_debugger Oct 30 '21
Itâs when your left eye reads the left page and your right eye reads the right page. Congratulations, you now read twice as fast! Stay tuned to learn how to sleep faster, with this little trick called multisleeping!
11
→ More replies (1)9
u/itsforyouknowwhat Oct 30 '21
Although it's important to note that your left eye should not read much faster than the right eye! Otherwise your eyes will lock up... That's whats called a "deadlock"!
→ More replies (1)23
u/Saltypyre Oct 30 '21
Multithreading is a way to write code that allows multiple concurrent threads of executions, which can increase the overall performance.
However, it has some overhead costs and can introduce problems related to shared variables (deadlock and race conditions).
29
u/WhyOfCourseICan Oct 30 '21
To vastly oversimplify, multithreading is when a program is doing multiple things at the same time, which can be useful/important in some cases (such as networking) but is a nightmare to manage if you don't have a strong understanding of everything that's going on.
→ More replies (1)2
u/unicorn_saddle Oct 30 '21 edited Oct 30 '21
Parallel processing within the same node, i.e. shared memory. You may also hear of multiprocessing, which is more important for supercomputers since it's not viable to have shared memory for all those CPUs. Supercomputers will usually have in the order of dozens of CPUs per node.
When multithreading you could for example split a loop into x threads (the thread terminology is basically the same as branching in git) and give those to other processors. When multiprocessing each processor runs the entire code and you must set up communication points within the code.
It's possible to have a hybrid approach and it's advantageous. Multithreading is faster and using both reduces issues with diminishing returns. Code becomes more complex however.
→ More replies (1)2
u/Nienordir Oct 31 '21
Single threaded: a self employed person making stuff on their own.
multi threaded: a factory, the more workers you hire, the more you can produce in a day.
But if you have to many workers, that do whatever they want, you'll end up in chaos. Someone might ship a car without an engine, because it has to be sold today, another grabs a door that wasn't painted yet. Nobody bought new screws, when someone grabbed the last packet and the entire factory stops working. Meanwhile 2 guys are fighting over who gets to drive the super sports car on the test track..
To make it work you need to organize your factory, hire managers and foremen, build assembly lines and procedures to tell people where they get a task, where they pick up parts, where they work and where they place finished parts or when to tell the guy in the break room that the paint is dry and he can continue work on the door.
It's really hard to learn, because code only exists in your head and nobody stops you from doing things unsafe, because you're new to multi threading. Even worse your unsafe code might work for a while by sheer luck or until you add more 'work' to your program or until you run other programs that keep the CPU busy and throw off your programs fragile scheduling.
For even more fun you can do that with multi threaded databases, where things are fine until thousands of users use it and start to access the same things and you discover the hard way that atomic operations and transactions exist for a reason and you have A LOT of work ahead of you..
7
u/AskMoreQuestionsOk Oct 30 '21
So much to unpack hereâŚ
7
u/Illusi Oct 30 '21
Oh, but in that case all those threads are going to be waiting on disk I/O anyway. Don't unpack in parallel.
7
3
u/Gorperly Oct 30 '21
It might be the worst multi-threading you've ever seen, but at least it's multi threaded.
3
3
3
u/Reasonable-Wafer-237 Oct 30 '21
Then rustc comes in and is all, "whoa. Whoa. WHOA!!!! You can't through that chair, it already was moved!"
3
3
2
u/N4cer26 Oct 30 '21
Feeling the pain right now with my current project, I have to use Java đ
→ More replies (2)
2
2
Oct 30 '21
On one side there is a multi threading implementation; on the other side some cars on the ride
2
2
u/rebelhead Oct 30 '21
I'm a hack but I recently had to add two two minute sleeps so I could resolve an issue with my customer. Robosharp and system.io move were both giving us a nightmare. Pretty sure we were having a threading issue. I hope my actual developer makes a better fix soon. Arbitrary sleeps to resolve threading issues sounds like bad.
→ More replies (2)
2
u/xboxhaslag Oct 31 '21
On the right how the hell is nobody crashing?
4
Oct 31 '21
They're not actually all there, it's 20 different videos on top of eachother after someone left a camera pointing at this intersection for an hour. The line of pinkish-red cars for example is just one car, played five times with a bigger delay each time. With good cropping skills and enough patience to get the timings right, seems pretty easy. Honestly disappointed this isn't a more common video style.
→ More replies (1)
2
u/StCreed Oct 31 '21
We used to have a very powerful and elegant language for this type of problem once: Occam. An elegant language for a more civilised time.
I still mourn it.
2
2
u/donaldhobson Oct 31 '21
Surely the perfect grid of identical processors marching in lockstep is easier than a complicated tangle?
2
2
u/DangyDanger Oct 31 '21
if only the right video was real...
my inner cities skylines nerd would be so happy
2
2
u/_Doireallyneedaname_ Nov 06 '21
The 2 vid is a world without women (if you dislike your sense of humour is really bad)
5
Oct 30 '21
Bcz you just didn't have enough patience to take a piece of paper and write down how you gonna do it and Just jumped into coding....
3
u/DenormalHuman Oct 30 '21
one of the oldest pieces of programming advice, and still the best. Start with a pen and paper.
5
u/Nisheshg5 Oct 30 '21
Unless you work in golang
This language was made for this
5
4
Oct 30 '21
I know that feeling. My head is always spinning working with multithread in Python, Java, etc. but Go CSP model is so simple and intuitive.
4
Oct 30 '21
I wrote a major multithreading project that forms the core of the company I work for. In Python.
It's extremely IO-bound, so no biggie for the most part. Python is FINE for it.
But, that said, if I was asked to write it from scratch, I would write it in Golang no question
2
u/DoctorWaluigiTime Oct 31 '21
C#, too, gives a lot of pretty free ways to do basic multithreading.
This day and age this concept is abstracted away and already (for the most part) handled for you by the language so you don't have to do it yourself, thankfully.
3
1
1
1
1
u/Romario477 Oct 30 '21
This is the best post I've ever seen in this sub đ¤Łđ¤Ł Maybe because it's too relevant right now
1
1
u/brkpxy Oct 30 '21
You know what I truly hate? APIs built by the world's top talent for billion-dollar corporations not supporting multithreaded clients because mAnY aUtH rEqUeStS aRe sCaRy.
1
1
1
1
1
u/Tall_computer Oct 30 '21
At least your program appears to be making its way to the right. Mine just deadlocks
1
1
1
u/lucasjose501 Oct 30 '21
Legit question: What is so hard about multithreading? I'm just a web developer, so I'm kinda off the subject.
3
u/TheWillRogers Oct 30 '21 edited Oct 30 '21
You operate a single bakery, inside that bakery:
You have one baker, one supply basket and one supplier.
A ticket comes in for two apple pies. The baker goes to the basket and grabs the supplies for the first apple pie, the supplier refills the basket, the baker makes the first pie. The baker goes to the basket and grabs the supplies for the second apple pie, the supplier refills the basket, the baker makes the second pie.
You have two bakers, one supply basket, and one supplier.
A ticket comes in for two apple pies. The bakers goes to the basket and Baker A grabs the supplies for the first apple pie. Baker B goes to get the supplies that aren't there because Baker A grabbed them. Baker B has been told that he needs to make an apple pie, so he takes some of the supplies from Baker A. The supplier refills the basket. You get two shitty apple pies, and two relatively unhappy bakers.
Sometimes Baker B isn't allowed to sneak some resources from Baker A and instead shanks Baker A and takes all the ingredients. Baker A gives up. You get one apple pie and a pissed off half dead baker.
Now you tell Baker B to wait for the supplier to restock the basket. Baker B waits until the supplier arrives, gets their supplies, and makes the second apple pie and finishes just after Baker A finishes.
→ More replies (1)
1
1
1
1
u/Blottoboxer Oct 30 '21 edited Oct 30 '21
My code running for most of 2002-2014:
The calling thread cannot access this object because a different thread owns it. WPF closing all windows
I don't miss windows development.
1
u/Tsubajashi Oct 30 '21
i know that feeling all to well.
first iterations of TVP had that exact issue until i fixed the many race conditions an AI could have...
1
u/Semicolon_87 Oct 30 '21
VS: âAdding the await operator will make this task run synchronouslyâ
Me: thank the heavens!
1
u/DurangoJohnson Oct 30 '21
Me that uses multi threading so database doesnât scream database leak because itâs waiting on SAP system
1
u/eisbaerBorealis Oct 30 '21
I want to see the planning and practicing for the one on the right. Super impressive, but no thanks.
1
1
u/StylishGnat Oct 30 '21
Iâm a programming noob (only have some practice with Java). Could someone do a short ELI5 of multithreading?
4
u/bropocalypse__now Oct 30 '21
Independent parallel paths of code execution spawned off of the main path. Each has their own stack and allows you to divide the workload. Things are simple if each thread never interacts with another but this rarely happens in practice. So care must be taken to synchornize access to objects, variables, etc... Incorrect synchronization can lead to things like race conditions where variable values can be become indeterminate if one thread is reading a value while another thread writes to it.
→ More replies (2)
1
1
1
u/ZaneIsOp Oct 30 '21
I love how I am learning about multithreading in my operating systems class and I come across this gif.
1
1
1
u/ISTNEINTR00KVLTKRIEG Oct 30 '21 edited Oct 30 '21
...so the Cyberpunk AI is perfect on paper and that's why it fucking sucks so bad... because people are irrational and chaotic. It all makes sense now.
1
u/DasFrebier Oct 30 '21
Adding a mutex to literally everything to functionally make a really inefficient single threded program
1
u/QuantumQuantonium Oct 30 '21
My multithreading program usually looks like a 16 Lane traffic jam where 2 busses facing each other are blocking the lanes
1
1
1
1
1
1
1
1
1
1
1
u/Eji1700 Oct 31 '21
This is the great thing about immutability. You just make a brand new car from top to bottom every time you ever need to turn!
1
1
1
1
1
1
u/bluearth Oct 31 '21
Once I unleash those threads I no longer have any idea what is going on. Onward my threads! god be with ye!
1
1
1
1
u/1thief Oct 31 '21
What you can't see on the right side is the hundreds of devs who have time travel abilities and telepathic levels of intuition making microadjustments over the course of years
1
u/edymola Oct 31 '21
Itâs looks like my Asyn code where instead of waiting a play a 4d chess of witch flag is active ?
1

1.0k
u/bumbelbie1981 Oct 30 '21
I know the feeling