CS 140 Lecture Notes: ConcurrencySlide 1 Too Much Milk Person A 3:00Arrive home: no milk 3:05Leave for store 3:10Arrive at store 3:15Leave store 3:20Arrive.

Slides:



Advertisements
Similar presentations
Accident prevention in the kitchen
Advertisements

Get. through back much go good new write out.
Synchronization NOTE to instructors: it is helpful to walk through an example such as readers/writers locks for illustrating the use of condition variables.
Threads and Critical Sections Thomas Plagemann Slides from Otto J. Anshus, Tore Larsen (University of Tromsø), Kai Li (Princeton University)
CapacityMeasuring Liquid A Third Grade Review!. Customary Capacity There are 4 main units of customary capacity! GallonsGal QuartsQt PintsPt Cups--C.
So different. too old so long because of him.
Welcome to... A Game of X’s and O’s. Another Presentation © All rights Reserved
EC 100 Class 3.
Process Synchronization A set of concurrent/parallel processes/tasks can be disjoint or cooperating (or competing) With cooperating and competing processes.
PROCESS SYNCHRONIZATION READINGS: CHAPTER 5. ISSUES IN COOPERING PROCESSES AND THREADS – DATA SHARING Shared Memory Two or more processes share a part.
 No eating or drinking on unit!  Remove PPE when leaving unit or going to supply room or bathroom  Excessive jewelry – carries germs not only patient.
How to save money using store coupons. Kamri Oguma period 6.
CS 140 Lecture Notes: ConcurrencySlide 1 Too Much Milk Person A 3:00Arrive home: no milk 3:05Leave for store 3:10Arrive at store 3:15Leave store 3:20Arrive.
Multiprocess Synchronization Algorithms ( ) Lecturer: Danny Hendler.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Threads and Critical Sections Vivek Pai / Kai Li Princeton University.
No Foods are Bad for You LS 12/9/02. In the Beginning of the Project They all are foods that I had for lunch. I knew these foods were healthy.
Training a Dog Dog Unit Small Animal Science. The amount and type of training depends on expectation of dog. All dogs should learn these 5 basic commands.
Synchronization Andy Wang Operating Systems COP 4610 / CGS 5765.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
9/8/2015cse synchronization-p1 © Perkins DW Johnson and University of Washington1 Synchronization Part 1 CSE 410, Spring 2008 Computer Systems.
1 Lecture 9: Synchronization  concurrency examples and the need for synchronization  definition of mutual exclusion (MX)  programming solutions for.
1 Thread Synchronization: Too Much Milk. 2 Implementing Critical Sections in Software Hard The following example will demonstrate the difficulty of providing.
Exercise N:1 (Simulation modeling of inventory systems) Ahmed home furnishing is currently having its year-end appliance clearance sale. The store has.
Includes slides from course CS162 at UC Berkeley, by prof Anthony D. Joseph and Ion Stoica and from course CS194, by prof. Katherine Yelick Shared Memory.
Chinese New Year Wendy Osteyee-Christensen. We welcome in the New Year as we welcome the spring. Five days of feasting. Five days with family Five days.
onions aubergines nutsrice The first and second group will search through the internet about countable and uncountable nouns using the following.
Snow!. Snowball Snowman Snow fort One piece of snow: Snowflake.
By April Ernst.  One way to reduce is….. is when you leave a room turn off the lights This will help with the energy you use.
People can not live without food. Where does our food come from?  Milk comes from cows.From milk people make butter and cheese.  Children like milk.
11/18/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam.
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
HOW TO CHANGE OIL IN A CAR
1.Charlie wanted to buy chicks at the market. He had $80 in his pocket and he spend all of his money to buy chicks at $4 each. On his way home, he give.
CPS110: Thread cooperation Landon Cox. Constraining concurrency  Synchronization  Controlling thread interleavings  Some events are independent  No.
Shopping at the Grocery Store !. Our Shopping List. Apples Milk Donuts Ice Cream Lunchmeat Popcorn.
CS162 Operating Systems and Systems Programming Lecture 4 Synchronization, Atomic operations, Locks September 10, 2012 Ion Stoica
Today’s lecture Review chapter 5 go over exercises.
Concurrency: Locks and synchronization Slides by Prof. Cox.
The Bicycle Ride Kim is visiting a friend's house overnight. Kim's friend Terry lives 3 km away, not too far by bicycle. Kim leaves home and gets 1/3 of.
Alex Goes Grocery Shopping By Jane Ricard Alex is going to buy food at the grocery store with his Mom.
6/27/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
CS162 Operating Systems and Systems Programming Lecture 4 Synchronization, Atomic operations, Locks, Semaphores September 12, 2011 Anthony D. Joseph and.
Homework 3-4 Sarah Diesburg Operating Systems COP 4610.
29 June 2015 Charles Reiss CS162: Operating Systems and Systems Programming Lecture 5: Basic Scheduling + Synchronization.
CS703 – Advanced Operating Systems
Word Problems Dividing!.
COMPSCI210 Recitation 12 Oct 2012 Vamsi Thummala
Too Much Milk With Locks
Too Much Milk With Locks
Andy Wang Operating Systems COP 4610 / CGS 5765
CS 140 Lecture Notes: Concurrency
CS 140 Lecture Notes: Concurrency
Too Much Milk With Locks
Too Much Milk With Locks
Too Much Milk With Locks
CS 140 Lecture Notes: Introduction
(Put name of subject, chapter, topic, etc. HERE)
Lecture 8: Complex Linked List Code reading: 16.2 – 16.3
STORE MANAGER RESPONSIBILITIES.
CS 140 Lecture Notes: Concurrency
CS 140 Lecture Notes: Introduction
CS 140 Lecture Notes: Concurrency
Presentation Title Presenter’s Name.
Insert Your Poster Title Here
Lecture 20: Synchronization
Too Much Milk With Locks
CPS110: Thread cooperation
Don Porter Portions courtesy Emmett Witchel
Presentation transcript:

CS 140 Lecture Notes: ConcurrencySlide 1 Too Much Milk Person A 3:00Arrive home: no milk 3:05Leave for store 3:10Arrive at store 3:15Leave store 3:20Arrive home, put milk away

CS 140 Lecture Notes: ConcurrencySlide 2 Too Much Milk Person APerson B 3:00Arrive home: no milk 3:05Leave for store 3:10Arrive at storeArrive home: no milk 3:15Leave storeLeave for store 3:20Arrive home, put milk awayArrive at store 3:25Leave store 3:30Arrive home: too much milk!

CS 140 Lecture Notes: ConcurrencySlide 3 Computerized Milk Purchase if (!GotMilk) { if (NoNote) { Leave Note; Buy Milk; Remove Note; }

CS 140 Lecture Notes: ConcurrencySlide 4 Still Too Much Milk Thread A:Thread B: if (!GotMilk) { if (NoNote) { if (!GotMilk) { if (NoNote) { Leave Note; Buy Milk; Remove Note; } Leave Note; Buy Milk; Remove Note; }

CS 140 Lecture Notes: ConcurrencySlide 5 Second Attempt Thread A: if (NoNote) { if (!GotMilk) { Buy Milk; } Leave Note; } Thread B: if (Note) { if (!GotMilk) { Buy Milk; } Remove Note; }

CS 140 Lecture Notes: ConcurrencySlide 6 Third Attempt Thread A: 1 Leave NoteA; 2 if (No NoteB) { 3 if (!GotMilk) { 4 Buy Milk; 5 } 6 } 7Remove NoteA; Thread B: 1 Leave NoteB; 2 if (No NoteA) { 3 if (!GotMilk) { 4 Buy Milk; 5 } 6 } 7Remove NoteB;

CS 140 Lecture Notes: ConcurrencySlide 7 Fourth Attempt Thread A: 1 Leave NoteA; 2 if (No NoteB) { 3 if (!GotMilk) { 4 Buy Milk; 5 } 6 } 7Remove NoteA; Thread B: 1 Leave NoteB; 2 while (NoteA) { 3 do nothing 4 } 5 if (!GotMilk) { 6 Buy Milk; 7 } 8Remove NoteB;

CS 140 Lecture Notes: ConcurrencySlide 8