In this video, discover that if a thread tries to acquire the lock on a standard mutex that it already possesses, that can cause a deadlock. Learn that a reentrant or recursive mutex can be locked multiple times by the same thread, and explore potential use cases for a reentrant lock and mutex.
- Olivia and I have been using this pencil as a mutex. … Only one person at a time can own or have a lock on it, … and only that person can access … our shared resource, this notepad. … - If I attempt to lock the mutex … while another thread has it, … my thread will be blocked, … and I need to wait until he unlocks it … so it becomes available. … - And if I attempt to lock the mutex, … it doesn't appear to be available, … so my thread will just have to wait too. … - It's behind your ear. You already locked it. … - Oh. … Well my thread can't unlock the mutex … while I'm blocked waiting on it, … and I'll be waiting on the mutex forever … because I'll never be able to unlock it. … I'm stuck, … and so are you. … If a thread tries to lock a mutex that it's already locked, … it'll enter into a waiting list for that mutex, … which results in something called a deadlock, … because no other thread can unlock that mutex. … - There may be times when a program needs … to lock a mutex multiple times before unlocking it. …
- 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.