I just discovered a module called threading in Python, and it opened a whole world of doors for me. I'm able to do a lot of things I couldn't do before. But now that I think about it am I limited by my processor threads? I'm using an i7-8700k (6 Cores, 12 Threads) Like every time a start threading a function with Thread(target=func).start() am I using 1 whole "physical" thread? I'd be a little scared to run a program that uses more than the available threads. Will it be a problem?
Asked
Active
Viewed 94 times
2
-
FYI: Some people say "hardware thread" or "processor thread" when they're talking about hyper-threaded processors, but that's not what "thread" means when you say it all by itself. A thread is not a physical thing. A thread is a _virtual_ agent who executes your code. The same hardware that powers your virtual agent potentially can divide its time between your thread and threads in other programs. – Solomon Slow Apr 30 '22 at 12:56
-
yeah thats why i putted physical between " – SRK7Kyros Apr 30 '22 at 12:58
1 Answers
2
No, you are not using a full thread don't worry about that.
You could check this SO topic for more info: How do threads work in Python, and what are common Python-threading specific pitfalls?
Another library that might interest you is asyncio: https://docs.python.org/3/library/asyncio.html

Loïc
- 11,804
- 1
- 31
- 49