this post was submitted on 26 Mar 2025
537 points (97.0% liked)

Programmer Humor

22809 readers
1102 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 1 month ago (6 children)

If what you said were true, wouldn't it make a lot more sense for OP to be making a joke about how even if the source includes multi threading, all his extra cores are wasted? And make your original comment suggesting a coding issue instead of a language issue pretty misleading?

But what you said is not correct. I just did a dumb little test

import threading 
import time

def task(name):
  time.sleep(600)

t1 = threading.Thread(target=task, args=("1",))
t2 = threading.Thread(target=task, args=("2",))
t3 = threading.Thread(target=task, args=("3",))

t1.start()
t2.start()
t3.start()

And then ps -efT | grep python and sure enough that python process has 4 threads. If you want to be even more certain of it you can strace -e clone,clone3 python ./threadtest.py and see that it is making clone3 syscalls.

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago) (4 children)

~~Now do computation in those threads and realize that they all wait on the GIL giving you single core performance on computation and multi threaded performance on io.~~

[–] [email protected] 4 points 1 month ago (3 children)

Correct, which is why before I had said

I think OP is making a joke about python's GIL, which makes it so even if you are explicitly multi threading, only one thread is ever running at a time, which can defeat the point in some circumstances.

[–] [email protected] 3 points 1 month ago

Ups, my attention got trapped by the code and I didn't properly read the comment.

load more comments (2 replies)
load more comments (2 replies)
load more comments (3 replies)