Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > comp.unix.bsd.openbsd.misc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-02-2008, 05:03 AM
ttsiodras@gmail.com
 
Posts: n/a
Default 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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-02-2008, 05:03 AM
Marc Espie
 
Posts: n/a
Default Re: Are OpenBSD threads (pthreads) using more than one core of multicoreCPUs?

In article <d4cfbe5e-5c1c-4cad-a9eb-6f13d16ee689@e39g2000hsf.googlegroups.com>,
<ttsiodras@gmail.com> 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-02-2008, 05:03 AM
ttsiodras@gmail.com
 
Posts: n/a
Default 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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-02-2008, 05:03 AM
Marc Espie
 
Posts: n/a
Default Re: Are OpenBSD threads (pthreads) using more than one core ofmulticore CPUs?

In article <d228f536-768f-47af-a3b1-f7216833c8b5@y38g2000hsy.googlegroups.com>,
<ttsiodras@gmail.com> 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62