...

/

POSIX Threads

POSIX Threads

Learn how parallel programming is a complex affair and get introduced to the POSIX thread library as the first of many tools we want to talk about.

Multithreading

The threads model of parallel programming is one in which a single process (a single program) can spawn multiple, concurrent “threads” (sub-programs). Each thread runs independently of the others, although they can all access the same shared memory space (and hence they can communicate with each other if necessary). Threads can be spawned and killed as required, by the main program.

Once spawned by a program, threads are concurrent units of processing that can then be delegated by the operating system to multiple processing cores. Clearly the advantage of a multithreaded program (one that uses multiple threads that are assigned to multiple processing cores) is that you can achieve big ...