-2

In C programming…

Are there any libraries out there that parallelizes and synchronizes code without using POSIX threads?

I've heard of OpenMP. But after checking the symbols table of a hello world implementation, I observe OpenMP is just a library built on PThreads.

EDIT
See my comment under @tmyklebu's answer

Igbanam
  • 5,904
  • 5
  • 44
  • 68
  • What platform do you use? Compiler? Compiler version? If GCC you might like [threads.h](http://en.wikipedia.org/wiki/C11_(C_standard_revision)) see also [this question](http://stackoverflow.com/questions/8859394/c11-thread-h-in-gcc) –  Nov 27 '12 at 22:37
  • I'm on a Linux machine, Intel processor - 4 cores, gcc-4.7 – Igbanam Nov 27 '12 at 23:30

1 Answers1

0

I guess my question is "why do you want to avoid pthreads?" pthreads give you a sane and portable interface to the kernel's threading and synchronisation primitives.

With that said, it's often useful to use your platform's native atomic builtins (cmpxchg or LL/SC or what have you) directly, since there is sometimes no reason for the kernel to be involved in your synchronisation.

On Linux, check out the futex system call.

Intel releases this "Threading Building Blocks" thing. AMD has something similar. I've hardly used either so I won't try to comment on them.

MPI is a thing, too.

tmyklebu
  • 13,915
  • 3
  • 28
  • 57
  • yeah, MPI looks promising but I was looking for a threading implementation that wasn't PThreads solely to benchmark that library against PThreads. See PThreads takes some time to acquire locks (even more when spinning). Are these numbers good or bad? No one would know unless there is a competitor which does better or worse; hence the search, hence the question. – Igbanam Nov 27 '12 at 22:09
  • @Yasky if you're looking for benchmark tests on locks, you might want to check [this](http://locklessinc.com/articles/locks/) out. –  Nov 27 '12 at 22:39