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
Over. new sound name take only good am boy.
Advertisements

Get. through back much go good new write out.
Over. new sound take only little work know.
Synchronization NOTE to instructors: it is helpful to walk through an example such as readers/writers locks for illustrating the use of condition variables.
So different. too old so long because of him.
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.
Israeli’s Terrorism. There is Nothing called Israeli’s Terrorism !!!
First steps  First get out a mug from your cupboard.  Next pour cold water into your kettle.  Then press the button and wait for it to boil.
Phrasal verbs practice. A list of phrasal verbs: Take after Take after Take after Take after Take over Take over Take over Take over Break up Break up.
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.
The First 200 Most Commonly Used English Words Taken from: The Reading Teachers Book of Lists, Third Edition, by Edward Bernard Fry, Ph.D, Jacqueline E.
Threads and Critical Sections Vivek Pai / Kai Li Princeton University.
Will Internet shopping kill off the High Street? Aim: To produce our own online retail store.
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.
High Frequency Words The second 100 get through.
Synchronization Andy Wang Operating Systems COP 4610 / CGS 5765.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
Autumn, 2014C.-S. Shieh, EC, KUAS, Taiwan1 智慧電子應用設計導論 (1/3) Audio Chin-Shiuh Shieh ( 謝欽旭 ) Department of Electronic Engineering.
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.
Industrial Revolution Lecture pt. II Transitions in the Manufacturing of Goods.
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.
Witness to a crime You have been asked by the police to describe the suspect that you saw commit a crime.
Fry Sight Word Inventory Second 100 Words New Sound.
Sight Words - List B Words over new sound.
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.
Walking between home and school. Leaving home in the morning on your walk to school.
Writing Good Sentences – Part 4 Run-on Sentences.
The Rainforest By: Melissa Surratt Take a walk. You were taking a walk though the rainforest. When I walked to a fork in the road. Go left Go right Taking.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
CS 160 Lecture 4 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
My Fire Safety Book By:. My house is safe! My family has made my house word from fire. We have talked about fire safety in our home.
CS162 Operating Systems and Systems Programming Lecture 4 Synchronization, Atomic operations, Locks September 10, 2012 Ion Stoica
Sight Words List B. over new sound take only.
Today’s lecture Review chapter 5 go over exercises.
Midterm exam Info IAT106 Spring 2016
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.
Christmas in America. Christmas Christmas is December 25 th. Christmas has 2 purposes. Christmas is a holiday to celebrate Jesus’ birthday. (religious)
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.
Daily Fix-It please put the cup hear. try knot to spill it.
Word Problems Dividing!.
Too Much Milk With Locks
Too Much Milk With Locks
Andy Wang Operating Systems COP 4610 / CGS 5765
Adding MLA Format Page Numbers to a Word Document
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
Arrivals09:41 Please do not leave your baggage unattended.
CS 140 Lecture Notes: Introduction
(Put name of subject, chapter, topic, etc. HERE)
STORE MANAGER RESPONSIBILITIES.
Using the readings and this information, fill out your map with key details about slavery through time. Pay particular attention to approximate dates when.
CS 140 Lecture Notes: Concurrency
CS 140 Lecture Notes: Introduction
How to find the nth rule for a linear sequence
CS 140 Lecture Notes: Concurrency
Presentation Title Presenter’s Name.
Lecture 20: Synchronization
Goals Design decisions Design Insertion
Too Much Milk With Locks
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 Roomate ARoomate 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 (milk == 0) { if (note == 0) { note = 1; buyMilk(); note = 0; }

CS 140 Lecture Notes: ConcurrencySlide 4 Still Too Much Milk Thread A:Thread B: if (milk == 0) { if (note == 0) { if (milk == 0) { if (note == 0) { note = 1; buyMilk(); note = 0; } note = 1; buyMilk(); note = 0; }

CS 140 Lecture Notes: ConcurrencySlide 5 Second Attempt Thread A: if (note == 0) { if (milk == 0) { buyMilk(); } note = 1; } Thread B: if (note == 1) { if (milk == 0) { buyMilk(); } note = 0; }

CS 140 Lecture Notes: ConcurrencySlide 6 Third Attempt Thread A: 1 noteA = 1; 2 if (noteB == 0) { 3 if (milk == 0) { 4 buyMilk(); 5 } 6 } 7noteA = 0; Thread B: 1 noteB = 1; 2 if (noteA == 0) { 3 if (milk == 0) { 4 buyMilk(); 5 } 6 } 7noteB = 0;

CS 140 Lecture Notes: ConcurrencySlide 7 Fourth Attempt Thread A: 1 noteA = 1; 2 if (noteB == 0) { 3 if (milk == 0) { 4 buyMilk(); 5 } 6 } 7noteA = 0; Thread B: 1 noteB = 1; 2 while (noteA == 1) { 3 // do nothing 4 } 5 if (milk == 0) { 6 buyMilk(); 7 } 8noteB = 0;

CS 140 Lecture Notes: ConcurrencySlide 8