AndrasKrigare

joined 2 years ago
[–] AndrasKrigare@beehaw.org 1 points 4 days ago

I haven't heard of that being what threading is, but that threading is about shared resourcing and memory space and not any special relationship with the scheduler.

Per the wiki:

On a multiprocessor or multi-core system, multiple threads can execute in parallel, with every processor or core executing a separate thread simultaneously; on a processor or core with hardware threads, separate software threads can also be executed concurrently by separate hardware threads.

https://en.m.wikipedia.org/wiki/Thread_(computing)

I also think you might be misunderstanding the relationship between concurrency and parallelism; they are not mutually exclusive. Something can be concurrent through parallelism, as the wiki page has (emphasis mine):

Concurrency refers to the ability of a system to execute multiple tasks through simultaneous execution or time-sharing (context switching), sharing resources and managing interactions.

https://en.m.wikipedia.org/wiki/Concurrency_(computer_science)

[–] AndrasKrigare@beehaw.org 4 points 5 days 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.

[–] AndrasKrigare@beehaw.org 3 points 5 days 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.

[–] AndrasKrigare@beehaw.org 14 points 5 days ago (8 children)

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.

[–] AndrasKrigare@beehaw.org 7 points 1 week ago

When I was over there, everyone assumed I was Canadian. I asked a tour guide about it at one point, and he said that it's just a safer assumption: if they guess American and are wrong, Canadians can get a little offended. But if you guess Canadian and are wrong, Americans tend to just be amused.