ECE 391 Lecture 8: Locks and Parallelism

119 views5 pages

Document Summary

Synchronization issues five hungry philosophers (represents 5 pieces of code) five chopsticks. Protocols take left chopstick (or wait) take right chopstick (or wait) eat release right chopstick release left chopstick digest repeat problem? deadlock! everyone will be waiting and nothing will move forward (eating) How about the following protocol? take left chopstick (or wait) if right chopstick is free, take it else release left chopstick and start over eat release right release left digest repeat. Ece 391 - lect page 1 occasionally you need multiple locks, or multiple chopsticks in this case. Getting synchronization correct can be hard (there"s no hard set steps, it will always be difficult) it"s the focus of several research communities. On uniprocessor mentally insert handler code between every pair of adjacent instructions ask whether anything bad can happen if so, prevent with cli/sti. Let"s give it a level of functions instead of instructions, but the problem with interrupts is that they can occur anytime.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers