In this video, learn how to investigate the effects of starvation when a large number of threads with different priorities compete for execution time with an example Java program.
- [Teacher] To demonstrate thread starvation in Java, … I'll modify the dining philosophers example program … by adding a local variable within … the philosophers classes run method to keep track … of the number of pieces of sushi, … this philosopher thread gets to eat. … I'll increment that sushi eaten variable … every time the philosopher takes a piece of sushi. … And finally at the end of the run method after … the while loop finishes, I'll print out … the number of pieces that this philosopher … was able to take. … When I run this program... … I see that each philosopher got a different amount of sushi … and it's not particularly fair. … Olivia took way more sushi than Barron or Steve here, … but that's not because she is greedy, … it's because of the order in which three philosophers are … currently taking chopsticks. … Barron and Steve and both competing for chopstick A … as their first chopstick, but Olivia is … the only philosopher going for chopstick B first. … So since she has less competition …
- 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.