Date: Wed, 17 Mar 2010 14:16:48 -0500 From: Adam Vande More <amvandemore@gmail.com> To: "Zepeda, Herbey" <Herbey.Zepeda@atg.in.gov> Cc: freebsd-questions@freebsd.org Subject: Re: multicore processing question Message-ID: <6201873e1003171216q40e102dev23b6059f22e92b8@mail.gmail.com> In-Reply-To: <C6A52E61C3F4D343A9AE1268D8FD359303CE566CCA@atgind05f-as026.atg.in.local> References: <10E075E52DED228526F5ECAB@utd65257.utdallas.edu> <4BA10BEA.1060303@wallnet.com> <C6A52E61C3F4D343A9AE1268D8FD359303CE566CCA@atgind05f-as026.atg.in.local>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 17, 2010 at 1:02 PM, Zepeda, Herbey <Herbey.Zepeda@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6201873e1003171216q40e102dev23b6059f22e92b8>