Muutke küpsiste eelistusi

E-raamat: Modern Multithreading - Implementing, Testing and Debugging Multithreaded Java and Cplusplus/Pthreads/Win3 2 Programs: Implementing, Testing, and Debugging Multithreaded Java and Cplusplus/Pthreads/Win32 Programs [Wiley Online]

  • Formaat: 480 pages
  • Ilmumisaeg: 11-Nov-2005
  • Kirjastus: Wiley-Interscience
  • ISBN-10: 471744174
  • ISBN-13: 9780471744177
  • Wiley Online
  • Hind: 120,48 €*
  • * hind, mis tagab piiramatu üheaegsete kasutajate arvuga ligipääsu piiramatuks ajaks
  • Formaat: 480 pages
  • Ilmumisaeg: 11-Nov-2005
  • Kirjastus: Wiley-Interscience
  • ISBN-10: 471744174
  • ISBN-13: 9780471744177
This textbook takes a fine-tuned approach to the art of creating threads in Java and C++ and developing concurrent programming and problem-solving skills. It covers the basics of concurrent programming, including thread communication and synchronization, the critical section problem, semaphores and locks, monitors, message passing (including in distributed programs) and resting and debugging concurrent programs. Each chapter includes lists of further reading, references and exercises. The text is classroom-tested and anticipates student questions, failures and triumphs in a very civilized manner. Annotation ©2005 Book News, Inc., Portland, OR (booknews.com)

Master the essentials of concurrent programming,including testing and debugging

This textbook examines languages and libraries for multithreaded programming. Readers learn how to create threads in Java and C++, and develop essential concurrent programming and problem-solving skills. Moreover, the textbook sets itself apart from other comparable works by helping readers to become proficient in key testing and debugging techniques. Among the topics covered, readers are introduced to the relevant aspects of Java, the POSIX Pthreads library, and the Windows Win32 Applications Programming Interface.

The authors have developed and fine-tuned this book through the concurrent programming courses they have taught for the past twenty years. The material, which emphasizes practical tools and techniques to solve concurrent programming problems, includes original results from the authors' research. Chapters include:
* Introduction to concurrent programming
* The critical section problem
* Semaphores and locks
* Monitors
* Message-passing
* Message-passing in distributed programs
* Testing and debugging concurrent programs

As an aid to both students and instructors, class libraries have been implemented to provide working examples of all the material that is covered. These libraries and the testing techniques they support can be used to assess student-written programs.

Each chapter includes exercises that build skills in program writing and help ensure that readers have mastered the chapter's key concepts. The source code for all the listings in the text and for the synchronization libraries is also provided, as well as startup files and test cases for the exercises.

This textbook is designed for upper-level undergraduates and graduate students in computer science. With its abundance of practical material and inclusion of working code, coupled with an emphasis on testing and debugging, it is also a highly useful reference for practicing programmers.
Preface xi
Introduction to Concurrent Programming
1(45)
Processes and Threads: An Operating System's View
1(2)
Advantages of Multithreading
3(1)
Threads in Java
4(2)
Threads in Win32
6(3)
Pthreads
9(5)
C++ Thread Class
14(5)
C++ Class Thread for Win32
14(5)
C++ Class Thread for Pthreads
19(1)
Thread Communication
19(10)
Nondeterministic Execution Behavior
23(2)
Atomic Actions
25(4)
Testing and Debugging Multithreaded Programs
29(9)
Problems and Issues
30(4)
Class TDThread for Testing and Debugging
34(3)
Tracing and Replaying Executions with Class Template shared Variable
37(1)
Thread Synchronization
38(8)
Further Reading
38(1)
References
39(2)
Exercises
41(5)
The Critical Section Problem
46(38)
Software Solutions to the Two-Thread Critical Section Problem
47(7)
Incorrect Solution 1
48(1)
Incorrect Solution 2
49(1)
Incorrect Solution 3
50(2)
Peterson's Algorithm
52(1)
Using the volatile Modifier
53(1)
Ticket-Based Solutions to the n-Thread Critical Section Problem
54(4)
Ticket Algorithm
54(2)
Bakery Algorithm
56(2)
Hardware Solutions to the n-Thread Critical Section Problem
58(4)
Partial Solution
59(1)
Complete Solution
59(1)
Note on Busy-Waiting
60(2)
Deadlock, Livelock, and Starvation
62(2)
Deadlock
62(1)
Livelock
62(1)
Starvation
63(1)
Tracing and Replay for Shared Variables
64(20)
ReadWrite-Sequences
65(2)
Alternative Definition of ReadWrite-Sequences
67(1)
Tracing and Replaying ReadWrite-Sequences
68(2)
Class Template sharedVariable
70(1)
Putting It All Together
71(3)
Note on Shared Memory Consistency
74(3)
Further Reading
77(1)
References
78(1)
Exercises
79(5)
Semaphores and Locks
84(93)
Counting Semaphores
84(2)
Using Semaphores
86(4)
Resource Allocation
86(1)
More Semaphore Patterns
87(3)
Binary Semaphores and Locks
90(2)
Implementing Semaphores
92(4)
Implementing P( ) and V( )
92(2)
VP( ) Operation
94(2)
Semaphore-Based Solutions to Concurrent Programming Problems
96(15)
Event Ordering
96(1)
Bounded Buffer
96(2)
Dining Philosophers
98(3)
Readers and Writers
101(7)
Simulating Counting Semaphores
108(3)
Semaphores and Locks in Java
111(8)
Class counting Semaphore
111(2)
Class mutexLock
113(2)
Class Semaphore
115(1)
Class Reentrant Lock
116(1)
Example: Java Bounded Buffer
116(3)
Semaphores and Locks in Win32
119(15)
Critical_Section
119(3)
Mutex
122(2)
Semaphore
124(8)
Events
132(2)
Other Synchronization Functions
134(1)
Example: C++/Win32 Bounded Buffer
134(1)
Semaphores and Locks in Pthreads
134(7)
Mutex
136(1)
Semaphore
137(4)
Another Note on Shared Memory Consistency
141(2)
Tracing, Testing, and Replay for Semaphores and Locks
143(34)
Nondeterministic Testing with the Lockset Algorithm
143(3)
Simple SYN-Sequences for Semaphores and Locks
146(4)
Tracing and Replaying Simple PV-Sequences and LockUnlock-Sequences
150(4)
Deadlock Detection
154(3)
Reachability Testing for Semaphores and Locks
157(3)
Putting It All Together
160(3)
Further Reading
163(1)
References
164(2)
Exercises
166(11)
Monitors
177(81)
Definition of Monitors
178(4)
Mutual Exclusion
178(1)
Condition Variables and SC Signaling
178(4)
Monitor-Based Solutions to Concurrent Programming Problems
182(5)
Simulating Counting Semaphores
182(1)
Simulating Binary Semaphores
183(1)
Dining Philosophers
183(4)
Readers and Writers
187(1)
Monitors in Java
187(7)
Better countingSemaphore
190(1)
notify vs. notifyAll
191(3)
Simulating Multiple Condition Variables
194(1)
Monitors in Pthreads
194(5)
Pthreads Condition Variables
196(1)
Condition Variables in J2SE 5.0
196(3)
Signaling Disciplines
199(7)
Signal-and-Urgent-Wait
199(3)
Signal-and-Exit
202(2)
Urgent-Signal-and-Continue
204(1)
Comparing SU and SC Signals
204(2)
Using Semaphores to Implement Monitors
206(3)
SC Signaling
206(1)
SU Signaling
207(2)
Monitor Toolbox for Java
209(2)
Toolbox for SC Signaling in Java
210(1)
Toolbox for SU Signaling in Java
210(1)
Monitor Toolbox for Win32/C++/Pthreads
211(2)
Toolbox for SC Signaling in C++/Win32/Pthreads
213(1)
Toolbox for SU Signaling in C++/Win32/Pthreads
213(1)
Nested Monitor Calls
213(4)
Tracing and Replay for Monitors
217(5)
Simple M-Sequences
217(2)
Tracing and Replaying Simple M-Sequences
219(1)
Other Approaches to Program Replay
220(2)
Testing Monitor-Based Programs
222(36)
M-Sequences
222(5)
Determining the Feasibility of an M-Sequence
227(6)
Determining the Feasibility of a Communication-Sequence
233(1)
Reachability Testing for Monitors
233(2)
Putting It All Together
235(8)
Further Reading
243(1)
References
243(2)
Exercises
245(13)
Message Passing
258(54)
Channel Objects
258(8)
Channel Objects in Java
259(4)
Channel Objects in C++/Win32
263(3)
Rendezvous
266(6)
Selective Wait
272(3)
Message-Based Solutions to Concurrent Programming Problems
275(6)
Readers and Writers
275(3)
Resource Allocation
278(3)
Simulating Counting Semaphores
281(1)
Tracing, Testing, and Replay for Message-Passing Programs
281(31)
SR-Sequences
282(6)
Simple SR-Sequences
288(2)
Determining the Feasibility of an SR-Sequence
290(6)
Deterministic Testing
296(1)
Reachability Testing for Message-Passing Programs
297(2)
Putting It All Together
299(5)
Further Reading
304(1)
References
304(1)
Exercises
304(8)
Message Passing in Distributed Programs
312(69)
TCP Sockets
312(5)
Channel Reliability
313(1)
TCP Sockets in Java
314(3)
Java TCP Channel Classes
317(12)
Classes TCPSender and TCPMailbox
318(8)
Classes TCPSynchronousSender and TCPSynchronous Mailbox
326(2)
Class TCPSelectableSynchronousMailbox
328(1)
Timestamps and Event Ordering
329(12)
Event-Ordering Problems
330(1)
Local Real-Time Clocks
331(1)
Global Real-Time Clocks
332(1)
Causality
332(2)
Integer Timestamps
334(1)
Vector Timestamps
335(4)
Timestamps for Programs Using Messages and Shared Variables
339(2)
Message-Based Solutions to Distributed Programming Problems
341(12)
Distributed Mutual Exclusion
341(5)
Distributed Readers and Writers
346(2)
Alternating Bit Protocol
348(5)
Testing and Debugging Distributed Programs
353(28)
Object-Based Sequences
353(9)
Simple Sequences
362(1)
Tracing, Testing, and Replaying CARC-Sequences and CSC-Sequences
362(7)
Putting It All Together
369(2)
Other Approaches to Replaying Distributed Programs
371(3)
Further Reading
374(1)
References
375(1)
Exercises
376(5)
Testing and Debugging Concurrent Programs
381(76)
Synchronization Sequences of Concurrent Programs
383(5)
Complete Events vs. Simple Events
383(3)
Total Ordering vs. Partial Ordering
386(2)
Paths of Concurrent Programs
388(7)
Defining a Path
388(3)
Path-Based Testing and Coverage Criteria
391(4)
Definitions of Correctness and Faults for Concurrent Programs
395(13)
Defining Correctness for Concurrent Programs
395(2)
Failures and Faults in Concurrent Programs
397(3)
Deadlock, Livelock, and Starvation
400(8)
Approaches to Testing Concurrent Programs
408(11)
Nondeterministic Testing
409(1)
Deterministic Testing
410(4)
Combinations of Deterministic and Nondeterministic Testing
414(5)
Reachability Testing
419(38)
Reachability Testing Process
420(4)
SYN-Sequences for Reachability Testing
424(5)
Race Analysis of SYN-Sequences
429(4)
Timestamp Assignment
433(6)
Computing Race Variants
439(2)
Reachability Testing Algorithm
441(6)
Research Directions
447(2)
Further Reading
449(1)
References
449(3)
Exercises
452(5)
Index 457


RICHARD H. CARVER, PhD, is an Associate Professor in the Department of Computer Science, George Mason University. KUO-CHUNG TAI, PhD, was a Professor in the Department of Computer Science, North Carolina State University as well as the Co-Director of the university's Software Engineering Laboratory.