[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: General question about GNUStep
From: |
David Chisnall |
Subject: |
Re: General question about GNUStep |
Date: |
Thu, 27 Aug 2009 13:37:52 +0100 |
Hi Simeon,
On 27 Aug 2009, at 08:54, Simeon Mitev wrote:
Nice Nicola,
Thank you for the good presentation!
I have got answers for some of my questions. What I am still
interested in is multi threading support in objC compiler and
runtime. While the server application will run on unix with 2 quad
core processors I will definitively need to use multi threading to
get a real benefit from the hardware. In C++ I can use also openMP (http://openmp.org/wp/
) in example. Thoughts ?
OpenMP is intended to allow things like loops to be parallelized
across threads. It defines a series of pragmas that the user can use
to provide hints to the compiler. If you are going to use it, make
sure you understand the characteristics of the target machine. It is
very easy to use OpenMP to make slower code than without using it if
you do not understand the target's memory architecture, cache
coherency model, and scheduling system.
Hyperthreading is Intel's brand name for their chip multithreading
implementation, which splits the execution units between two
contexts. You absolutely and categorically do not want to be using
OpenMP to parallelize loops like the one you gave as an example on a
machine with hyperthreading, because it is likely to have very few
cache misses (the compiler should be inserting prefetch instructions
at the right points in the loop) and so you will just be confusing the
operating system scheduler and starving one of the threads of
execution units.
There are currently two Objective-C compilers that you can use with
GNUstep; gcc and clang/llvm (llvm-gcc only works on OS X). GCC
supports OpenMP, Clang does not. Clang supports a number of Objective-
C 2 constructs (e.g. fast enumeration, declared properties), GCC does
not.
OpenMP attempts to implicitly create threads for you. You can, of
course, explicitly create threads if you wish. At the lowest level,
you can use the POSIX theading APIs. GNUstep provides NSThread on top
of these, which gives a simpler abstraction, along with a number of
support classes, like NSLock, NSCondition, and so on. You can also
use Distributed Objects between processes or threads, which provides
quite a heavy-weight system for concurrency. If your program consists
of largely-independent parts, then you should consider splitting it
into different programs and using DO for communication. This makes it
easy to add fault tolerance (you can easily restart a crashed process;
a crashed thread will kill the whole program) and lets you scale to
multiple machines in a cluster in future.
EtoileThread is part of EtoileFoundation, and provides another
abstraction using higher-order messaging. You can read a bit more
about it here:
http://etoileos.com/news/archive/2008/07/29/0231/
David
- Re: General question about GNUStep, (continued)
- Re: General question about GNUStep, Jamie Ramone, 2009/08/25
- Re: General question about GNUStep, Simeon Mitev, 2009/08/26
- Re: General question about GNUStep, Richard Frith-Macdonald, 2009/08/26
- Re: General question about GNUStep, Nicola Pero, 2009/08/26
- Re: General question about GNUStep, Simeon Mitev, 2009/08/27
- Re: General question about GNUStep, Simeon Mitev, 2009/08/27
- Re: General question about GNUStep, Nicolas Roard, 2009/08/27
- Re: General question about GNUStep, Simeon Mitev, 2009/08/27
- Re: General question about GNUStep, Andreas Höschler, 2009/08/27
- Re: General question about GNUStep, Nicola Pero, 2009/08/27
- Re: General question about GNUStep,
David Chisnall <=
- Re: General question about GNUStep, Simeon Mitev, 2009/08/27
Message not available
Re: General question about GNUStep, Michael Thaler, 2009/08/25