INF 4140: Models of Concurrency Series 3

Size: px
Start display at page:

Download "INF 4140: Models of Concurrency Series 3"

Transcription

1 Universitetet i Oslo Institutt for Informatikk PMA Olaf Owe, Martin Steffen, Toktam Ramezani INF 4140: Models of Concurrency Høst 2016 Series Topic: Semaphores (Exercises with hints for solution) Issued: Exercise 1 (CS with coordinator) In the critical section protocols in the book, every process executes the same algorithm; these are symmetric solutions. It is also possible to solve the problem using a coordinator process. In particular, when a regular process CS[i] wants to enter its critical section, it tells the coordinator, then waits for the coordinator to grant permission. Assume there are n processes numbered 1 to n. Develop entry and exit protocols for the regular processes and code for the coordinator process. Use flags and await-statements for synchronization. The solution must work, if regular processes terminate outside the critical section. Solution: [of Exercise 1] As usual for mutex and critical sections, the focus is on the entry protocol, the exit protocol is more or less simple. Again, the skeleton of the processes and (and of the coordinator) is as always: a big while-loop. Now: the presence of a coordinator makes the design actually pretty simple: each process, in its entry protocol, has to go through the stages: apply for the entry to the CS, and way for being granted access. For expressing the wish, the protocol uses, of course, shared variables. The easiest way to arrange that, it seems is to arrange for each participant for a separate, private channel with the coordinator. The arrangement indeed works a bit like channel communication, where the await-statement is used for synchronization. Furthermore, the communication (or at least signalling/sycnhronization) between the coordinator and each participant can be seen as bi-directional: eeach process communicates to the coordinator its intention to enter, and then waits until the coordinator gives the green light. The back-channel go is shared among all processes, and its the identity which indicates who is allowed to continue. At the exit protocol, the exiting process does not to indicate its identity, as there only one process that exits. The stage of expressing one s wish to enter is, of course, present in many CS protocols. Often, the tricky part of CS/mutex is: given a number of processes that want to enter, for instance by having expressed their which to enter using for instance a particular shared variable as flag, decide, which one is allowed to enter (without of course making the basic error of letting more than one enter, or introducing a deadlock, but in particular, without being unfair and allowing progress/liveness). Breaking the symmetry becomes much easier with a coordinator. 1 1 The general problem of breaking the symmetry in a set of symmetric processes such that they agree on a common solution is known as distributed consensus and is notoriously complex. Here, in a way, the specific consensus to agree upon is: when having more than one process wishing to enter, find a consensus about who is the one and only one who is allowed to enter. An additional complication of CS is that this is done repeatedly and for dealing with this repetition, fairness becomes important.

2 Each process indicates its wish to enter by communicating its identity to the coodinator, and waits. The coordinator picks one it acts thereby like a scheduler deblocks the picked process, and the whole thing continues like that. 1 int try [ 1 : n ] = ( [ n ] 0 ) ; 2 int go = 0 ; 3 4 process CS [ i =1 to n ] { 5 while ( true ){ 6 try [ i ] := 1 ; // i n d i c a t e i n t e n t i o n 7 <await ( go = i ) >; // wait for being granted 8 critical section 9 go := 0 ; 10 } 11 } 12 process c o o r d i n a t o r { 13 while ( true ) { 14 for [ i = 1 to n ] { // round robin 15 i f ( try [ i ] = 1) { 16 try [ i ] := 0 ; 17 go := i ; 18 < await ( go = 0 ) ; > 19 } 20 } 21 } 22 } This solution is fair. The coordinator checks the processes in a round robin manner, which means that a given process can be passed by at most n 1 other processes. By this, a given user process is guaranteed eventual entry. Many symmetric protocol do the following: when trying to enter and seeing a conflict in that someone else whats to enter to, they retract their wish temporarily (perhaps to avoid deadlock) and try again. That makes liveness (eventual entry) tricky (in particular if we don t have strong fairness). Here, it s pretty simple: a process indicates its wish, suspends, i.e., it never retracts it wish and the loop of the coordinator at some point, latest after going through the whole array of processes. Exercise 2 (Semaphores to pass control) Given the following routine: 1 p r i n t ( ) { 2 3 process P1 { 4 w r i t e ( l i n e 1 ) ; w r i t e ( l i n e 2 ) ; 5 } 6 7 process P2 { 8 w r i t e ( l i n e 3 ) ; w r i t e ( l i n e 4 ) ; 9 } process P3 { 12 w r i t e ( l i n e 5 ) ; w r i t e ( l i n e 6 ) ; 13 } } 1. How many different outputs could this program produce? Explain your reasoning. 2

3 2. Add semaphores to the program so that the six lines of output are printed in the order 1, 2, 3, 4, 5, 6. Declare and initialize any semaphores you need and add P and V operations to the above processes. Solution: Perhaps one should explain what control is. 1. For n processes doing m atomic statements each, the number of different runs are: In this case, n = 3 and m = 2 which gives: (n m)! m! n (3 2)! 2! 3 = 6! 2 3 = = Analysing the problem should be quite straightforward: We must have P 2 wait until P 1 is finished (terminated) and same for P 3, which must wait until P 2 is finished. There are therefore 2 signalling or synchronization needs. It is therefore natural to use two semaphores: 1 p r i n t ( ) { 2 sem go2 = 0, go3 = 0 ; 3 4 process P1 { 5 w r i t e ( l i n e 1 ) ; w r i t e ( l i n e 2 ) ; 6 V( go2 ) ; 7 } 8 9 process P2 { 10 P( go2 ) ; 11 w r i t e ( l i n e 3 ) ; w r i t e ( l i n e 4 ) ; 12 V( go3 ) ; 13 } process P3 { 16 P( go3 ) ; 17 w r i t e ( l i n e 5 ) ; w r i t e ( l i n e 6 ) ; 18 } 19 } Exercise 3 (Semaphores for synchronization) Several processes share a resource that has U units. Processes request one unit at a time, but may release several. The routines request and release are atomic operations as shown below. 1 int f r e e := U; 2 3 r e q u e s t ( ) : # < await ( f r e e > 0) f r e e := f r e e 1 ; > 4 5 r e l e a s e ( int number ) : # < f r e e := f r e e + number ; > Develop implementations of request and release. Use semaphores for synchronization. Be sure to declare and initialize additional variables you may need. Solution: Solution due to Andrews. It uses split binary semaphores. See also the split-binary sem solution at the end of the semaphore slides (split semaphores for readers/writers). It s split into enter and delay. It s a sanity check to see that it always goes between 1 and 0 (the ). The solution is perhaps more complex than the text of the exercise required. 3

4 1 int f r e e := U; 2 sem enter := 1, delay := 0 ; 3 int cnt = 0 ; # pending r e q u e s t s 4 5 r e q u e s t ( ) { # < await ( f r e e > 0) f r e e = f r e e 1 ; > 6 7 P( enter ) ; 8 i f ( f r e e = 0) { # No u n i t s l e f t 9 cnt := cnt + 1 ; # one more r e q u e s t pending 10 V( enter ) ; # Release CS 11 P( delay ) ; # Wait to u n i t s are r e l e a s e d 12 cnt := cnt 1 ; 13 } 14 f r e e := f r e e 1 ; # Take one u n i t 15 i f ( f r e e > 0 and cnt > 0) { # More than one u n i t was r e l e a s e d 16 V( delay ) ; 17 } 18 else V( enter ) ; # No u n i t s l e f t or no w a i t i n g u s e r s 19 } r e l e a s e ( int number ) { # < f r e e = f r e e + number ; > P( enter ) ; 25 f r e e := f r e e + number ; 26 i f ( cnt > 0) { # Some p r o c e s s i s w a i t i n g 27 V( delay ) ; # Give them p r i o r i t y 28 } 29 else V( enter ) ; # Else : open f o r new u s e r s 30 } The counter counts whether there are some requests pending. This solution uses split binary semaphores as described for the readers/writers problem in Andrews Section Requests are delayed if no units are left, and in release, we do V(delay) only if we know that there actually are one or more delayed requests. A simpler solution, still fulfilling the specification (?), might be to declare a semaphore counting the number of free resources: sem free = U The two routines could then be written as: request() { P(free) } # take one unit release(int number) { # free number units for[i=number to 1 by -1] { V(free)} } However, this is probably not what the author had in mind since release is no longer atomic. Exercise 4 (Termination, deadlock, interleaving) Consider the following program: 4

5 1 int x = 0, y = 0, z = 0 ; 2 sem lock1 = 1, lock2 = 1 ; 3 4 process f o o { process bar { 5 z := z + 2 ; P( l o c k 2 ) ; 6 P( lock1 ) ; y := y + 1 ; 7 x := x + 2 ; P( l o c k 1 ) ; 8 P( lock2 ) ; x := x + 1 ; 9 V( lock1 ) ; V( l o c k 1 ) ; 10 y := y + 2 ; V( l o c k 2 ) ; 11 V( lock2 ) ; z := z + 1 ; 12 } } 1. This program might deadlock. How? 2. What are the possible final values of x,y, and z in the deadlock state? 3. What are the possible final values of x,y, and z if the program terminates? (Remember that an assignment z := z + 1 consists of two atomic operations on z.) Solution: 1. Deadlock: The processes execute the first P operation. Then both will be stuck trying to execute the second. It s the classical situation (as in the symmetric philosphers) where the lock-taking of two processes (or more) goes in different orders. If one has to look for deadlock, that s where one has to look for, P -operations of different order. The V - operations are irrelevant for deadlocks. Of course, the processes may also not deadlock. 2. The state at the deadlocked point is (x, y, z) = (2, 1, 2). Up-to that point (if the program reaches the deadlock), there had been no races and therefore the result is unique. 3. In case of (proper) termination (i.e., without running in to the deadlock, the final values are (x, y, z) = (3, 3, {1, 2, 3}) Note that z is unprotected. Remember that the assignments to z are thereby not atomic. The assignments to the other two variables are protected by the mutex-locks (binary locks), even if the locks are not very smartly arranged (deadlock). Therefore the assignments themselves are atomic, and since + is commutative, the order in which the processes do their atomic increments does not matter. Exercise 5 (Fetch-and-add ([?, Exercisise 4.3])) Implement P and V with fetch-and-add (FA). The behavior of fetch-and-add is given as follows: 1 2 FA( var, i n c r ) : 3 <int tmp := var ; 4 var := var+i n c r ; 5 return (tmp ) ; > Note: the inc may be a negative integer, which is being added. Side remark: fetch-and-add is, in some HW architectures an atomic instruction (for instance, variants in X86-architectures). Atomic instructions such as fetch-and-add, which are more powerful than simple loads and stores (= reading and writing) are offered in the instruction set 5

6 with the purpose to allow efficient implementation of synchronization primitives in operating systems running on that platform (for instance semaphore operations). Fetch-and-add is only one example of HW-supported atomic synchronization operations. Solution: [of Exercise 5] 1 P( s ) { # <await ( s >0) s := s 1; > 2 while ( s <= 0) s k i p ; # spin 3 while ( FA( s, 1) <= 0 ) { # decrement + check 4 FA( s, 1 ) ; # undo 5 while ( s <= 0) s k i p ; 6 } 7 } 8 9 V( s ) { # <s := s +1; > 10 FA( s, 1 ) ; 11 } The first thing to observe is: FA has no synchronization power in the sense that it can delay a process, which of course is needed for the P -operation. Therefore, we have to do it ourselves. The standard way to do that is spinning. That s done, for a start, in the first loop. We let P-processes spin while the semaphore value is zero. When s is increased by a V- process, several P-processes may leave the first loop and enter the second. Independent of whether the FA-test succeeds or not: the test always decrements, so it s slighty different than an awaits > 0; s := s 1. If the test do not succeed for a given process, the process must increment s. Thus, an unsuccessful decrement in P must be followed by an increment in order to maintain the correct value of the semaphore. The following version of P is incorrect: 1 P( s ) : 2 while ( FA( s, 1) <= 0 ) { #1 3 FA( s, 1 ) ; 4 } The latter code with only one loop may lead to a livelock, illustrated by an example: Consider the case where semaphores are used to synchronize access to a critical section (which is one very standard application of P and V ). Furthermore, consider the case where s is 0, i.e. one process is inside the critical section. Assume now that there are two processes executing P(s). Assume that both of these processes are waiting to execute the loop body (i.e. both are at #1). The value of s must therefore be 2. Now, the process inside the critical section wants to leave and executes V(s). Thus, the value of s is increased to 1. Now, one of the waiting processes may execute FA(s,1) (setting s to 0) and immediately proceed with executing the test, setting s back to 1. Now both processes are at #1 and the value of s is again 1. The processes may continue to alternate on executing the loop, leading to a livelock. Exercise 6 (Precedence graph ([?, Exercise 4.4a])) Use semaphores to implement the shown precedence/dependence graph. T1 -> T2 -> T4 -> T5 T1 ----> T3 ----> T5 Solution: [of Exercise 6] 6

7 1 2 3 sem FIN1 = 0, FIN2 = 0, FIN3 = 0, FIN4 = 0 ; 4 5 process T1 { process T2 { process T3 { 6 task 1 ; P( FIN1 ) ; P( FIN1 ) ; 7 V( FIN1 ) ; task 2 ; task 3 ; 8 V( FIN1 ) ; V( FIN2 ) ; V( FIN3 ) ; 9 } } } process T4 { process T5 { 12 P( FIN2 ) ; P( FIN3 ) ; 13 task 4 ; P( FIN4 ) ; 14 V( FIN4 ) ; task 5 ; 15 } } The trick is: to signal 2 times. 2 Exercise 7 (Implementing await ([?, Exercise 4.13])) Consider the following piece of code, which is intended as implementation of the await-statement. 1 sem e := 1, d := 0 # entry and d e l a y sem. 2 int nd := 0 # d e l a y counter 3 4 P( e ) ; 5 6 while (B = f a l s e ) { 7 nd := nd+1; 8 V( e ) ; 9 P( d ) ; 10 P( e ) } ; S ; # p r o t e c t e d statement while ( nd > 0) 15 { nd := nd 1; V( d ) } ; 16 V( e ) ; 1. Is the code executed atomically? 2. Is it deadlock free? 3. Does the code guarantee, that B is true before S is executed? Solution: [of Exercise 7] 1. Atomic? Yes, only one process can hold e. For question 3: This also guarantees that B holds when S starts execution: The entry semaphore e is not released between (the last) testing of B and execution of S. 2. In order for deadlock to occur, all processes must halt on a P operation (that s a general fact, V s don t block ). This can only happen if all processes are delayed on P(d). In order for this to happen, all processes must test the condition B and see that it is false. 2 NB: it works almost like Petri-nets... 7

8 Hence, the algorithm will not deadlock unless there are a possibility of deadlock in the surrounding program. (Note that even though the while loop after S is executed as many times as there are delayed processes, we are not guaranteed that all these processes will execute P(d) before new processes captures the delay semaphore e at the first line of the implementation. However, this will not affect the deadlock argument since the waiting processes cannot affect the trueness of B.) Exercise 8 (Exchange function ([?, Exercise 4.29])) Impement the exchange function. The use is exchange (value). It supposed t communicate with another process which calls the same function (with some value v 2 ) and the function here is supposed to return v 2, and the other one symmetrically. So exchanging 2 values requires a form of rendez-vouz. Solution: [of Exercise 8] A rendez-vous we had also in the lecture about monitors. And exchange as intended here may be compared with an exchange (in a sequential setting) of the contents of 2 variables. To do that, one needs a auxiliary memory cell. For swapping x and y, one would typically do 1 buf :=x 1 ; 2 x 1 := x 2 ; 3 x 2 := buf Now, the setting is slightly different. The variables x and y are somehow local to the 2 processes (and the correspond to the input parameters value 1 and value 2 of the two procedures. That implies we cannot do x 1 := x 2. To communicate the value in both directions, we need two write/read the buffer two times (if we want to use just one buffer). To avoid overwriting the value prematurely, we need further auxiliary variables, here x 1 and x 2 (in the code later, they are called tmp) 1 buf :=x 1 ; 2 x 2 := buf ; 3 buf := x 2 ; 4 x 1 := x 2 ; Now, the code is still sequential, what we need therefore is, make it parallel and synchronize properly. Since the two processes are uncorrdinated, we do not know which one is first, what we need to program therefore is a rendez-vouz. 1 sem continue := 0 ; # Waiting sem. f o r the f i r s t p r o c e s s 2 sem e := 1 ; # Mutex semphore 3 bool waiting := f a l s e ; # t r u e when one p r o c e s s i s w a i t i n g 4 int b u f f e r ; # Comm. b u f f e r between p a i r s o f p r o c e s s e s 5 int exchange ( int value ) { 6 int tmp ; 7 P( e ) ; 8 i f (! waiting ) { # f i r s t p r o c e s s ( in a p a i r ) 9 b u f f e r := value ; # s t o r e own v a l u e (1) 10 waiting := true ; 11 V( e ) ; 12 P( continue ) ; 13 tmp := b u f f e r ; # read o t h e r v a l u e (4) 14 waiting := f a l s e ; 15 V( e ) ; # S i g n a l t h a t new exchange p o s s i b l e 16 } 17 else { # second p r o c e s s ( in a p a i r ) 18 tmp := b u f f e r ; # read o t h e r v a l u e (2) 8

9 19 b u f f e r := value ; # s t o r e own v a l u e (3) 20 V( continue ) ; 21 } 22 return tmp ; 23 } We need two semaphores in order to make sure that the second arriving process will signal the one that is waiting. The synchronization enusres that the numbered statements are executed in the order 1,2,3,4. The local variable tmp is needed in order to avoid interference since the V operations must be done before the return statment. Exercise 9 (Request and release ([?, Exercise 4.34a])) Request and release, sharing two printers. The request should return the identity of a free printer, if available (otherwise block). The identity of the free printer is given as argument to the release-procedure. Solution: [of Exercise 9] 1 sem s = 2 ; # w r i t e r s 2 sem e = 1 ; # mutex 3 bool t [ 1 : 2 ] = ( true, true ) ; # a v a i l a b l e 4 5 int r e q u e s t ( ) { 6 int tmp 7 P( s ) ; 8 P( e ) ; 9 i f ( t [ 1 ] ) then tmp := 1 ; else tmp := 2 ; 10 t [ tmp ] := f a l s e ; // taken 11 V( e ) ; 12 return tmp ; 13 } r e l e a s e ( int i ) { 16 P( e ) ; 17 t [ i ] := true ; 18 V( e ) ; 19 V( s ) ; 20 } Note that the semaphore s is initiate with 2, since we have 2 printers. Basically, we use a counting semaphore, It is not strictly needed to protect the assignment to t[i] in release. (Why?) A solution using two boolean variables is also ok. It leads to a test in release. Note that Andrews sometimes use the notation procedure request(int &tmp). declaration of tmp and the return statement is then not needed. The Exercise 10 (Bear and honeybees 4.36) Program the synchronization problems of one bear + n bees 9

10 Solution: [of Exercise 10] The problem is a variant of the producer/consumer problem in a way. Perhaps best to start thinking is the bees, because there are more than one. The bees have to be under mutex, but bees and the bear are also mutex. When a bee is finished, it can therefore either signal 3 another bee to enter, or the bear. That can be done by a split semaphore. 1 sem e = 1 # Mutex semaphore 2 sem eat = 0 # Raise when the bear can eat 3 # e and eat forms a s p l i t binary semaphore 4 int p o r t i o n s = 0 # Number o f a v a i l a b l e p o r t i o n s in the pot 5 6 process bee [ i = 1 to n ] { 7 while ( true ) { 8 # c o l l e c t honey 9 P( e ) ; 10 p o r t i o n s = p o r t i o n s + 1 ; 11 i f ( p o r t i o n s == H) { 12 V( eat ) ; 13 } else { 14 V( e ) ; 15 } } } process bear { 18 while ( true ) { 19 P( eat ) ; 20 # eat 21 p o r t i o n s = 0 ; 22 V( e ) ; 23 } 24 } References 3 We don t have signal and wait here, though. 10

INF 4140: Models of Concurrency Series 4

INF 4140: Models of Concurrency Series 4 Universitetet i Oslo Institutt for Informatikk PMA Olaf Owe, Martin Steffen, Toktam Ramezani INF 4140: Models of Concurrency Series 4 Høst 2016 30. 9. 2016 Topic: Monitors (Exercises with hints for solution)

More information

Improper Nesting Example

Improper Nesting Example Improper Nesting Example One of the limits on the use of parbegin/parend, and any related constructs, is that the program involved must be properly nested. Not all programs are. For example, consider the

More information

INF Models of concurrency

INF Models of concurrency Monitors INF4140 - Models of concurrency Monitors, lecture 4 Fall 2017 27. September 2017 2 / 49 Overview Concurrent execution of different processes Communication by shared variables Processes may interfere

More information

Clojure Concurrency Constructs, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 13 10/07/2014

Clojure Concurrency Constructs, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 13 10/07/2014 Clojure Concurrency Constructs, Part Two CSCI 5828: Foundations of Software Engineering Lecture 13 10/07/2014 1 Goals Cover the material presented in Chapter 4, of our concurrency textbook In particular,

More information

Lecture 4: Process Management

Lecture 4: Process Management Lecture 4: Process Management Process Revisited 1. What do we know so far about Linux on X-86? X-86 architecture supports both segmentation and paging. 48-bit logical address goes through the segmentation

More information

Safety and Liveness. Thread Synchronization: Too Much Milk. Critical Sections. A Really Cool Theorem

Safety and Liveness. Thread Synchronization: Too Much Milk. Critical Sections. A Really Cool Theorem Safety and Liveness Properties defined over an execution of a program Thread Synchronization: Too Much Milk Safety: nothing bad happens holds in every finite execution prefix Windows never crashes No patient

More information

Correctness of Concurrent Programs

Correctness of Concurrent Programs Correctness of Concurrent Programs Trifon Ruskov ruskov@tu-varna.acad.bg Technical University of Varna - Bulgaria Correctness of Concurrent Programs Correctness of concurrent programs needs to be formalized:

More information

INF Models of concurrency

INF Models of concurrency INF4140 - Models of concurrency Høsten 2015 November 18, 2015 Abstract This is the handout version of the slides for the lecture (i.e., it s a rendering of the content of the slides in a way that does

More information

1 Lamport s Bakery Algorithm

1 Lamport s Bakery Algorithm Com S 6 Spring Semester 2009 Algorithms for Multiprocessor Synchronization Lecture 3: Tuesday, 27th January 2009 Instructor: Soma Chaudhuri Scribe: Neeraj Khanolkar Lamport s Bakery Algorithm Algorithm

More information

Unit: Blocking Synchronization Clocks, v0.3 Vijay Saraswat

Unit: Blocking Synchronization Clocks, v0.3 Vijay Saraswat Unit: Blocking Synchronization Clocks, v0.3 Vijay Saraswat This lecture discusses X10 clocks. For reference material please look at the chapter on Clocks in []. 1 Motivation The central idea underlying

More information

Distributed Systems Part II Solution to Exercise Sheet 10

Distributed Systems Part II Solution to Exercise Sheet 10 Distributed Computing HS 2012 Prof. R. Wattenhofer / C. Decker Distributed Systems Part II Solution to Exercise Sheet 10 1 Spin Locks A read-write lock is a lock that allows either multiple processes to

More information

Deadlock. CSE 2431: Introduction to Operating Systems Reading: Chap. 7, [OSC]

Deadlock. CSE 2431: Introduction to Operating Systems Reading: Chap. 7, [OSC] Deadlock CSE 2431: Introduction to Operating Systems Reading: Chap. 7, [OSC] 1 Outline Resources Deadlock Deadlock Prevention Deadlock Avoidance Deadlock Detection Deadlock Recovery 2 Review: Synchronization

More information

Shared resources. Sistemi in tempo reale. Giuseppe Lipari. Scuola Superiore Sant Anna Pisa -Italy

Shared resources. Sistemi in tempo reale. Giuseppe Lipari. Scuola Superiore Sant Anna Pisa -Italy istemi in tempo reale hared resources Giuseppe Lipari cuola uperiore ant Anna Pisa -Italy inher.tex istemi in tempo reale Giuseppe Lipari 7/6/2005 12:35 p. 1/21 Interacting tasks Until now, we have considered

More information

Real Time Operating Systems

Real Time Operating Systems Real Time Operating ystems hared Resources Luca Abeni Credits: Luigi Palopoli, Giuseppe Lipari, and Marco Di Natale cuola uperiore ant Anna Pisa -Italy Real Time Operating ystems p. 1 Interacting Tasks

More information

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 Computational complexity studies the amount of resources necessary to perform given computations.

More information

The Weakest Failure Detector to Solve Mutual Exclusion

The Weakest Failure Detector to Solve Mutual Exclusion The Weakest Failure Detector to Solve Mutual Exclusion Vibhor Bhatt Nicholas Christman Prasad Jayanti Dartmouth College, Hanover, NH Dartmouth Computer Science Technical Report TR2008-618 April 17, 2008

More information

Math 38: Graph Theory Spring 2004 Dartmouth College. On Writing Proofs. 1 Introduction. 2 Finding A Solution

Math 38: Graph Theory Spring 2004 Dartmouth College. On Writing Proofs. 1 Introduction. 2 Finding A Solution Math 38: Graph Theory Spring 2004 Dartmouth College 1 Introduction On Writing Proofs What constitutes a well-written proof? A simple but rather vague answer is that a well-written proof is both clear and

More information

MA 1128: Lecture 08 03/02/2018. Linear Equations from Graphs And Linear Inequalities

MA 1128: Lecture 08 03/02/2018. Linear Equations from Graphs And Linear Inequalities MA 1128: Lecture 08 03/02/2018 Linear Equations from Graphs And Linear Inequalities Linear Equations from Graphs Given a line, we would like to be able to come up with an equation for it. I ll go over

More information

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Lines and Their Equations

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Lines and Their Equations ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER 1 017/018 DR. ANTHONY BROWN. Lines and Their Equations.1. Slope of a Line and its y-intercept. In Euclidean geometry (where

More information

Real Time Operating Systems

Real Time Operating Systems Real Time Operating ystems Luca Abeni luca.abeni@unitn.it Interacting Tasks Until now, only independent tasks... A job never blocks or suspends A task only blocks on job termination In real world, jobs

More information

INF2220: algorithms and data structures Series 1

INF2220: algorithms and data structures Series 1 Universitetet i Oslo Institutt for Informatikk I. Yu, D. Karabeg INF2220: algorithms and data structures Series 1 Topic Function growth & estimation of running time, trees (Exercises with hints for solution)

More information

Operating Systems. VII. Synchronization

Operating Systems. VII. Synchronization Operating Systems VII. Synchronization Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Outline Synchronization issues 2/22 Fall 2017 Institut

More information

1 Boolean Algebra Simplification

1 Boolean Algebra Simplification cs281: Computer Organization Lab3 Prelab Our objective in this prelab is to lay the groundwork for simplifying boolean expressions in order to minimize the complexity of the resultant digital logic circuit.

More information

Lecture 9: Cri,cal Sec,ons revisited, and Reasoning about Programs. K. V. S. Prasad Dept of Computer Science Chalmers University Monday 23 Feb 2015

Lecture 9: Cri,cal Sec,ons revisited, and Reasoning about Programs. K. V. S. Prasad Dept of Computer Science Chalmers University Monday 23 Feb 2015 Lecture 9: Cri,cal Sec,ons revisited, and Reasoning about Programs K. V. S. Prasad Dept of Computer Science Chalmers University Monday 23 Feb 2015 Plan for today Chap 2, 3 recap and complete Chap 4 intro

More information

15-451/651: Design & Analysis of Algorithms September 13, 2018 Lecture #6: Streaming Algorithms last changed: August 30, 2018

15-451/651: Design & Analysis of Algorithms September 13, 2018 Lecture #6: Streaming Algorithms last changed: August 30, 2018 15-451/651: Design & Analysis of Algorithms September 13, 2018 Lecture #6: Streaming Algorithms last changed: August 30, 2018 Today we ll talk about a topic that is both very old (as far as computer science

More information

Topic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number

Topic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number Topic Contents Factoring Methods Unit 3 The smallest divisor of an integer The GCD of two numbers Generating prime numbers Computing prime factors of an integer Generating pseudo random numbers Raising

More information

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino

Formal Verification Techniques. Riccardo Sisto, Politecnico di Torino Formal Verification Techniques Riccardo Sisto, Politecnico di Torino State exploration State Exploration and Theorem Proving Exhaustive exploration => result is certain (correctness or noncorrectness proof)

More information

INF Models of concurrency

INF Models of concurrency INF4140 - Models of concurrency RPC and Rendezvous INF4140 Lecture 15. Nov. 2017 RPC and Rendezvous Outline More on asynchronous message passing interacting processes with different patterns of communication

More information

CS162 Operating Systems and Systems Programming Lecture 7 Semaphores, Conditional Variables, Deadlocks"

CS162 Operating Systems and Systems Programming Lecture 7 Semaphores, Conditional Variables, Deadlocks CS162 Operating Systems and Systems Programming Lecture 7 Semaphores, Conditional Variables, Deadlocks" September 19, 2012! Ion Stoica! http://inst.eecs.berkeley.edu/~cs162! Recap: Monitors" Monitors represent

More information

Automata-Theoretic Model Checking of Reactive Systems

Automata-Theoretic Model Checking of Reactive Systems Automata-Theoretic Model Checking of Reactive Systems Radu Iosif Verimag/CNRS (Grenoble, France) Thanks to Tom Henzinger (IST, Austria), Barbara Jobstmann (CNRS, Grenoble) and Doron Peled (Bar-Ilan University,

More information

1 Terminology and setup

1 Terminology and setup 15-451/651: Design & Analysis of Algorithms August 31, 2017 Lecture #2 last changed: August 29, 2017 In this lecture, we will examine some simple, concrete models of computation, each with a precise definition

More information

Q520: Answers to the Homework on Hopfield Networks. 1. For each of the following, answer true or false with an explanation:

Q520: Answers to the Homework on Hopfield Networks. 1. For each of the following, answer true or false with an explanation: Q50: Answers to the Homework on Hopfield Networks 1. For each of the following, answer true or false with an explanation: a. Fix a Hopfield net. If o and o are neighboring observation patterns then Φ(

More information

Sequential Logic (3.1 and is a long difficult section you really should read!)

Sequential Logic (3.1 and is a long difficult section you really should read!) EECS 270, Fall 2014, Lecture 6 Page 1 of 8 Sequential Logic (3.1 and 3.2. 3.2 is a long difficult section you really should read!) One thing we have carefully avoided so far is feedback all of our signals

More information

On the weakest failure detector ever

On the weakest failure detector ever On the weakest failure detector ever The MIT Faculty has made this article openly available. Please share how this access benefits you. Your story matters. Citation As Published Publisher Guerraoui, Rachid

More information

CSC501 Operating Systems Principles. Deadlock

CSC501 Operating Systems Principles. Deadlock CSC501 Operating Systems Principles Deadlock 1 Last Lecture q Priority Inversion Q Priority Inheritance Protocol q Today Q Deadlock 2 The Deadlock Problem q Definition Q A set of blocked processes each

More information

CIS 4930/6930: Principles of Cyber-Physical Systems

CIS 4930/6930: Principles of Cyber-Physical Systems CIS 4930/6930: Principles of Cyber-Physical Systems Chapter 11 Scheduling Hao Zheng Department of Computer Science and Engineering University of South Florida H. Zheng (CSE USF) CIS 4930/6930: Principles

More information

Counters. We ll look at different kinds of counters and discuss how to build them

Counters. We ll look at different kinds of counters and discuss how to build them Counters We ll look at different kinds of counters and discuss how to build them These are not only examples of sequential analysis and design, but also real devices used in larger circuits 1 Introducing

More information

Lecture 6: Introducing Complexity

Lecture 6: Introducing Complexity COMP26120: Algorithms and Imperative Programming Lecture 6: Introducing Complexity Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2015 16 You need this book: Make sure you use the up-to-date

More information

DRAFT - do not circulate

DRAFT - do not circulate An Introduction to Proofs about Concurrent Programs K. V. S. Prasad (for the course TDA383/DIT390) Deartment of Comuter Science Chalmers University Setember 26, 2016 Rough sketch of notes released since

More information

CSCI3390-Assignment 2 Solutions

CSCI3390-Assignment 2 Solutions CSCI3390-Assignment 2 Solutions due February 3, 2016 1 TMs for Deciding Languages Write the specification of a Turing machine recognizing one of the following three languages. Do one of these problems.

More information

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems Exercises Solutions Note, that we have not formulated the answers for all the review questions. You will find the answers for many questions by reading and reflecting about the text in the book. Chapter

More information

Elementary Algebra Study Guide Some Basic Facts This section will cover the following topics

Elementary Algebra Study Guide Some Basic Facts This section will cover the following topics Elementary Algebra Study Guide Some Basic Facts This section will cover the following topics Notation Order of Operations Notation Math is a language of its own. It has vocabulary and punctuation (notation)

More information

1 Definition of a Turing machine

1 Definition of a Turing machine Introduction to Algorithms Notes on Turing Machines CS 4820, Spring 2017 April 10 24, 2017 1 Definition of a Turing machine Turing machines are an abstract model of computation. They provide a precise,

More information

1 Introduction (January 21)

1 Introduction (January 21) CS 97: Concrete Models of Computation Spring Introduction (January ). Deterministic Complexity Consider a monotonically nondecreasing function f : {,,..., n} {, }, where f() = and f(n) =. We call f a step

More information

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017 CMSC CMSC : Lecture Greedy Algorithms for Scheduling Tuesday, Sep 9, 0 Reading: Sects.. and. of KT. (Not covered in DPV.) Interval Scheduling: We continue our discussion of greedy algorithms with a number

More information

INF Models of concurrency

INF Models of concurrency INF4140 - Models of concurrency Fall 2017 October 17, 2017 Abstract This is the handout version of the slides for the lecture (i.e., it s a rendering of the content of the slides in a way that does not

More information

CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring / 1

CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring / 1 CS 374: Algorithms & Models of Computation, Spring 2017 Greedy Algorithms Lecture 19 April 4, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 1 Part I Greedy Algorithms: Tools and Techniques Chandra

More information

CS 453 Operating Systems. Lecture 7 : Deadlock

CS 453 Operating Systems. Lecture 7 : Deadlock CS 453 Operating Systems Lecture 7 : Deadlock 1 What is Deadlock? Every New Yorker knows what a gridlock alert is - it s one of those days when there is so much traffic that nobody can move. Everything

More information

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises Contents 1 Introduction INF5140: Lecture 2 Espen H. Lian Institutt for informatikk, Universitetet i Oslo January 28, 2009 2 Proof System 3 SPL 4 GCD 5 Exercises Institutt for informatikk (UiO) INF5140:

More information

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc. Finite State Machines Introduction Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc. Such devices form

More information

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models Contents Mathematical Reasoning 3.1 Mathematical Models........................... 3. Mathematical Proof............................ 4..1 Structure of Proofs........................ 4.. Direct Method..........................

More information

Lock using Bakery Algorithm

Lock using Bakery Algorithm Lock using Bakery Algorithm Shankar April 16, 2014 Overview Classical mutual exclusion problem given program with critical sections and threads 0..N 1 obtain entry and exit code for each critical section

More information

Concrete models and tight upper/lower bounds

Concrete models and tight upper/lower bounds Lecture 3 Concrete models and tight upper/lower bounds 3.1 Overview In this lecture, we will examine some simple, concrete models of computation, each with a precise definition of what counts as a step,

More information

Agreement. Today. l Coordination and agreement in group communication. l Consensus

Agreement. Today. l Coordination and agreement in group communication. l Consensus Agreement Today l Coordination and agreement in group communication l Consensus Events and process states " A distributed system a collection P of N singlethreaded processes w/o shared memory Each process

More information

CS 152 Computer Architecture and Engineering. Lecture 17: Synchronization and Sequential Consistency

CS 152 Computer Architecture and Engineering. Lecture 17: Synchronization and Sequential Consistency CS 152 Computer Architecture and Engineering Lecture 17: Synchronization and Sequential Consistency Dr. George Michelogiannakis EECS, University of California at Berkeley CRD, Lawrence Berkeley National

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

Chapter 1 Review of Equations and Inequalities

Chapter 1 Review of Equations and Inequalities Chapter 1 Review of Equations and Inequalities Part I Review of Basic Equations Recall that an equation is an expression with an equal sign in the middle. Also recall that, if a question asks you to solve

More information

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets 1 Rational and Real Numbers Recall that a number is rational if it can be written in the form a/b where a, b Z and b 0, and a number

More information

Enrico Nardelli Logic Circuits and Computer Architecture

Enrico Nardelli Logic Circuits and Computer Architecture Enrico Nardelli Logic Circuits and Computer Architecture Appendix B The design of VS0: a very simple CPU Rev. 1.4 (2009-10) by Enrico Nardelli B - 1 Instruction set Just 4 instructions LOAD M - Copy into

More information

4. What is the probability that the two values differ by 4 or more in absolute value? There are only six

4. What is the probability that the two values differ by 4 or more in absolute value? There are only six 1. Short Questions: 2/2/2/2/2 Provide a clear and concise justification of your answer. In this problem, you roll two balanced six-sided dice. Hint: Draw a picture. 1. What is the probability that the

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Scheduling I. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Advanced topics on scheduling

Scheduling I. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Advanced topics on scheduling Scheduling I Today! Introduction to scheduling! Classical algorithms Next Time! Advanced topics on scheduling Scheduling out there! You are the manager of a supermarket (ok, things don t always turn out

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Digital Logic Our goal for the next few weeks is to paint a a reasonably complete picture of how we can go from transistor

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

CS505: Distributed Systems

CS505: Distributed Systems Cristina Nita-Rotaru CS505: Distributed Systems. Required reading for this topic } Michael J. Fischer, Nancy A. Lynch, and Michael S. Paterson for "Impossibility of Distributed with One Faulty Process,

More information

Finding Limits Graphically and Numerically

Finding Limits Graphically and Numerically Finding Limits Graphically and Numerically 1. Welcome to finding limits graphically and numerically. My name is Tuesday Johnson and I m a lecturer at the University of Texas El Paso. 2. With each lecture

More information

Lecture 4: Constructing the Integers, Rationals and Reals

Lecture 4: Constructing the Integers, Rationals and Reals Math/CS 20: Intro. to Math Professor: Padraic Bartlett Lecture 4: Constructing the Integers, Rationals and Reals Week 5 UCSB 204 The Integers Normally, using the natural numbers, you can easily define

More information

or 0101 Machine

or 0101 Machine Synchronous State Graph or Synchronous State Graph or Detector Design a state graph for a machine with: One input X, one output Z. Z= after receiving the complete sequence or Overlapped sequences are detected.

More information

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

CSCI3390-Lecture 14: The class NP

CSCI3390-Lecture 14: The class NP CSCI3390-Lecture 14: The class NP 1 Problems and Witnesses All of the decision problems described below have the form: Is there a solution to X? where X is the given problem instance. If the instance is

More information

The State Explosion Problem

The State Explosion Problem The State Explosion Problem Martin Kot August 16, 2003 1 Introduction One from main approaches to checking correctness of a concurrent system are state space methods. They are suitable for automatic analysis

More information

Petri nets. s 1 s 2. s 3 s 4. directed arcs.

Petri nets. s 1 s 2. s 3 s 4. directed arcs. Petri nets Petri nets Petri nets are a basic model of parallel and distributed systems (named after Carl Adam Petri). The basic idea is to describe state changes in a system with transitions. @ @R s 1

More information

9.2 Multiplication Properties of Radicals

9.2 Multiplication Properties of Radicals Section 9.2 Multiplication Properties of Radicals 885 9.2 Multiplication Properties of Radicals Recall that the equation x 2 = a, where a is a positive real number, has two solutions, as indicated in Figure

More information

Proof Techniques (Review of Math 271)

Proof Techniques (Review of Math 271) Chapter 2 Proof Techniques (Review of Math 271) 2.1 Overview This chapter reviews proof techniques that were probably introduced in Math 271 and that may also have been used in a different way in Phil

More information

CSCI 2150 Intro to State Machines

CSCI 2150 Intro to State Machines CSCI 2150 Intro to State Machines Topic: Now that we've created flip-flops, let's make stuff with them Reading: igital Fundamentals sections 6.11 and 9.4 (ignore the JK flip-flop stuff) States Up until

More information

Algebra Year 10. Language

Algebra Year 10. Language Algebra Year 10 Introduction In Algebra we do Maths with numbers, but some of those numbers are not known. They are represented with letters, and called unknowns, variables or, most formally, literals.

More information

1 Maintaining a Dictionary

1 Maintaining a Dictionary 15-451/651: Design & Analysis of Algorithms February 1, 2016 Lecture #7: Hashing last changed: January 29, 2016 Hashing is a great practical tool, with an interesting and subtle theory too. In addition

More information

Tricks of the Trade in Combinatorics and Arithmetic

Tricks of the Trade in Combinatorics and Arithmetic Tricks of the Trade in Combinatorics and Arithmetic Zachary Friggstad Programming Club Meeting Fast Exponentiation Given integers a, b with b 0, compute a b exactly. Fast Exponentiation Given integers

More information

(a) Definition of TMs. First Problem of URMs

(a) Definition of TMs. First Problem of URMs Sec. 4: Turing Machines First Problem of URMs (a) Definition of the Turing Machine. (b) URM computable functions are Turing computable. (c) Undecidability of the Turing Halting Problem That incrementing

More information

6.852: Distributed Algorithms Fall, Class 10

6.852: Distributed Algorithms Fall, Class 10 6.852: Distributed Algorithms Fall, 2009 Class 10 Today s plan Simulating synchronous algorithms in asynchronous networks Synchronizers Lower bound for global synchronization Reading: Chapter 16 Next:

More information

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 41 Pulse Code Modulation (PCM) So, if you remember we have been talking

More information

Basics of Proofs. 1 The Basics. 2 Proof Strategies. 2.1 Understand What s Going On

Basics of Proofs. 1 The Basics. 2 Proof Strategies. 2.1 Understand What s Going On Basics of Proofs The Putnam is a proof based exam and will expect you to write proofs in your solutions Similarly, Math 96 will also require you to write proofs in your homework solutions If you ve seen

More information

DETERMINING THE VARIABLE QUANTUM TIME (VQT) IN ROUND ROBIN AND IT S IMPORTANCE OVER AVERAGE QUANTUM TIME METHOD

DETERMINING THE VARIABLE QUANTUM TIME (VQT) IN ROUND ROBIN AND IT S IMPORTANCE OVER AVERAGE QUANTUM TIME METHOD D DETERMINING THE VARIABLE QUANTUM TIME (VQT) IN ROUND ROBIN AND IT S IMPORTANCE OVER AVERAGE QUANTUM TIME METHOD Yashasvini Sharma 1 Abstract The process scheduling, is one of the most important tasks

More information

P (E) = P (A 1 )P (A 2 )... P (A n ).

P (E) = P (A 1 )P (A 2 )... P (A n ). Lecture 9: Conditional probability II: breaking complex events into smaller events, methods to solve probability problems, Bayes rule, law of total probability, Bayes theorem Discrete Structures II (Summer

More information

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara Operating Systems Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Many processes to execute, but one CPU OS time-multiplexes the CPU by operating context switching Between

More information

3.5 Solving Equations Involving Integers II

3.5 Solving Equations Involving Integers II 208 CHAPTER 3. THE FUNDAMENTALS OF ALGEBRA 3.5 Solving Equations Involving Integers II We return to solving equations involving integers, only this time the equations will be a bit more advanced, requiring

More information

Algorithms Exam TIN093 /DIT602

Algorithms Exam TIN093 /DIT602 Algorithms Exam TIN093 /DIT602 Course: Algorithms Course code: TIN 093, TIN 092 (CTH), DIT 602 (GU) Date, time: 21st October 2017, 14:00 18:00 Building: SBM Responsible teacher: Peter Damaschke, Tel. 5405

More information

Latches. October 13, 2003 Latches 1

Latches. October 13, 2003 Latches 1 Latches The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we ve already seen. Our schedule will be very similar to before: We first show how primitive memory

More information

CSC : Homework #3

CSC : Homework #3 CSC 707-001: Homework #3 William J. Cook wjcook@math.ncsu.edu Monday, March 15, 2004 1 Exercise 4.13 on page 118 (3-Register RAM) Exercise 4.13 Verify that a RAM need not have an unbounded number of registers.

More information

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University Che-Wei Chang chewei@mail.cgu.edu.tw Department of Computer Science and Information Engineering, Chang Gung University } 2017/11/15 Midterm } 2017/11/22 Final Project Announcement 2 1. Introduction 2.

More information

CS-206 Concurrency. Lecture 8 Concurrent. Data structures. a b c d. Spring 2015 Prof. Babak Falsafi parsa.epfl.ch/courses/cs206/ remove(c) remove(b)

CS-206 Concurrency. Lecture 8 Concurrent. Data structures. a b c d. Spring 2015 Prof. Babak Falsafi parsa.epfl.ch/courses/cs206/ remove(c) remove(b) CS-206 Concurrency Lecture 8 Concurrent a b c d Data structures Spring 2015 Prof. Babak Falsafi parsa.epfl.ch/courses/cs206/ remove(b) remove(c) Adapted from slides originally developed by Maurice Herlihy

More information

Operations and Supply Chain Management Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Operations and Supply Chain Management Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras Operations and Supply Chain Management Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras Lecture - 27 Flow Shop Scheduling - Heuristics - Palmer, Campbell Dudek

More information

Dartmouth Computer Science Technical Report TR Efficient Wait-Free Implementation of Multiword LL/SC Variables

Dartmouth Computer Science Technical Report TR Efficient Wait-Free Implementation of Multiword LL/SC Variables Dartmouth Computer Science Technical Report TR2004-523 Efficient Wait-Free Implementation of Multiword LL/SC Variables Prasad Jayanti and Srdjan Petrovic Department of Computer Science Dartmouth College

More information

HW8. Due: November 1, 2018

HW8. Due: November 1, 2018 CSCI 1010 Theory of Computation HW8 Due: November 1, 2018 Attach a fully filled-in cover sheet to the front of your printed homework Your name should not appear anywhere; the cover sheet and each individual

More information

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University Trace semantics: towards a unification of parallel paradigms Stephen Brookes Department of Computer Science Carnegie Mellon University MFCSIT 2002 1 PARALLEL PARADIGMS State-based Shared-memory global

More information

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011 Math 31 Lesson Plan Day 2: Sets; Binary Operations Elizabeth Gillaspy September 23, 2011 Supplies needed: 30 worksheets. Scratch paper? Sign in sheet Goals for myself: Tell them what you re going to tell

More information

Clocks in Asynchronous Systems

Clocks in Asynchronous Systems Clocks in Asynchronous Systems The Internet Network Time Protocol (NTP) 8 Goals provide the ability to externally synchronize clients across internet to UTC provide reliable service tolerating lengthy

More information

const =Λ for simplicity, we assume N =2 L Λ= L = log N; =Λ (depth of arbitration tree) + 1 = O(log N) Λ= Tsize =2 L 1=N 1 =Λ size of arbitration tree

const =Λ for simplicity, we assume N =2 L Λ= L = log N; =Λ (depth of arbitration tree) + 1 = O(log N) Λ= Tsize =2 L 1=N 1 =Λ size of arbitration tree A Space- and Time-efcient Local-spin Spin Lock Yong-Jik Kim and James H. Anderson Department of Computer Science University of North Carolina at Chapel Hill March 2001 Abstract A simple ce transformation

More information

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II TDDB68 Concurrent programming and operating systems Lecture: CPU Scheduling II Mikael Asplund, Senior Lecturer Real-time Systems Laboratory Department of Computer and Information Science Copyright Notice:

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax. Wffs Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about

More information