Getting Started With POSIX Threads

Thomas Wagner, Don Towsley · 1999

Threads are often called lightweight processes and while this term is somewhat of an over simplification, it is a good starting point. Threads are cousins to UNIX processes though they are not processes themselves. To understand the distinction we must examine the relation between UNIX processes and Mach tasks and threads. In UNIX, a process contains both an executing program and a bundle of resources such as the file descriptor table and address space. In Mach, a task contains only a bundle of resources; threads handle all execution activities. A Mach task may have any number of threads associated with it and all threads must be associated with some task. All threads associated with a given task share the task's resources. Thus a thread is essentially a program counter, a stack, and a set of registers -all the other data structures belong to the task. A UNIX process in Mach is modeled as a task with a single thread.

Read the paper · More papers on PaperTik