vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |
| |||
| 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. |
| |||
| 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. |
| ||||
| 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. |