Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword or section
Like this

Table Of Contents

Improve Performance
User-level Threads1
Lightweight Processes
Unbound Threads
Bound Threads
Meeting Multithreading Standards
Programming With Threads 2
The Threads Library
Create a Thread—the Basics
Get the Thread Identifier
Yield Thread Execution
Suspend or Continue Thread Execution
Send a Signal to a Thread
Access the Signal Mask of the Calling Thread
Terminate a Thread
Wait for Thread Termination
A Simple Threads Example
CodeExample2-1A Simple Threads Program
Maintain Thread-Specific Data
CodeExample2-2Thread-Specific Data—Global but Private
CodeExample2-3Turning Global References Into Private References
CodeExample2-4Initializing the Thread-Specific Data
Create a Thread—Advanced Features
CodeExample2-5thr_create() Creates Thread With New Signal Mask
Get the Minimal Stack Size
Get and Set Thread Concurrency Level
Get and Set Thread Priority
Scheduling and the Threads Library
Mutual Exclusion Locks
Initialize a Mutual Exclusion Lock
Lock a Mutex
Lock With a Nonblocking Mutex
Unlock a Mutex
Destroy Mutex State
Mutex Lock Code Example
CodeExample3-1Mutex Lock Example
Nested Locking With a Singly Linked List
CodeExample3-4Singly Linked List Structure
Nested Locking With a Circular Linked List
CodeExample3-5Singly Linked List with Nested Locking
CodeExample3-6Circular Linked List Structure
Condition Variables
CodeExample3-7Circular Linked List With Nested Locking
Initialize a Condition Variable
Block on a Condition Variable
Unblock a Specific Thread
CodeExample3-8Example Usingcond_wait(3T) andcond_signal(3T)
Block Until a Specified Event
CodeExample3-9Timed Condition Wait
Unblock All Threads
Destroy Condition Variable State
The Lost Wake-Up Problem
The Producer/Consumer Problem
CodeExample3-12The Producer/Consumer Problem—the Producer
CodeExample3-13The Producer/Consumer Problem—the Consumer
Multiple-Readers, Single-Writer Locks
Initialize a Readers/Writer Lock
Acquire a Read Lock
Try to Acquire a Read Lock
Acquire a Write Lock
Try to Acquire a Write Lock
Unlock a Readers/Writer Lock
Destroy Readers/Writer Lock State
CodeExample3-14Read/Write Bank Account
Counting Semaphores
Initialize a Semaphore
Increment a Semaphore
Block on a Semaphore Count
Decrement a Semaphore Count
Destroy the Semaphore State
The Producer/Consumer Problem, Using Semaphores
CodeExample3-15The Producer/Consumer Problem With Semaphores
CodeExample3-16The Producer/Consumer Problem—the Producer
CodeExample3-17The Producer/Consumer Problem—the Consumer
Synchronization Across Process Boundaries
Comparing Primitives
Programming With the Operating System 4
Processes—Changes for Multithreading
Duplicating Parent Threads
Processes—Changes for Multithreading page79
Executing Files and Terminating Processes
Alarms, Interval Timers, and Profiling
Nonlocal Goto—setjmp(3C) andlongjmp(3C)
Resource Limits
LWPs and Scheduling Classes
Timeshare Scheduling
Realtime Scheduling
LWP Scheduling and Thread Binding
SIGWAITING—Creating LWPs for Waiting Threads
Aging LWPs
Extending Traditional Signals
Synchronous Signals
Asynchronous Signals
Continuation Semantics
CodeExample4-1Continuation Semantics
New Operations on Signals
Thread-Directed Signals
CodeExample4-2Asynchronous Signals andsigwait(2)
Completion Semantics
CodeExample4-3Completion Semantics
Signal Handlers and Async Safety
Interrupted Waits on Condition Variables
CodeExample4-4Condition Variables and Interrupted Waits
I/O Issues
I/O as a Remote Procedure Call
Tamed Asynchrony
Asynchronous I/O
Shared I/O and New I/O System Calls
Alternatives togetc(3S) andputc(3S)
Safe and Unsafe Interfaces 5
Thread Safety
CodeExample5-1Degrees of Thread Safety
MT Interface Safety Levels
Reentrant Functions for Unsafe Interfaces
Async-Safe Functions
MT Safety Levels forLibraries
Unsafe Libraries
Compiling And Debugging 6
Compiling a Multithreaded Application
Using The C Compiler
Compiling a Multithreaded Application page107
Compiling With the_REENTRANT Flag
Table6-1Compiling With and Without the_REENTRANT Flag
Using Non-C Compilers
Debugging Multithreaded Programs
Common Oversights
Programming Guidelines 7
Rethinking Global Variables
CodeExample7-1Global Variables anderrno
Providing For Static Local Variables
Synchronizing Threads
CodeExample7-2Thegethostbyname() Problem
Single-Threaded Strategy
CodeExample7-3Theprintf() Problem
CodeExample7-4Testing the Invariant Withassert(3X)
Avoiding Deadlock
Scheduling Deadlocks
Locking Guidelines
Following Some Basic Guidelines
Creating Threads
Working With Multiprocessors
The Underlying Architecture
CodeExample7-6Mutual Exclusion for Two Threads?
CodeExample7-7Multithreaded Cooperation (Barrier Synchronization)
Sample Application Code A
File Copy
CodeExampleA-1File Copy Example With a Semaphore
Matrix Multiplication
RPC Program
CodeExampleA-3RPCrstat Program With Multithreaded Client
Window System Server
CodeExampleA-4Window Server
MT Safety Levels: Library InterfacesB
0 of .
Results for:
No results containing your search query
P. 1


Ratings: (0)|Views: 83|Likes:

More info:

Published by: Spiros Fraganastasis on Jul 10, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





You're Reading a Free Preview
Pages 4 to 52 are not shown in this preview.
You're Reading a Free Preview
Pages 55 to 188 are not shown in this preview.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->