CSE 131 Lecture 7: Lecture 7

30 views3 pages
28 Jan 2019
School
Course
Professor

Document Summary

Section 4. 4 in the freebsd textbook for asgn2. Require busy waiting: process spins in a loop waiting for something to happen, wasting cpu time. Several hardware methods (need a special instruction in hardware) Test & set: test a variable and set it in one instruction. Atomic swap: switch register & memory in one instruction. Compare_and_swap(register, old value, new value) returns success/fail. Ex: if we do this through hardware: if( var == 0) { set var = 1 ) swap(register, new value) returns old value. Instead of possibly another process taking over after the if . Turn off interrupts: process won"t be switched out unless it asks to be suspended. If you"re in a critical section, no switching will happen because interrupts are turned off. Still requires busy waiting but code is much simpler. Both hardware and software solutions require spin locks. Allow processes to sleep while they wait to execute their critical sections.

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

Related Documents