In this video, learn about how a segment of code that accesses a shared resource is a critical section and should not be executed by more than one thread or process at a time. Gain an understanding of how a mutex or lock can be used to enforce mutual exclusion and protect a critical section by limiting access to one thread at a time. Also, learn that atomic operations execute as a single, indivisible action that cannot be interrupted by other concurrent processes.
- Anytime multiple threads are concurrently reading … and writing a shared resource, … it creates the potential for incorrect behavior, … like a data race. … But we can defend against that … by identifying and protecting critical sections of code. … A critical section or critical region … is part of a program that accesses a shared resource, … such as a data structure memory, or an external device, … and it may not operate correctly, … if multiple threads concurrently access it. … The critical section needs to be protected … so that it only allows one thread or process … to execute in it at a time. … - Barron and I experienced a data race … as we added garlic to our shared shopping list, … because incrementing a value … is actually a three-step process. … Read the current value, modify it, … and then write back the result. … Those three steps are critical section, … and they need to execute as an uninterrupted action, … so we don't accidentally override each other. … - I have an idea. …
- Parallel vs. sequential computing
- Shared vs. distributed memory
- Execution scheduling
- Thread lifecycle
- Mutual exclusion
- Synchronized methods
- Checking for liveness
Skill Level Advanced
Java Essential Training: Objects and APIswith David Gassner2h 46m Intermediate
Java Essential Training: Syntax and Structurewith David Gassner3h 9m Intermediate
1. Parallel Computing Hardware
2. Threads and Processes
3. Mutual Exclusion
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.