This course provides training in the design, development, troubleshooting, and repair of multithreaded applications designed to run on Microsoft's Windows 2000 and later releases (Vista, XP, and 2003). The course has been redesigned to take advantage of new Windows features that enhance reliability and performance. Windows 9x and NT limitations are only considered if required (sometimes they are!).
This 2 or 3-day lecture-lab course (the length is customized to client requirements) reviews core topics and emphasizes advanced topics, including performance and scalability on symmetric multiprocessor (SMP) systems and on Intel Pentium 4, Xeon, and Itanium processors.
Extensive hands-on exercises (the exercises are optional; some clients prefer demonstrations), using Microsoft Visual C++, allow participants to develop, enhance, and debug practical and realistic multithreaded applications that illustrate the topics discussed in the lectures. Complete solutions are provided in all cases, and many of the solutions can be used as the foundation for future application development. The course and the lab exercises concentrate on the core issues and do not use GUI interfaces, although graphical user interfaces can be added to the code. Many of the topics are appropriate when building servers.
Audience: Software engineers and programmers, including those with some experience with threads, who need to learn how to develop reliable, high-performance multithreaded Windows client, desktop, and server applications.
Prerequisites: Knowledge of C (or C++, C#, Java, etc.) programming, experience developing Windows applications with Microsoft Visual Studio (helpful, but not required). Prior experience with Windows thread management and synchronization are helpful, but not required.
COURSE SCHEDULE
There are 3-4 sessions per day, depending on the pace; each session consists of a lecture with demonstrations followed by a lab. Average session time is 90 minutes. A one-hour lunch break is recommended. Each day normally runs 7.5 hours (including lunch); for example, 9:00 – 4:30. The instructor will be available for as long as required after each class and before class on the second day.
Session 1. Win32 Thread Management
1. Process and Thread Overview
2. Thread Management
3. Waiting for Thread Termination
4. The C Library and Threads
5. Demonstration: Building a Threaded Application
6. Thread Priority, Scheduling, SMP Impact
Session 2. Windows Synchronization
1. Need for Synchronization
2. Thread Synchronization Objects
3. CRITICAL_SECTIONs
4. Deadlock Example
5. Interlocked Functions
6. Mutexes for Mutual Exclusion
7. Events
8. Semaphores
Session 3. Performance Impacts and Guidelines
1. CRITICAL_SECTION – Mutex Tradeoffs
2. SMP Impact
3. Semaphores to Reduce Thread Contention
4. Processor Affinity
5. Tuning with CS Spin Counts
6. Performance Guidelines and Pitfalls
Session 4. Thread Safety, DLLs, and Thread-Local Storage
1. Multithreading Persistent State Problem
2. The DllMain function
3. Thread Local Storage
4. TLS-DLL Demonstration: Message-Based Socket communication
5. Thread-Safe Libraries w/o TLS: State Parameters
Session 5. Threading Models for Reliability
1. Multithreading Models
2. COM Model Comparison
3. Events and Mutexes Together
4. The Condition Variable Model
5. SignalObjectAndWait
6. Using the Condition Variable Model
7. More Performance Tradeoffs
8. Avoiding Incorrect Code - Hints and Guidelines
Session 6: Compound Objects
1. Threshold Barrier Problem
2. A Queue Object
3. Demo: Multiple Wait Semaphore with Process-Shared Objects
4. Demo: Batons to Serialize Thread Execution
Session 7. Advanced Win32 Threading Features
1. Asynchronous Procedure Calls
2. Alertable Wait Functions
3. APCs and the Baton Example
4. Waitable Timers
5. Asynchronous I/O Quick Overview
Session 8. Introduction to Pthreads for Application Portability
1. The Pthreads Model and Standard
2. The Open Source Windows Pthreads Library and UNIX/Linux Portability
3. Pthreads Thread Management and Synchronization Introduction
4. Performance Comparisons
5. Pros and Cons
For more information: Contact us at:
JMH Associates, Inc.
Phone: 781-789-7413
jmh_assoc@hotmail.com, jmhart@world.std.com
February 17, 2007