This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Threads Programming What is a Thread?
A thread is a single sequential flow of control within
a program. Threads vs. Processes
Creation of a new process using fork is
expensive (time & memory).
A thread (sometimes called a lightweight
process ) does not require lots of memory or
startup time. fork()
Process B Code Global
Variables Stack Code Stack pthread_create() Process A
Code pthread_create() Process A
Thread 2 Stack
Stack Multiple Threads
Each process can include many threads.
All threads of a process share:
memory (program code and global data)
open file/socket descriptors
signal handlers and signal dispositions
working environment (current directory, user ID,
View Full Document
This note was uploaded on 10/21/2011 for the course CSCI 4061 taught by Professor Tripathi during the Spring '08 term at Minnesota.
- Spring '08