Rec9 2010

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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 A Global Variables fork() Process B Code Global Variables Stack Code Stack pthread_create() Process A Thread 1 Global Variables 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, etc.) Thread-Sp...
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.

Ask a homework question - tutors are online