Subj : Re: Adding thread support for C... To : comp.programming.threads From : Charles Bryant Date : Tue Aug 02 2005 10:07 pm In article <11e7ega4au2v143@corp.supernews.com>, Mayan Moudgill wrote: ... adding features to C for multithreading ... >- you have to push performance; since, IMO, high-level APIs are usually >bad performers compared to low-level APIs, we tend to expose a lot more >low-level APIs to people. >- we're working in an unusual architecture; clusters of 8 way hardware >multi-threaded, real-memory only, no data-cache processors. In this >envirnoment, standard multi-threading is, IME, sub-optimal. I think it would be a big mistake to add special support for things like memory barriers and atomic operations to C. With lock and unlock operations, POSIX threads provides enough to write correct code. If you measure the performance on a particular platform, and find it inadequate, then you can try to write platform-specific code which implements the required operations more efficiently. However, it would be wrong to assume that, for example, an atomic increment operation must be faster than a lock/increment/unlock sequence, when it might be slower. Similarly, a memory barrier might be slower than using a lock. It all depends on what the hardware provides. If such operations were added to C it would add a burden to every C implementation without making it any easier to write faster code. .