Recognize that, if a mutex is already locked by another thread, rather than waiting for it to become available it can beneficial to do other work. Understand how the try lock method can be used to acquire the lock on a mutex in a non-blocking manner.
- When multiple threads each have multiple tasks to perform, … making those threads block and wait … every time they attempt to acquire a lock … that's already taken may not be necessary or efficient. … Olivia and I are two threads … doing several different tasks. … My thread will be taking an inventory of the fridge … to see what things we're running low on, … and then add those to the shopping list … on our shared notepad. … I'll go back and forth between those two tasks. … - [Olivia] And my thread is searching through the newspaper … for grocery coupons and then adding those items … to the shared shopping list. … Oh, there are some good deals this week. … Now that I've found some items that I want, … I'll take the pencil, which is our mutex … to lock access to the shared notepad so I can add them. … - I saw we're low on milk, … so now I'll go to acquire the pencil … and I see Olivia has it. … If I attempt to lock a mutex in a regular blocking fashion, … my thread would enter a waiting state at this point …
- Parallel computing architectures
- Shared vs. distributed memory
- Thread vs. process
- Execution scheduling
- The thread lifecycle in C++
- Mutual exclusion
- Locking in recursive and shared mutexes
- Acquiring a lock on a mutex with a try lock
- Resolving deadlock and livelock conditions
Skill Level Advanced
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.