Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
  1. POSIX thread (pthread) and OpenMP are both libraries for thread programming. But is it right that they are not native to Linux, i.e. they have to be installed by user later?

    If yes, what are the native library or functions in Linux? Are they used to implement pthread and OpenMP?

  2. To draw a parallel comparison to process programming, if I am correct, functions fork(), exec*(), waitpid() and pipe() are offered natively by Linux, while MPI is not. Is MPI implemented in those native functions for process programming?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

What do you meant by “non-native”? There isn't a clear definition of “installed by default”, since each distribution has its own default set of installed packages and it's very easy to tune that set.

POSIX threads are part of GNU libc, which is a fundamental part of any non-embedded Linux systems (there are substitutes for small systems, I think the major ones also include pthread support). The Linux kernel itself includes support for threads. It's not exactly pthread, but the distinction between what's supported by the kernel alone and what's supported by the standard library on top of the kernel is rarely useful.

OpenMP comes through GOMP, which is part of gcc. Unlike the standard library (Glibc), it's possible to have a normal Linux system without libgomp installed.

There are several implementations of MPI for Linux, including MPICH and OpenMPI. There are normal Linux systems without those, too.

Everything is ultimately implemented on top of system calls, i.e. the functionality provided by the kernel. MP, MPI and other libraries are implemented in terms of system calls for process management, interprocess communication (pipes, sockets, shared memory, …) and multithreading (locks, conditions, …).

share|improve this answer
    
Thanks! (1) The system calls for multithreading (locks, conditions, …) are not in the Wikipedia article you linked. I was wondering if you meant they are provided by pThread or the thread support by the Linux kernel? (2) Is OpenMP implemented based on pThread or the thread support by the Linux kernel? –  Tim Aug 1 '11 at 23:41
    
@Tim Most of the difficult bits of pthread are provided by the kernel. POSIX specifies the pthread API. –  Gilles Aug 1 '11 at 23:55
    
Thanks! "Everything is ultimately implemented on top of system calls,... MP, MPI and other libraries are implemented in terms of system calls for process management, interprocess communication (pipes, sockets, shared memory, …) and multithreading (locks, conditions, …)." I was wondering in Linux, what are some system call functions for "multithreading (locks, conditions, …)"? Are these system calls for multithreading used to implement pThread library? –  Tim Aug 5 '11 at 12:16
    
@Tim Most of the pthreads functions are implemented by system calls. –  Gilles Aug 5 '11 at 19:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.