3 ms·
Pardon my ignorance, but if you program in multi-threads using a high level language what assurance do you have that the code will run in parallel on the chip l
by budu3 19y ago
Pardon my ignorance, but if you program in multi-threads using a high level language what assurance do you have that the code will run in parallel on the chip level/lower level. Assuming that you're running a multi-core processor, that is.
- jseigh 19y agoIn user space? None, but if the processors aren't doing any other work and your threads are the only available runnable threads then they're likely to get run. As cores become more numerous, the problem will be keeping them occupied. That's why Intel and AMD want you to start writing multi-threaded code. NOW! You're making them look bad with all those cores doing nothing. :)
- pmjordan 19y agoBasically, it depends on your language implementation, and whether its implementation of threading is based on OS/hardware threads (and therefore multiprocessing) or on software ("green") threads. Often if OS threads are supported, it's actually a hybrid solution. There are a number of Common Lisp implementations that support MP, often on only some target OSes, and there are a number that don't. To my knowledge, (I'm not a Python hacker!) vanilla Python doesn't support MP, whereas I suspect that JPython and IronPython support the MP infrastructure that their underlying VMs provide. Software written for green threads may often fail mysteriously on OS thread implementations. Likewise, green-threaded software may need explicit scheduling, which code written for OS threads will generally not be doing.