TAMU CSCE 410 - Set4(Synchronization) (24 pages)

Previewing pages 1, 2, 23, 24 of 24 page document View the full content.
View Full Document

Set4(Synchronization)



Previewing pages 1, 2, 23, 24 of actual document.

View the full content.
View Full Document
View Full Document

Set4(Synchronization)

84 views

Other


Pages:
24
School:
Texas A&M University
Course:
Csce 410 - Operating Systems
Operating Systems Documents

Unformatted text preview:

CPSC 410 611 Operating Systems Process Synchronization Process Management Synchronization Why Examples What The Critical Section Problem How Software solutions Hardware supported solutions The basic synchronization mechanism Semaphores More sophisticated synchronization mechanisms Monitors Message Passing Classical synchronization problems Process Management Synchronization Why Examples What The Critical Section Problem How Software solutions Hardware supported solutions The basic synchronization mechanism Semaphores More sophisticated synchronization mechanisms Monitors Message Passing Classical synchronization problems 1 CPSC 410 611 Operating Systems Process Synchronization The Critical Section Problem Example 1 void echo input in keyboard out in output out display Operation Interleaved execution char in shared variables char out Process 1 Echo Process 2 Echo input in keyboard out in output out display input in keyboard out in output out display Race condition The Critical Section Problem Example 2 Producer consumer with bounded shared memory buffer circular buffer of size n out in int Item int in out buffer n counter Producer Consumer void deposit Item next while counter n no op buffer in next in in 1 MOD n counter counter 1 Item remove while counter 0 no op next buffer out out out 1 MOD n counter counter 1 return next 2 CPSC 410 611 Operating Systems Process Synchronization This Implementation is not Correct Producer operation on CPU interleaved execution Consumer counter counter 1 counter counter 1 reg1 counter reg1 reg1 1 counter reg1 reg2 counter reg2 reg2 1 counter reg2 reg1 counter reg1 reg1 1 reg2 counter reg2 reg2 1 counter reg1 counter reg2 Race condition Need to ensure that only one process can manipulate variable counter at a time synchronization Critical Section Problem Example 3 Insertion of an element into a list new curr void insert new curr 1 new next curr next 2 new prev c next prev 3 curr next new 4 new next prev new prev next prev prev next



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Set4(Synchronization) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Set4(Synchronization) and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?