[Top][All Lists]

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

Re: General question about GNUStep

From: Simeon Mitev
Subject: Re: General question about GNUStep
Date: Thu, 27 Aug 2009 17:02:16 +0200
User-agent: Thunderbird (Macintosh/20090812)

Thank you David,

This is what I wanted to know and your answer is what I wanted to hear.

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.

Yes, the target machine is well known, it is based on Intel x64 quad core processors, that's why I am thinking how to get the maximum from the hardware.

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.

I will go through OpenMP's documentation once again. For me is more important to generate native for the target machine code.

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:



Thank you for your help David. It looks like I will consider to use GNUStep Base and environment for the server development, Google Protocol Buffers as communication protocol and XCode (Apple, Objective C) for client application development. The database will be either Firebird or BerkeleyDB. I am still concidering whether to use universal relational database or heavily customized embedded object oriented database engine.

// Simeon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]