On Fri, Nov 27, 2009 at 8:57 AM, OkaMthembo <zebr...@gmail.com> wrote:
> Thanks, i must admit the concept of the GIL is cloudy to me - for example,
> if the python interpreter on a single machine is
> handling one process and locks until it is done, then on to the next one,
> and so on - isn't that what causes speed issues?

A single interpreter runs in a single process. Within that process,
only one thread can be interpreting Python byte codes at one time. If
a thread is blocked, for example waiting for I/O, another thread can
run. Some C extensions release the GIL so other threads can run
concurrently.

> I was wondering why python can't implicitly handle multiple processes at
> once by using all machine cores (have many threads, each
> invoking the interpreter and handling a process).

Because explicit is better than implicit?

The multiprocessing module allows you to control multiple processes
from Python and do pretty much what you describe above - a Python main
program can create multiple processes, each running a separate
interpreter, all working on a single problem.

> Maybe i should get up to speed on threads first to get the bigger picture?

At least make sure you understand the difference between threads and processes.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to