multicore processing question

Gary Gatten Ggatten at waddell.com
Wed Mar 17 19:31:16 UTC 2010


Thanks for posting the link to GCD.  Interesting info is always welcomed!

Gary


-----Original Message-----
From: owner-freebsd-questions at freebsd.org [mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Adam Vande More
Sent: Wednesday, March 17, 2010 2:17 PM
To: Zepeda, Herbey
Cc: freebsd-questions at freebsd.org
Subject: Re: multicore processing question

On Wed, Mar 17, 2010 at 1:02 PM, Zepeda, Herbey <Herbey.Zepeda at atg.in.gov>wrote:

> Hi,
>
> I'm relatively new to FreeBSD and have had a hard time get to the right
> information relating multicore processing. I hope someone can give me some
> pointers.
>
> I have a two core processor and FreeBSD (latest stable release).
>
> Question:
>
> If I have a c program that creates child processes with fork and exec (in a
> non blocking way), will the child processes be executed by FreeBSD in
> parallel using the different cores without me having to do special
> synchronization arrangements to my program?
>

Well probably...processes are automatically on SMP kernels so a basic
example is if you have 2 cores and 2 processes which are each utilizing 100%
of cpu time, then each process would be assigned to a separate core.
However in practice executions states are much more complicated and both
processes may be assigned to a single core under certain conditions eg one
is in a sleep state.  The short story is this is all handled automatically,
and many applications run just fine without any further tweaking


> Will I need threads instead of processes?
>

Really depends on your need, but in general properly creating threaded safe
applications is significantly harder(at least to my understanding, I don't
do it).  If you need to use this route, you can check out
http://www.osnews.com/story/22152/Apple_Releases_Grand_Central_Dispatch_as_Open_Source

It's available on FreeBSD.

-- 
Adam Vande More
_______________________________________________
freebsd-questions at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"





<font size="1">
<div style='border:none;border-bottom:double windowtext 2.25pt;padding:0in 0in 1.0pt 0in'>
</div>
"This email is intended to be reviewed by only the intended recipient
 and may contain information that is privileged and/or confidential.
 If you are not the intended recipient, you are hereby notified that
 any review, use, dissemination, disclosure or copying of this email
 and its attachments, if any, is strictly prohibited.  If you have
 received this email in error, please immediately notify the sender by
 return email and delete this email from your system."
</font>



More information about the freebsd-questions mailing list