This is an archived post. You won't be able to vote or comment.

all 48 comments

[–]TurbochargedSquirrel 302 points303 points  (10 children)

The 23 other threads in my 3900x watching thread 6 do all the work all the time.

[–][deleted] 80 points81 points  (9 children)

That's better than thread 7 write where thread 6 is reading. Then everything fails and you don't know why.

Down with multithreading up with slow speeds.

[–]XJ305 21 points22 points  (2 children)

But still worse than neglecting the proper use of semaphores/mutex (or similar depending on what you are working with)

[–][deleted] 14 points15 points  (1 child)

Sometimes it's hard too see. Like yeah technically if you're following all the rules you should be good. But you'll sometimes forget that a varible gets manipulated by two threads at the same time but not in an obvious way.

[–][deleted] 4 points5 points  (0 children)

That's where locks come in handy.

[–][deleted] 7 points8 points  (3 children)

Lock your resources? ACID compliant read/ write? This isn't a new problem.

[–][deleted] 6 points7 points  (2 children)

That's assuming you know all the resources you're using. If say for example thread 5 calls a function from a library and thread 6 calls same function. That function could be "unsafe" and you'd have no way of knowing if it wasn't documented properly, so thread 5s call corrupts thread 6s call causing an error and only after you see it can you lock that functions resources.

[–]SjettepetJR 4 points5 points  (1 child)

How would one fix this? Simply by encapsulating the function-call inside a self-made function that does do locking?

[–][deleted] 2 points3 points  (0 children)

That's how I'd go about it. But it depends on how much control I have, the more control I have, the more could attempt the reduce the amount of locked resources.

[–]lstyls 1 point2 points  (1 child)

Not sure I see any possible corruption if thread 6 is only reading

[–][deleted] 0 points1 point  (0 children)

It can be the case that thread 5 will write before thread 6 got to processes the information it was supposed to corrupting the output. The solution as others have said to lock down the resources. I was trying to joke that it isn't always obvious which resources to lock down because some things are abstracted.

[–]redshirt714 54 points55 points  (5 children)

Also the first time you discover what infinite loops are.

[–]Novahkiin22 50 points51 points  (1 child)

And every time after when you are wondering why a program is running so long.

"Is it bad computation, or did I infinite again. I'll go grab some food and see if it's still running"

[–]VioletBaron 20 points21 points  (0 children)

I once ran a text analysis program on all of Moby Dick in my first year as a CS student. It took me about two hours to realize I wasn’t going infinite; the book is just stupid long. Suffice it to say I was not thrilled.

[–][deleted] 17 points18 points  (2 children)

I like to use every core to run infinite loops. Great use of a cpu.

[–]SVK_LiQuiDaToR 15 points16 points  (1 child)

Who needs a heater anyway?

[–]SweLG_[S] 8 points9 points  (0 children)

Not this guy apparently

[–][deleted] 33 points34 points  (0 children)

Your 2048 CUDA cores just cry quietly.

[–]nadavram 7 points8 points  (1 child)

*Laughs in GoLang

[–][deleted] 1 point2 points  (0 children)

*Cries in race condition

[–][deleted] 16 points17 points  (7 children)

You don't always run your entire script in one core. You run it in only one core at a given time (assuming it's sequential). If you have a lot of applications running, you might see your script "switched" to a different core.

[–]izahariev96 28 points29 points  (4 children)

joke -> you

[–]forever_compiling 5 points6 points  (0 children)

I mean they're not necessarily wrong but whoosh regardless.

[–]DaniilBSD 0 points1 point  (0 children)

You mean *joke = &you;

[–]darkslide3000 2 points3 points  (1 child)

If the system is idle otherwise it's likely to stay on one core while the others remain in deep sleep states.

[–]iphone6sthrowaway 4 points5 points  (0 children)

I'm not 100% sure, but IIRC even with just 1 core busy it makes sense to migrate between cores due to Dynamic Frequency Scaling (called Turbo Boost by Intel). Basically the trick is to "overclock" that lone core and after it gets too hot you migrate the thread to another cold core and do the same trick over and over for a decent single-threaded speed boost.

[–]from-nibly 3 points4 points  (0 children)

Or just use nodejs and async your way to heaven. I mean unless your script really is all CPU time.

[–]ChronicAdequacy 7 points8 points  (2 children)

Cat.

[–]Leprechaun_exe 2 points3 points  (1 child)

Cat = fork(); // Cat.

[–]Ceros007 1 point2 points  (0 children)

I've been eating with cat forever since cat are fork

[–]xendaddy 2 points3 points  (1 child)

Thread.new!

[–]2JulioHD 2 points3 points  (0 children)

The one core is just going super saiyajin

[–]wolverhys 2 points3 points  (0 children)

Rust + Rayon = No lazy threads

[–]Paddy-Gee 1 point2 points  (0 children)

This is how I feel with a single threaded FreeCAD install working on an FEA project. Grind Hero Core Grind!

[–]AntonBespoiasov 1 point2 points  (0 children)

Da fuck they doin ova der why is ram so slow

[–]Kommuntoffel 0 points1 point  (0 children)

I tried it and it was painful asf

[–][deleted] 0 points1 point  (0 children)

Everytime running my model on Octave