DOC PREVIEW
UB CSE 421 - More IPC B.Ramamurthy

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

More IPCBarriersDining Philosophers (1)Posix Library Implementation Based F. Mueller’s PaperDining Philosophers ExampleDining PhilosophersSlide 7The Sleeping Barber Problem (1)Sleeping Barber Problem01/14/19 1More IPCB.Ramamurthy01/14/19 2Barriers•Use of a barrier–processes approaching a barrier–all processes but one blocked at barrier–last process arrives, all are let through01/14/19 3Dining Philosophers (1)•Philosophers eat/think•Eating needs 2 forks•Pick one fork at a time •How to prevent deadlock01/14/19 4Posix Library ImplementationBased F. Mueller’s PaperLanguage ApplicationLanguage Interface C Language ApplicationPosix thread libraryUnix KernelUnix librariesUser LevelKernel LevelTo answer Hanumanth’s question.01/14/19 5Dining Philosophers Examplemonitor dp {enum {thinking, hungry, eating} state[5];condition self[5];void pickup(int i) // following slidesvoid putdown(int i) // following slidesvoid test(int i) // following slidesvoid init() {for (int i = 0; i < 5; i++)state[i] = thinking;}}01/14/19 6Dining Philosophersvoid pickup(int i) {state[i] = hungry;test[i];if (state[i] != eating)self[i].wait();}void putdown(int i) {state[i] = thinking;// test left and right neighborstest((i+4) % 5);test((i+1) % 5);}01/14/19 7Dining Philosophersvoid test(int i) {if ( (state[(I + 4) % 5] != eating) && (state[i] == hungry) && (state[(i + 1) % 5] != eating)) {state[i] = eating;self[i].signal();}}01/14/19 8The Sleeping Barber Problem (1)01/14/19 9Sleeping Barber ProblemThe barber shop has one barber, one barber chair, and n waiting chairs.If there are no customers, barber falls asleep. When customer arrives he/she has to wake up sleeping barber.If additional customer arrive when barber is cutting they wait (if any empty chair) or leave (if all chairs are


View Full Document

UB CSE 421 - More IPC B.Ramamurthy

Documents in this Course
Security

Security

28 pages

Threads

Threads

24 pages

Security

Security

20 pages

Security

Security

52 pages

Security

Security

20 pages

Load more
Download More IPC B.Ramamurthy
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view More IPC B.Ramamurthy 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 More IPC B.Ramamurthy 2 2 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?