I613: Formal Methods. Mutual Exclusion Problem
|
|
- Samuel Richardson
- 5 years ago
- Views:
Transcription
1 I613: Formal Methods Analysis of the Bakery Protocol (1) Modeling and Specification CafeOBJ Team of Jaist Mutual Exclusion Problem Computer systems have resources such that they are shared by multiple entities (processors, processes, threads, etc.) and should be used by at most one entity at any given moment. The mutual exclusion (mutex) problem is to control multiple entities such that at most one entity is allowed to use shared resources at any given moment. The problem was originally proposed and solved by E.W. Dijkstra*. *Dijkstra, E.W.: Solution of a problem in concurrent programming control, CACM 8(9): 569,
2 Mutual Exclusion Protocols Solutions of the problem are called mutual exclusion (mutex) protocols (algorithms). Many mutex protocols have been designed. Qlock is a mutex protocol. 3 Qlock The program executed by each process i: Loop rs: put(queue,i); ws: repeat until top(queue) = i; Critical Section cs: get(queue); Segments of programs in which shared resources are used are called critical sections. One property Qlock should satisfy is that at most one process is at label cs at any given moment. The property is called the mutual exclusion (mutex) property. 4
3 An Incorrect Variant of Qlock If the program is changed as follows Loop rs: tmp i := insert(queue,i); es: queue := tmp i ; ws: repeat until top(queue) = i; Critical Section cs: deq(queue); the property does not hold for this variant. This is because process IDs are not put into queue atomically (indivisibly). 5 Assumptions on Atomic Operations Mutex protocols can be considered atomic operations, which allow shared resources to be accessed by at most one entity at any given moment. But, many mutex protocols such as Qlock assume lower level atomic operations such as atomic operations (put, top and get) of queues. 6
4 The Bakery Protocol (1) A mutex protocol proposed by L. Lamport*. Does not assume any lower level atomic operations. Writes and reads to a shared variable X can overlap. A read to X while a write to X is being done returns an arbitrary value (an arbitrary sequence of bits). *Lamport, L.: A New Solution of Dijkstra s Concurrent Programming Problem, CACM 17(8): , The Bakery Protocol (2) The program executed by each process i for i = 1,,N: L1: choosing[i] := 1; number[i] := 1 + maximum(number[1],,number[n]); choosing[i] := 0; for j=1 step 1 until N do begin L2: if choosing[j] =/= 0 then goto L2; L3: if number[j] =/= 0 and (number[j],j) < (number[i],i) then goto L3; end; critical section; number[i] := 0; noncritical section; goto L1; 8
5 The Bakery Protocol (3) The type of each variable is integer. choosing[i], number[i], j choosing[i] and number[i] are written by only process i but read by the N processes. Initially, each process i is in the noncritical section and choosing[i] and number[i] are set to 0. The args of the maximum function can be read in any order. maximum(number[1],,number[n]) (a,b) < (c,d) if a < c or (a = c and b < d) (number[j],j) < (number[i],i) 9 The Bakery Protocol (4) If number[i] is not 0, it contains a number given to process i that wants to enter the critical section. The smaller number process i is given, the higher priority it has to enter the critical section. L1: choosing[i] := 1; number[i] := 1 + maximum(number[1],,number[n]); choosing[i] := 0; for j=1 step 1 until N do begin L2: if choosing[j] =/= 0 then goto L2; L3: if number[j] =/= 0 and (number[j],j) < (number[i],i) then goto L3; end; critical section; number[i] := 0; noncritical section; goto L1; 10
6 The Bakery Protocol (5) The same number may be given to multiple processes. If that is the case, process IDs are used to break the tie (the smaller ID, the higher priority). L1: choosing[i] := 1; number[i] := 1 + maximum(number[1],,number[n]); choosing[i] := 0; for j=1 step 1 until N do begin L2: if choosing[j] =/= 0 then goto L2; L3: if number[j] =/= 0 and (number[j],j) < (number[i],i) then goto L3; end; critical section; number[i] := 0; noncritical section; goto L1; 11 The Bakery Protocol (6) If choosing[i] is not 0, a number is being given to process i. If choosing[1],, choosing[n] are not used, the mutex property does not hold even if we assume that writes and reads to number[1],, number[n] are atomic. 12
7 Modeling the Protocol A model (in an engineering sense) of the protocol is made as an OTS. Before making such an OTS, data types used are provided. Natural numbers (are used instead of integers) Pairs of natural numbers Sets of natural numbers (for computing maximum(number[1],,number[n])) Labels See the file bakery.mod. 13 Boolean Terms Boolean terms basically reduce to an exclusive or normal form. Good: A perfect propositional tautology checker. Bad: It can take much time Try reducing p1 or or p10. Some situations where _or-else_ should be used instead of _or_. Attributes assoc & comm are not given to the former in module BOOL. In the file bakery.mod, the attributes are given for convenience. 14
8 Formalizing Overlaps of Writes&Reads An assignment to a shared variable (x := E;) is divided into three parts: Part 1 computes the expression E. Part 2 begins writing the result to the variable x. Part 3 ends the writing. Parts 2&3 are represented by two transition functions beginwtx and endwtx, whose equations are like x(beginwtx(s)) = rand(s) x(endwtx(s)) = theresult where rand(s) returns an arbitrary value. Between parts 2&3, reading x returns an arbitrary value. 15 Formalizing Comp of maximum (1) maximum(number[1],,number[n]) is computed as follows: 1. Set temporary variables tmp and m to {1,,N} and If tmp is empty, the computation is done (m contains the result); otherwise go to Choose and delete a number k arbitrarily from tmp, set m to max(m,k), and go to 1. The three steps are represented by three transition functions settmp, checklc and findmax. 16
9 Formalizing Comp of maximum (2) Part of the equations are like 1. pc(settmp(s)) = 2 tmp(settmp(s)) = {1,,N} m(settmp(s)) = 0 2. pc(checklc(s)) = if empty?(tmp(s)) then 4 else 3 fi tmp(checklc(s)) = tmp(s) m(checklc(s)) = m(s) 3. If K in tmp(s) then pc(findmax(s,k)) = 2 tmp(finfmax(s,k)) = del(tmp(s),k) m(findmax(s,k)) = max(m(s),k) Observation Functions (1) 7 observation functions are used. bop pc : Sys Nat -> Label bop choosing : Sys Nat -> Nat bop number : Sys Nat -> Nat bop j : Sys Nat -> Nat bop tmp : Sys Nat -> NatSet bop m : Sys Nat -> Nat bop rand : Sys -> Nat 18
10 Observation Functions (2) Given a state s and a process ID i, pc(s,i) returns the label at which i is in s. choosing(s,i) returns the value of choosing[i] in s. number(s,i) returns the value of number[i] in s. j(s,i) returns the value of j (owned by i) in s. tmp(s,i) returns a set of natural numbers. m(s,i) returns a natural number. rand(s) returns an arbitrary natural number. 19 Observation Functions (3) Initially each observation function returns the following values: pc(init,i) = ncs choosing(init,i) = 0 number(init,i) = 0 rand(init) = seed where init denotes an arbitrary initial state and seed denotes an arbitrary natural number. j, tmp and m return an arbitrary natural number, an arbitrary set of natural numbers and an arbitrary natural number, respectively. 20
11 Transition Functions (1) 18 transition (action) functions are used. bop beginwtch1 : Sys Nat -> Sys bop endwtch1 : Sys Nat -> Sys bop settmp : Sys Nat -> Sys bop checklc1 : Sys Nat -> Sys bop findmax : Sys Nat Nat -> Sys bop beginwtnum1 : Sys Nat -> Sys bop endwtnum1 : Sys Nat -> Sys bop beginwtch2 : Sys Nat -> Sys bop endwtch2 : Sys Nat -> Sys bop setj : Sys Nat -> Sys bop checklc2 : Sys Nat -> Sys bop checkch : Sys Nat -> Sys bop checknum : Sys Nat -> Sys bop execcs : Sys Nat -> Sys bop beginwtnum2 : Sys Nat -> Sys bop endwtnum2 : Sys Nat -> Sys bop execncs : Sys Nat -> Sys bop trycs : Sys Nat -> Sys 21 Transition Functions (2) l1: beginwtch1(_,i) l2: endwtch1(_,i) L1: choosing[i] := 1; See the file bakery.mod. 22
12 Transition Functions (3) l3: settmp(_,i) l4: checklc1(_,i) l5: findmax(_,i,k) l6: beginwtnum1(_,i) l7: endwtnum1(_,i) number[i] := 1 + maximum(number[1],,number[n]); See the file bakery.mod. 23 Transition Functions (4) l8: beginwtch2(_,i) l9: endwtch2(_,i) choosing[i] := 0; See the file bakery.mod. 24
13 Transition Functions (5) l10: setj(_,i) l11: checklc2(_,i) l12: checkch(_,i,k) l13: checknum(_,i) for j=1 step 1 until N do begin L2: if choosing[j] =/= 0 then goto L2; L3: if number[j] =/= 0 and (number[j],j) < (number[i],i) then goto L3; end; See the file bakery.mod. 25 Transition Functions (6) cs: execcs(_,i) critical section; l14: beginwtnum2(_,i) l15: end WtNum2(_,i) number[i] := 0; ncs: execncs(_,i) ncs: trycs(_,i) noncritical section; goto L1; See the file bakery.mod. 26
14 Any Problems? (1) Operator choose is used to choose a number arbitrarily from a set. mod! NSET { pr(pnat) [Nat < NSet] op empty : -> NSet op : NSet NSet -> NSet {assoc comm id: empty} op choose : NSet -> Nat var S : NSet var X : Nat eq choose(x S) = X. } 27 Any Problems? (2) choose(s(0) s(s(0))) = choose(s(0) s(s(0))) = = s(s(0))? = choose(s(s(0)) s(0)) s(0) = Equation choose(x S) = X introduces confusion. 28
Announcements. Office hours. Reading. W office hour will be not starting next week. Chapter 7 (this whole week) CMSC 412 S02 (lect 7)
Office hours Announcements W office hour will be 10-11 not 11-12 starting next week Reading Chapter 7 (this whole week) 1 Problems with the Producer-Consumer Shared Memory Solution Consider the three address
More information1 Algorithmic Solution
Computer Science & Engineering Department I. I. T. Kharagpur Operating System: CS33007 3rd Year CSE: 5th Semester (Autumn 2006-2007) Lecture X (Mutual Exclusion of CS) Goutam Biswas Date: 28th-29th August,
More informationCS586: Distributed Computing Tutorial 3
CS586: Distributed Computing Tutorial 3 Professor: Panagiota Fatourou TA: Eleftherios Kosmas CSD - October 2011 Mutual Exclusion - Exercise 1 Present an execution of the Bakery Algorithm where the sequence
More informationBackground. Module 6: Process Synchronization. Bounded-Buffer (Cont.) Bounded-Buffer. Background
Module 6: Process Synchronization Background Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization
More informationProcess Synchronization
Process Synchronization Mandar Mitra Indian Statistical Institute M. Mitra (ISI) Process Synchronization 1 / 28 Cooperating processes Reference: Section 4.4. Cooperating process: shares data with other
More informationProcess Synchronization
Chapter 7 Process Synchronization 1 Chapter s Content Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors 2 Background
More informationChapter 7: Process Synchronization. Background
Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris
More informationSAMPLE MIDTERM QUESTIONS
SAMPLE MIDTERM QUESTIONS CS 143A Notes: 1. These questions are just for you to have some questions to practice. 2. There is no guarantee that there will be any similarities between these questions and
More informationChapter 7: Process Synchronization. Background. Illustration
Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris
More informationConcurrency: Mutual Exclusion and Synchronization
Concurrency: Mutual Exclusion and Synchronization 1 Needs of Processes Allocation of processor time Allocation and sharing resources Communication among processes Synchronization of multiple processes
More informationModule 6: Process Synchronization
Module 6: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris
More informationLast class: Today: CPU Scheduling. Start synchronization
Last class: CPU Scheduling Today: Start synchronization Synchronization Processes (threads) share resources. How do processes share resources? How do threads share resources? It is important to coordinate
More informationProcess Coordination
Process Coordination Why is it needed? Processes may need to share data More than one process reading/writing the same data (a shared file, a database record, ) Output of one process being used by another
More informationConcurrency: Mutual Exclusion and
Concurrency: Mutual Exclusion and Synchronization 1 Needs of Processes Allocation of processor time Allocation and sharing resources Communication among processes Synchronization of multiple processes
More informationOperating Systems CMPSC 473. Synchronization February 21, Lecture 11 Instructor: Trent Jaeger
Operating Systems CMPSC 473 Synchronization February 21, 2008 - Lecture 11 Instructor: Trent Jaeger Last class: CPU Scheduling Today: A little more scheduling Start synchronization Little s Law Evaluating
More information! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA
Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics! Why is synchronization needed?! Synchronization Language/Definitions:» What are race
More informationאלגוריתמי הסנכרון. 1. Lock Variables Mutual Exclusion: No Deadlock-Free: Yes Starvation-Free: No
בס"ד אלגוריתמי הסנכרון 1. Lock Variables Mutual Exclusion: No Shared: int lock Initially : lock = 0 await( lock = 0) lock = 1 lock = 0 2. Strict Alternation (2) (2) await( turn = 0) turn = 1 await( turn
More informationAnalysis of the Suzuki-Kasami Algorithm with the Maude Model Checker
Analysis of the Suzuki-Kasami Algorithm with the Maude Model Checker Kazuhiro Ogata NEC Software Hokuriku, Ltd. ogatak@acm.org Kokichi Futatsugi School of Information Science, JAIST kokichi@jaist.ac.jp
More informationVerification of Bakery algorithm variants for two processes
Verification of Bakery algorithm variants for two processes David Dedi 1, Robert Meolic 2 1 Nova Vizija d.o.o., Vreerjeva ulica 8, SI-3310 Žalec 2 Faculty of Electrical Engineering and Computer Science,
More informationChapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization?
Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions:» What are race conditions?»
More informationSynchronization for Concurrent Tasks
Synchronization for Concurrent Tasks Minsoo Ryu Department of Computer Science and Engineering 2 1 Race Condition and Critical Section Page X 2 Algorithmic Approaches Page X 3 Hardware Support Page X 4
More informationMethod and case study of model checking concurrent systems that use unbounded timestamps
2017 IEEE 22nd Pacific Rim International Symposium on Dependable Computing Method and case study of model checking concurrent systems that use unbounded timestamps Shinya Nakano Graduate School of Information
More informationDorel LUCANU. University Al.I.Cuza of Iaşi Department of Computer Science Berthelot Iaşi, Romania
Dorel LUCANU University Al.I.Cuza of Iaşi Department of Computer Science Berthelot 16 6600-Iaşi, Romania e-mail: dlucanu@infoiasi.ro Understanding CafeOBJ by examples (Introduction to concurrent object-oriented
More informationInterprocess Communication 11
Interprocess Communication 11 Only a brain-damaged operating system would support task switching and not make the simple next step of supporting multitasking. Calvin Keegan Processes Abstraction of a running
More informationDept. of CSE, York Univ. 1
EECS 3221.3 Operating System Fundamentals No.5 Process Synchronization(1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Background: cooperating processes with shared
More informationQUESTION BANK. UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks)
QUESTION BANK DEPARTMENT: EEE SEMESTER VII SUBJECT CODE: CS2411 SUBJECT NAME: OS UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks) 1. What is deadlock? (AUC NOV2010) A deadlock is a situation
More informationCSCI [4 6] 730 Operating Systems. Example Execution. Process [& Thread] Synchronization. Why does cooperation require synchronization?
Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions: What are race conditions? What
More informationSPIN, PETERSON AND BAKERY LOCKS
Concurrent Programs reasoning about their execution proving correctness start by considering execution sequences CS4021/4521 2018 jones@scss.tcd.ie School of Computer Science and Statistics, Trinity College
More information1. Motivation (Race Condition)
COSC4740-01 Operating Systems Design, Fall 2004, Byunggu Yu Chapter 6 Process Synchronization (textbook chapter 7) Concurrent access to shared data in the data section of a multi-thread process, in the
More informationExample Threads. compile: gcc mythread.cc -o mythread -lpthread What is the output of this program? #include <pthread.h> #include <stdio.
Example Threads #include #include int num = 0; void *add_one(int *thread_num) { num++; printf("thread %d num = %d\n", *thread_num, num); } void main() { pthread_t thread; int my_id
More informationi217 Functional Programming 7. Multisets
I217: Functional Programming 7. Kazuhiro Ogata i217 Functional Programming 7. 2 Roadmap the Mutex Protocol Simulator i217 Functional Programming 7. 3 Collections such that multiple occurrences of elements
More informationLecture 3 SPIN and Promela
Lecture 3 SPIN and Promela 1 What is SPIN(Simple Promela INterpreter) A tool for analyzing mels of concurrent systems Mels described in Promela Language with concurrent processes Communication via shared
More informationComputer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: Process Synchronization Examples
Computer Science 322 Operating Systems Mount Holyoke College Spring 2008 Topic Notes: Process Synchronization Examples Bounded Buffer Example leaving one buffer slot empty int buffer[n]; int in=0; int
More informationConcept of a process
Concept of a process In the context of this course a process is a program whose execution is in progress States of a process: running, ready, blocked Submit Ready Running Completion Blocked Concurrent
More informationSynchronization: Semaphores
Illinois Institute of Technology Lecture 26 4/25 solved Synchronization: Semaphores CS 536: Science of Programming, Spring 2018 A. Why Avoiding interference, while good, isn t the same as coordinating
More informationProcesses. Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra
Processes Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra Processes Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication Process Concept Early
More informationChapter 6: Synchronization
Chapter 6: Synchronization Module 6: Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization
More informationThe Maude LTL LBMC Tool Tutorial
The Maude LTL LBMC Tool Tutorial Kyungmin Bae 1, Santiago Escobar 2, and José Meseguer 1 1 University of Illinois at Urbana-Champaign, IL, USA 2 Universidad Politécnica de Valencia, Spain Abstract. A concurrent
More informationTemporal Logic of Actions (TLA) (a brief introduction) Shmuel Katz Computer Science Department The Technion
Temporal Logic of Actions (TLA) (a brief introduction) Shmuel Katz Computer Science Department The Technion CS236368 Formal Specifications Lecture-- TLA 1 Basic Idea Combine transitions with temporal logic
More informationCSC 1600: Chapter 6. Synchronizing Threads. Semaphores " Review: Multi-Threaded Processes"
CSC 1600: Chapter 6 Synchronizing Threads with Semaphores " Review: Multi-Threaded Processes" 1 badcnt.c: An Incorrect Program" #define NITERS 1000000 unsigned int cnt = 0; /* shared */ int main() pthread_t
More informationSynchronization I. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Synchronization I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics Synchronization problem Locks 2 Synchronization Threads cooperate
More informationDekker s algorithms for Semaphores Implementation. ALI TARIQ AL-KHAYYAT ( ) Submitted to : Prof. Dr. Huseyin Balik
Dekker s algorithms for Semaphores Implementation ALI TARIQ AL-KHAYYAT ( 163101413 ) Submitted to : Prof. Dr. Huseyin Balik what is Dekker s algorithm. Dekker s General algorithms. What is Semaphores.
More informationENGR 3950U / CSCI 3020U UOIT, Fall 2012 Quiz on Process Synchronization SOLUTIONS
Name: Student Number: SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Quiz on Process Synchronization November 13, 2012, Duration: 40 Minutes (10 questions and 8 pages, 45 Marks) Instructor: Dr.
More informationInterprocess Communication 12
Interprocess Communication 12 Only a brain-damaged operating system would support task switching and not make the simple next step of supporting multitasking. Calvin Keegan Processes Abstraction of a running
More informationBuilt-in Module BOOL. Lecture Note 01a
Built-in Module BOOL Lecture Note 01a Topics! Built-in Boolean Algebra module BOOL and the equivalence of two boolean expressions (or SAT problems)! Study important concepts about CafeOBJ system through
More informationTimo Latvala. January 28, 2004
Reactive Systems: Kripke Structures and Automata Timo Latvala January 28, 2004 Reactive Systems: Kripke Structures and Automata 3-1 Properties of systems invariants: the system never reaches a bad state
More informationCafeOBJ. CafeOBJ. Starting CafeOBJ. Wolfgang Schreiner 1. A Quick Overview. 2.
CafeOBJ Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at 1. A Quick Overview Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at
More information$ %! 0,-./ + %/ 0"/ C (" &() + A &B' 7! .+ N!! O8K + 8 N. (Monitors) 3+!
"#! $ %! *+ &' & "-/ &+, :/!! &+ 8/!.!"!! > &, < &+ 7!! "-/ :/= +. :/= 0 0/ 7!@?+ C (" & + A &B' 7! G' 3/ 0"=' 7> H 0 4 0! &D E.! 0 n I"2 &+ % &B' 0!!! n 1 + counter J " &B' & K n
More informationCS 152 Computer Architecture and Engineering. Lecture 19: Synchronization and Sequential Consistency
CS 152 Computer Architecture and Engineering Lecture 19: Synchronization and Sequential Consistency Krste Asanovic Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~krste
More informationCS 252 Graduate Computer Architecture. Lecture 11: Multiprocessors-II
CS 252 Graduate Computer Architecture Lecture 11: Multiprocessors-II Krste Asanovic Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~krste http://inst.eecs.berkeley.edu/~cs252
More informationLecture #7: Shared objects and locks
Lecture #7: Shared objects and locks Review -- 1 min Independent v. cooperating threads -- can't reason about all possible interleavings Too much milk: Solution #3 to too much milk works, but it is really
More informationMutual Exclusion: Classical Algorithms for Locks
Mutual Exclusion: Classical Algorithms for Locks John Mellor-Crummey Department of Computer Science Rice University johnmc@cs.rice.edu COMP 422 Lecture 18 21 March 2006 Motivation Ensure that a block of
More informationDiscussion: Monitors, Bankers and Bakers. CSE 120 Fall 2007 Wenjing Rao
Discussion: Monitors, Bankers and Bakers CSE 120 Fall 2007 Wenjing Rao Hoare Monitors with semaphores Assume a Hoare-style monitor m with a single condition c (easily generalized for multiple conditions).
More informationConsistency & Coherence. 4/14/2016 Sec5on 12 Colin Schmidt
Consistency & Coherence 4/14/2016 Sec5on 12 Colin Schmidt Agenda Brief mo5va5on Consistency vs Coherence Synchroniza5on Fences Mutexs, locks, semaphores Hardware Coherence Snoopy MSI, MESI Power, Frequency,
More informationProcess Synchronization and Cooperation
January 13, 2000 ECS 251 Winter 2000 Page 1 Process Synchronization and Cooperation 1. Parallelism a. concurrent vs. sequential b. logical vs. physical concurrency c. process creation: static vs. dynamic
More informationCS477 Formal Software Development Methods / 39
CS477 Formal Software Development Methods 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 SPIN Beginners Tutorial April 11, 2018 Hello World /* A "Hello World" Promela model for
More informationT Reactive Systems: Kripke Structures and Automata
Tik-79.186 Reactive Systems 1 T-79.186 Reactive Systems: Kripke Structures and Automata Spring 2005, Lecture 3 January 31, 2005 Tik-79.186 Reactive Systems 2 Properties of systems invariants: the system
More informationCSE 486/586 Distributed Systems
CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo CSE 486/586 Recap: Consensus On a synchronous system There s an algorithm that works. On
More informationSemaphores. May 10, Mutual exclusion with shared variables is difficult (e.g. Dekker s solution).
Semaphores May 10, 2000 1 Introduction Mutual exclusion with shared variables is difficult (e.g. Dekker s solution). Generalising to an arbitrary number of processes is also nontrivial (e.g. Lamport s
More informationProcess Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Process Synchronization: Semaphores CSSE 332 Operating Systems Rose-Hulman Institute of Technology Critical-section problem solution 1. Mutual Exclusion - If process Pi is executing in its critical section,
More informationUNIT:2. Process Management
1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria
More informationUNIT II PROCESS MANAGEMENT 9
UNIT II PROCESS MANAGEMENT 9 Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows
More informationChapter 8. Basic Synchronization Principles
Chapter 8 Basic Synchronization Principles Need for Synchronization Multiprogramming Multiple concurrent, independent processes Those processes might want to coordinate activities Proc A { while (true)
More informationComp 310 Computer Systems and Organization
Comp 310 Computer Systems and Organization Lecture #10 Process Management (CPU Scheduling & Synchronization) 1 Prof. Joseph Vybihal Announcements Oct 16 Midterm exam (in class) In class review Oct 14 (½
More informationCSCE 531 Spring 2009 Final Exam
CSCE 531 Spring 2009 Final Exam Do all problems. Write your solutions on the paper provided. This test is open book, open notes, but no electronic devices. For your own sake, please read all problems before
More informationLast Class: Synchronization
Last Class: Synchronization Synchronization primitives are required to ensure that only one thread executes in a critical section at a time. Concurrent programs Low-level atomic operations (hardware) load/store
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 11 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel Feedback Queue: Q0, Q1,
More informationComputing Fundamentals 2 Introduction to CafeOBJ
Computing Fundamentals 2 Introduction to CafeOBJ Lecturer: Patrick Browne Lecture Room: K408 Lab Room: A308 Based on work by: Nakamura Masaki, João Pascoal Faria, Prof. Heinrich Hußmann. See notes on slides
More informationSistemi in tempo reale Anno accademico
Sistemi in tempo reale Anno accademico 2006-2007 Concorrenza - II Giuseppe Lipari http://feanor.sssup.it/~lipari Scuola Superiore Sant Anna Outline 1 Introduction to concurrency 2 Models of concurrency:
More information[module 2.2] MODELING CONCURRENT PROGRAM EXECUTION
v1.0 20130407 Programmazione Avanzata e Paradigmi Ingegneria e Scienze Informatiche - UNIBO a.a 2013/2014 Lecturer: Alessandro Ricci [module 2.2] MODELING CONCURRENT PROGRAM EXECUTION 1 SUMMARY Making
More informationReal Time & Embedded Systems. Final Exam - Review
Real Time & Embedded Systems Final Exam - Review Final Exam Review Topics Finite State Machines RTOS Context switching Process states Mutex - purpose and application Blocking versus non-blocking Synchronous
More informationCS422 - Programming Language Design
1 CS422 - Programming Language Design Two Rewrite Logic Based Programming Language Definitional Styles Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 We next show
More informationTool demonstration: Spin
Tool demonstration: Spin 1 Spin Spin is a model checker which implements the LTL model-checking procedure described previously (and much more besides). Developed by Gerard Holzmann of Bell Labs Has won
More informationWhat is SPIN(Simple Promela Interpreter) Material About SPIN. Elements of Promela. Basic Variables and Types. Typical Structure of Promela Model
What is SPIN(Simple Promela Interpreter) Lecture 3 SPIN and Promela A tool for analyzing mels of reactive systems Mels described in Promela Language with concurrent processes, Communication via channels,
More informationThreading and Synchronization. Fahd Albinali
Threading and Synchronization Fahd Albinali Parallelism Parallelism and Pseudoparallelism Why parallelize? Finding parallelism Advantages: better load balancing, better scalability Disadvantages: process/thread
More informationCS510 Advanced Topics in Concurrency. Jonathan Walpole
CS510 Advanced Topics in Concurrency Jonathan Walpole Threads Cannot Be Implemented as a Library Reasoning About Programs What are the valid outcomes for this program? Is it valid for both r1 and r2 to
More informationSemaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }
Semaphore Semaphore S integer variable Two standard operations modify S: wait() and signal() Originally called P() and V() Can only be accessed via two indivisible (atomic) operations wait (S) { while
More informationProcess Management And Synchronization
Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the
More informationCS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables
CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use
More informationOn Formal Analysis of OO Languages using. OO Languages and Rewriting Logic: Designing for Performance
On Formal Analysis of OO Languages using Rewriting Logic: Designing for Performance {mhills, grosu}@cs.uiuc.edu Department of Computer Science University of Illinois at Urbana-Champaign 6 June 2007 1 2
More informationIV. Process Synchronisation
IV. Process Synchronisation Operating Systems Stefan Klinger Database & Information Systems Group University of Konstanz Summer Term 2009 Background Multiprogramming Multiple processes are executed asynchronously.
More informationChapter 5 Asynchronous Concurrent Execution
Chapter 5 Asynchronous Concurrent Execution Outline 5.1 Introduction 5.2 Mutual Exclusion 5.2.1 Java Multithreading Case Study 5.2.2 Critical Sections 5.2.3 Mutual Exclusion Primitives 5.3 Implementing
More informationPropositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson
Propositional Calculus: Boolean Algebra and Simplification CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Topics Motivation: Simplifying Conditional Expressions
More informationWhat is SPIN(Simple Promela Interpreter) Elements of Promela. Material About SPIN. Basic Variables and Types. Typical Structure of Promela Model
What is SPIN(Simple Promela Interpreter) Lecture XX SPIN and Promela A tool for analyzing mels of reactive systems Mels described in Promela Language with concurrent processes, Communication via channels,
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 12 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ 2 Mutex vs Semaphore Mutex is binary,
More informationNon-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei
Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness
More informationProcess Synchronization(2)
EECS 3221.3 Operating System Fundamentals No.6 Process Synchronization(2) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Semaphores Problems with the software solutions.
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and
More informationCONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Design
CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS422 Programming Language Design Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and tools,
More information4/6/2011. Model Checking. Encoding test specifications. Model Checking. Encoding test specifications. Model Checking CS 4271
Mel Checking LTL Property System Mel Mel Checking CS 4271 Mel Checking OR Abhik Roychoudhury http://www.comp.nus.edu.sg/~abhik Yes No, with Counter-example trace 2 Recap: Mel Checking for mel-based testing
More informationSynchronization. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han
Synchronization CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Announcements HW #3 is coming, due Friday Feb. 25, a week+ from now PA #2 is coming, assigned about next Tuesday Midterm is tentatively
More informationCS 152 Computer Architecture and Engineering. Lecture 19: Synchronization and Sequential Consistency
CS 152 Computer Architecture and Engineering Lecture 19: Synchronization and Sequential Consistency Krste Asanovic Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~krste
More informationMutual Exclusion. 1 Formal problem definitions. Time notion CSE /17/2015. Outline of this lecture:
CSE 539 03/17/2015 Mutual Exclusion Lecture 15 Scribe: Son Dinh Outline of this lecture: 1. Formal problem definitions 2. Solution for 2 threads 3. Solution for n threads 4. Inherent costs of mutual exclusion
More informationCHAPTER 8. Copyright Cengage Learning. All rights reserved.
CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation
More informationLecture Topics. Announcements. Today: Concurrency (Stallings, chapter , 5.7) Next: Exam #1. Self-Study Exercise #5. Project #3 (due 9/28)
Lecture Topics Today: Concurrency (Stallings, chapter 5.1-5.4, 5.7) Next: Exam #1 1 Announcements Self-Study Exercise #5 Project #3 (due 9/28) Project #4 (due 10/12) 2 Exam #1 Tuesday, 10/3 during lecture
More informationThe SPIN Model Checker
The SPIN Model Checker Metodi di Verifica del Software Andrea Corradini GianLuigi Ferrari Lezione 3 2011 Slides per gentile concessione di Gerard J. Holzmann 2 the do-statement do :: guard 1 -> stmnt 1.1
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS
More informationProgramming Languages
TECHNISCHE UNIVERSITÄT MÜNCHEN FAKULTÄT FÜR INFORMATIK Programming Languages Concurrency: Atomic Executions, Locks and Monitors Dr. Michael Petter Winter term 2016 Atomic Executions, Locks and Monitors
More informationAnnouncement. Due data of HW#4 is on Sunday. Due data of Exercise # 5 is on Friday. Two more office hours on this weekend for HW#4.
Announcement Due data of HW#4 is on Sunday. Due data of Exercise # 5 is on Friday. Two more office hours on this weekend for HW#4. Saturday 3-4 pm Sunday 6-7 pm Operating Systems: Internals and Design
More informationCS4411 Intro. to Operating Systems Exam 1 Fall points 9 pages
CS4411 Intro. to Operating Systems Exam 1 Fall 2009 1 CS4411 Intro. to Operating Systems Exam 1 Fall 2009 150 points 9 pages Name: Most of the following questions only require very short answers. Usually
More information