NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: optimize for multicore processors



On Mon, Nov 09, 2009 at 04:11:09PM -0800, Byron Servies wrote:
> 
> On Nov 9, 2009, at 3:34 PM, Matthias Scheler wrote:
> 
> >On Mon, Nov 09, 2009 at 09:21:54AM -0200, Otavio Augusto wrote:
> >>For extract more performace in multiore machines I need a specific
> >>technique or an multi-thread programming is sufficient ?
> >
> >A multi-threaded application is one way to achive scalability to
> >multiple CPU cores. Using multiple processes is another one.
> >None of the two approach is however guaranteed to be succesful.
> >You e.g. need to partition the problem that your software is
> >trying to solve properly.
> 
> Matthias hits on the salient point: once you have your program divided
> in to parts that can run independently of each other to achieve a common
> goal, the rest is just technique.
> 
> Take care of that first.  Then worry about whether you are using  
> processes or
> threads and how those processes or threads are created.

In particular, it is useful to partition the data between the
threads, and think of explicit communication between them,
rather than cooperative manipulation of shared data.  The latter
method is the traditional multi-threading approach, but it is
difficult and error prone, and requires careful design and
ordering of locks.  The more work your threads can do on "local"
data, without having to interact with other threads, the more
efficient and "scalable" your code will be.

Cheers,

-- 
Andrew


Home | Main Index | Thread Index | Old Index