Embedding and threads ?

Martin v. Löwis loewis at informatik.hu-berlin.de
Mon Jun 3 14:19:19 CEST 2002


Bo Lorentsen <bl at netgroup.dk> writes:

> Pseudo, is because it can't really take advantage of SMP (or the system
> process scheduler), and its the software that controlles the
> "scheduling".

Yes, it can't make use of threads, but no, it is not (necessarily)
software scheduled. Python gives up the GIL when executing byte code
every so many instructions; it is the the choice of the operating
system to schedule then next thread to run. If not executing byte
code, each Python thread gives up the GIL when starting a long-running
operation (such as a blocking OS call).

So under normal conditions, on a single processor, with enough
runnable Python threads: the processor will always be busy, and all
threads will make progress. You can hardly ever tell the difference to
free threading.

Regards,
Martin




More information about the Python-list mailing list