Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword or section
Like this

Table Of Contents

Improve Performance
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
Programming With Synchronization Objects 3
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
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
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
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


|Views: 84|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 21 are not shown in this preview.
You're Reading a Free Preview
Pages 25 to 61 are not shown in this preview.
You're Reading a Free Preview
Pages 65 to 68 are not shown in this preview.
You're Reading a Free Preview
Pages 72 to 122 are not shown in this preview.
You're Reading a Free Preview
Pages 126 to 188 are not shown in this preview.

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)//-->