Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs? - BSD

This is a discussion on Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs? - BSD ; I recently installed OpenBSD 4.2 on my Core2Duo 4500. Naturally, I used the bsd.mp kernel, to make use of both cores of my CPU. Indeed, I found out that if I spawn two CPU-intensive processes, they are allocated on different ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs?

  1. Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs?

    I recently installed OpenBSD 4.2 on my Core2Duo 4500. Naturally, I
    used the bsd.mp kernel, to make use of both cores of my CPU. Indeed, I
    found out that if I spawn two CPU-intensive processes, they are
    allocated on different cores, and thus make full use of my CPU. Good.

    When I tried the same test using pthreads, however, I found out that
    both threads were allocated on the same core. It appears that threads
    are not "dispersed" amongst different cores, and are thus not getting
    any benefit from my dual core CPU.

    What am I doing wrong?

  2. Re: Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs?

    In article ,
    wrote:
    >When I tried the same test using pthreads, however, I found out that
    >both threads were allocated on the same core. It appears that threads
    >are not "dispersed" amongst different cores, and are thus not getting
    >any benefit from my dual core CPU.


    That is correct.

    >What am I doing wrong?


    You don't understand things, that's all.

    pthreads is a purely userland threads library, there's no way it can
    distribute threads among different processors because the kernel doesn't
    even know about those threads.

  3. Re: Are OpenBSD threads (pthreads) using more than one core ofmulticore CPUs?

    Thanks for clearing it up, Marc.

    As a side note, however, allow me to point that this sounds like a
    severe
    limitation for an OS - we are living in the multicore era. Both Linux
    and Windows
    are able to allocate threads to different cores automatically, where
    as apparently
    OpenBSD can only do things in parallel if you "fork". A lot of
    packages are
    using threads...

    Just my 2c.

    Thanassis.

    On Apr 30, 3:17 pm, es...@lain.home (Marc Espie) wrote:

    > You don't understand things, that's all.
    >
    > pthreads is a purely userland threads library, there's no way it can
    > distribute threads among different processors because the kernel doesn't
    > even know about those threads.



  4. Re: Are OpenBSD threads (pthreads) using more than one core ofmulticore CPUs?

    In article ,
    wrote:
    >Thanks for clearing it up, Marc.
    >
    >As a side note, however, allow me to point that this sounds like a
    >severe
    >limitation for an OS - we are living in the multicore era. Both Linux
    >and Windows
    >are able to allocate threads to different cores automatically, where
    >as apparently
    >OpenBSD can only do things in parallel if you "fork". A lot of
    >packages are
    >using threads...


    Threaded programming is difficult, and very hard to get right, and fraught
    with security issues...

    That said, kernel-mode threads are on the todo-list of some people.
    They're not ready yet.

+ Reply to Thread