Archive for the ‘POSIX Threads’ Category

POSIX Threads Programming

Monday, August 27th, 2012

POSIX Threads Programming by Blaise Barney, Lawrence Livermore National Laboratory

From the webpage:

In shared memory multiprocessor architectures, such as SMPs, threads can be used to implement parallelism. Historically, hardware vendors have implemented their own proprietary versions of threads, making portability a concern for software developers. For UNIX systems, a standardized C language threads programming interface has been specified by the IEEE POSIX 1003.1c standard. Implementations that adhere to this standard are referred to as POSIX threads, or Pthreads.

The tutorial begins with an introduction to concepts, motivations, and design considerations for using Pthreads. Each of the three major classes of routines in the Pthreads API are then covered: Thread Management, Mutex Variables, and Condition Variables. Example codes are used throughout to demonstrate how to use most of the Pthreads routines needed by a new Pthreads programmer. The tutorial concludes with a discussion of LLNL specifics and how to mix MPI with pthreads. A lab exercise, with numerous example codes (C Language) is also included.

Level/Prerequisites: This tutorial is one of the eight tutorials in the 4+ day “Using LLNL’s Supercomputers” workshop. It is deal for those who are new to parallel programming with threads. A basic understanding of parallel programming in C is required. For those who are unfamiliar with Parallel Programming in general, the material covered in EC3500: Introduction To Parallel Computing would be helpful.

The capacity for parallelism in computing has become commonplace. How well parallelism is being used?, is a much more difficult question.

Fortunately, exploration of parallelism isn’t limited to cloistered and carefully guarded CS installations. It is quite likely that the computer on your desk has some capacity for parallel processing.

Not enough to simulate the origin of the universe or an atomic bomb explosion but enough to learn the basics of parallelism. You may discover insights that have been overlooked by others.

Won’t know unless you try.

I first saw this at Christopher Lalanne’s A bag of tweets / August 2012.

PS: If you learn POSIX threads, you might want to consider mapping the terminology to vendor specific thread terminology.