Investigate the effects of starvation when a large number of threads having different priorities compete for execution time with an example C++ program.
- [Instructor] To demonstrate thread starvation, … we'll modify this version of the dining philosophers … example program to add a local variable … within the philosopher function to keep track … of how many pieces of sushi … each philosopher thread gets to eat. … We'll increment the philosopher's sushi eating variable … after they take a piece of sushi on line 15, … and then at the end, after their while loop finishes, … we'll print a message with the number of pieces … this philosopher was able to take. … There are currently 5000 pieces of sushi … up for grabs on line seven, … so I'll switch over to the command prompt, make, … and then run this program, … and when it finishes I can see that each philosopher … got a different amount of sushi. … It's not necessarily fair, … but there's plenty of sushi to go around, … so both of the philosophers are well fed. … Now let's see what happens if we drastically increase … the number of philosophers at the dinner party, … by modifying the array to hold philosopher threads …
- 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.