[openbeos] get_system_info() under Haiku question
- From: Zenja Solaja <solaja@xxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Sun, 30 Oct 2005 23:24:29 +1100
Hi. I'm working on a app which needs a worker thread which will run several
batch jobs in the background. Originally my design had multiple threads, but
I faced the possibility of thread explosion, so I've decided to have only a
limited number of threads which work on individual batches, and when free
grab the next batch from a pool of jobs. Ideally, I should query the system
to see how many CPU's are available, and spawn that many threads to handle
the batch jobs.
Using the B_API, I can interrogate the kernel to find the number of CPU's,
using the get_system_info() function. This function returns the system_info
structure, which has a member called cpu_count.
The question to Haiku - can the system differentiate SMT systems
(hyperthreading)? Will cpu_count be equal to 1 or 2. What about dual core
CPU's? Apple now have the QuadPowerMac, which is 2 dual core CPU's (hence,
quad). Will cpu_count report 4? Theoretically, we might even see a dual core
hyperthreaded machine - will cpu_count return 4 for a single physical CPU?
Finally, how about a SMP Dual core HT enabled system (8??)
The entire point of this post is that application developers might want to
know how many threads they can spawn. Can we rely on using get_system_info()
and cpu_count to configure the optimal number of threads running on the
system. For my particular application (which is very parallel), it makes
perfect sense to spawn another thread if the resource is available.
- Follow-Ups:
- [openbeos] Re: get_system_info() under Haiku question
- From: Axel Dörfler
- [openbeos] Re: get_system_info() under Haiku question
- From: Alexander G. M. Smith
Other related posts:
- » [openbeos] get_system_info() under Haiku question
- » [openbeos] Re: get_system_info() under Haiku question
- » [openbeos] Re: get_system_info() under Haiku question
- » [openbeos] Re: get_system_info() under Haiku question
- [openbeos] Re: get_system_info() under Haiku question
- From: Axel Dörfler
- [openbeos] Re: get_system_info() under Haiku question
- From: Alexander G. M. Smith