
|
The Multithreaded Applications Programming course provides students with
information about threads: what they are, how they work, why they are useful.
The course includes several sessions using the various tools which are
available. It examines in detail some simple programs, looking at both the
operation and performance of those programs. The course also covers many of the
complexities and hardware-dependent performance issues that arise.
The actual code examples are in POSIX threads on Solaris 2.x (examples
also run on Digital UNIX, IRIX, and HP-UX), with reference to how the UNIX
International (aka "Solaris Threads") API is used.
This course provides laboratory work in writing and debugging multi-threaded
programs.
Who Can Benefit
Students who can benefit from this course are experienced C programmers who are
proficient in system interface programming
Back to top
Prerequisites
To succeed fully in this course, students should be able to:
- Use basic Solaris commands
- Create and edit text files using emacs, vi, or the OpenWindows Text Editor
- Create correct C programs
- Demonstrate a general knowledge of UNIX system calls and library calls,
including fork() and exec, signals, and interprocess communication
- Debug a C program using dbx or the OpenWindows debugger
Back to top
Skills Gained
Upon completion of this course, students should be able to:
- Define concurrency and give its advantages on both uniprocessor and
multiprocessor systems
- Explain the role of the POSIX multithreading standard
- Decide which tasks lend themselves to a concurrent solution
- Explain the advantages of using threads over fork() to obtain concurrency
- Describe how application threads fit into the two-level scheduling model of Solaris 2x
- Compile and run programs using the user-level threads library
- Avoid synchronization pitfalls such as deadlock and recursive locking
- Use the multithread debugger on multithreaded programs
- Use thread specific data (TSD) correctly
- Explain the different scheduling algorithms for threads and how those algorithms affect programming choices
- Define synchronization-how it is implemented at the hardware level, what types of synchronization exist, and how to use them
- Explain how signals work, why UNIX has them, how they have been extended to work with threads, how you should program with signals, and how to create thread-specific timers and interrupts
- Explain operating system interactions, what aspects of the operating system affect your programming, how you deal with shared memory, unreserved virtual
memory, CPU selection, CPU-specific binding of threads, kernel-level scheduling, etc.
- Use libraries correctly- understand what it means to be "MT-safe", how you deal with unsafe libraries, how you should write new libraries, and what the
different efficiency issues are
Back to top
Related Courses
Before:
After:
Back to top
Course Content
Module 1 - Introduction to Multithreading
- Thread concepts, properties, and standards
- Concurrency versus parallelism
- Process structure
- Thread process structure
- Benefits of threads
- Distributed multiprocessing
- When not to use threads
Module 2 - Getting Started With POSIX Threads
- Thread creation and destruction
- Components of threads
- Attributes of threads
- Waiting for threads
- Using the Workshop debugger
Module 3 - Introduction to Synchronization
- The synchronization instruction
- POSIX synchronization variables
- Using mutexes, semaphores, readers/writer locks, and condition variables
- EINTR, spurious wakeups
Module 4 - Locking Problems
- Deadlocks
- Recursive Locking
- Race Conditions
Module 5 - Advanced Synchronization
- The lost wakeup problem
- Barriers, monitors, robust mutexes
- Dynamic allocation
Module 6 - Thread Specific Data
- Using TSD
- Deleting TSD keys
- TSD destructors
Module 7 - Cancellation
- State and type
- Cleanup handlers
- Cancellation and C++
- Bounded time termination
Module 8 - Design
- Master/slave
- Producer/consumer
- Pipeline
Module 9 - Thread-Safe Libraries
- Unsafe library functions
- pread() and pwrite()
- Window toolkits
- errno and getc()
- Stub functions
Module 10 - UNIX Signals
- How signals work
- Implementation details
- sigwait()
- Signal safety
Module 11 - Advanced Scheduling
- Realtime scheduling
- Priority inversion
- Allocation domains
- Scheduler Controls
Module 12 - Hardware
- SMP bus designs
- Cross-bar switches
- Sun Ultra Enterprise
- Out of order execution
Module 13 - Performance
- Amdahl's law
- Speedup for parallel benchmarks
- How many LWPs?
- Processor affinity
Module 14 - API Details
- Return values
- Constants
- Attribute objects
- Initialization and destruction
Module 15 - Compiling
- Solaris libraries
- Compiling POSIX
- Compiling mixed POSIX and UI
Module 16 - Other Tools
- Proctool
- Trace Normal Form
Module 17 - Other Details
- Fork problems
- Debugging interface
- Thread stacks
- Optional portions
Module 18 - More Information
- Newsgroups, FAQs, books, products
Back to top
Browse Other Course Topic Areas
|
Can't Travel for Training?
Sun eLearning and On Demand Labs give you easy access to the training you need.
Get an iPod touch
For a limited time: order qualifying Sun training and get an iPod touch®.
|