Download presentation
Presentation is loading. Please wait.
1
Ch 3
2
Shared memory programming: threads
You will learn Create threads Run threads Kill threads Semaphores Race conditions Deadlocks Synchronization issues Control thread execution Debug threaded programs
3
Concurrent execution Processes compete for the CPU
Fork creates processes that compete with each other for the cpu Child gets a copy of parents code Concurrent execution
4
Threads Operate within the parent process Benefits of threads
Improve performance Background tasks Asynchronous processing Improving program structure
5
Make a multithreaded pgm behave like a sequential one
Design Concerns
6
Set of rules that force a system to behave in a specific way
Example: sequential consistency model All events that work on shared memory happen in a 1 at a time order Problematic when combining 2 sequentially consistent events, resulting in inconsistent. Figure 3.6 Example: linearizability Events appear to happen in a one at a time order Appear to take place instantly, done by linearization points (when they take effect) Consistency Model
7
Implications of linearization points
Methods can be totally ordered by linearization points Locking has the effect of taking place instantly as far as others are concerned. Discuss page 68, 69, 70 Implications of linearization points
8
semaphores
9
Producer / Consumer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.