Will multithreading make python less popular?

Mensanator mensanator at aol.com
Fri Feb 20 15:47:12 CET 2009


On Feb 20, 4:36�am, sturlamolden <sturlamol... at yahoo.no> wrote:
> On Feb 20, 12:19 am, Mensanator <mensana... at aol.com> wrote:
>
> > What am I actually seeing? If Python only uses one of the cores,
> > why do both light up?
>
> Because of OS scheduling. You have more than one process running. The
> Python process does not stay on one core. Try to put CPython into a
> tight loop ("while 1: pass"). You will see ~50% use of both cores. If
> you had 4 cores, you would see ~25% use.

Saw that once when I had access to a four core machine.

>
> > Is everything much more complicated (due to
> > OS scheduling, etc.) than the simple explanations of GIL?
>
> No.

Don't you mean "yes"?

> Your Python code cannot use more than one core simultaneously.
> It's just that scheduling happens so fast and so often that you don't
> notice it.

Or that the Task Manager can't track the switches fast
enough to show the interleaving giving the illusion that
both cores are operating simultaneously.



More information about the Python-list mailing list