Sits down μx ipicks up forki iputs down forki x

Info icon This preview shows pages 22–31. Sign up to view the full content.

View Full Document Right Arrow Icon
i.sits down μX ( i.picks up fork.i i.puts down fork.i X | i.gets up LEFT i )) 22
Image of page 22

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
& $ % Deadlock Analysis (1) Deadlock problem: When a mathematical model had been constructed, it revealed a serious danger. Suppose all the philosophers get hungry at about the same time; they all sit down; they all pick up their own forks; and they all reach out for the other fork, which is not there. In this undignified situation, they will all inevitably starve. (2) One solution to deadlock: Introducing a footman The footman’s alphabet was defined as: S 4 i =0 { i.sits down, i.gets up } U = S 4 i =0 { i.gets up } D = S 4 i =0 { i.sits down } 23
Image of page 23
& $ % This footman was given secret instructions never to allow more than four philosophers to be seated simultaneously. His behaviour is most simply defined by mutual recursion. Let FOOT j defines the behaviour of the footman with j philosophers seated FOOT 0 = ( x : D FOOT 1 ) FOOT j = ( x : D FOOT j +1 | y : U FOOT j - 1 ) for j ∈ { 1 , 2 , 3 } FOOT 4 = ( y : U FOOT 3 ) A college free of deadlock is defined NEWCOLLEGE = ( COLLEGE || FOOT 0 ) 24
Image of page 24

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
& $ % Proof of absence of deadlock for the example In the original COLLEGE the risk of deadlock was far from obvious; the claim that NEWCOLLEGE is free from deadlock should therefore be proved with some care. What we must prove can be stated formally as ( NEWCOLLEGE/s ) 6 = STOP for all s traces ( NEWCOLLEGE ) 25
Image of page 25
& $ % Change of symbol Let f be a one-one function (injection) which maps the alphabet of P onto a set of symbols A f : αP A We define the process f ( P ) as one which engages in the event f ( c ) whenever P would have engaged in c . It follows that αf ( P ) = f ( αP ) traces ( f ( P )) = { f * ( s ) | s traces ( P ) } 26
Image of page 26

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
& $ % Examples: (1) After a few years, the price of everything goes up. To represent the effect of inflation, we define a function f by the following equations f ( in 2 p ) = in 10 p f ( large ) = large f ( in 1 p ) = in 5 p f ( small ) = small f ( out 1 p ) = out 5 p The new vending machine is NEWV MC = f ( V MC ) 27
Image of page 27
& $ % (2) We wish to connect two instances of COPYBIT (1.1.3 X7) in series, so that each bit output by the first is simultaneously input by the second. First, we need to change the names of the events used for internal communication; wearray therefore introduce two new events mid.0 and mid.1, and define the functions f and g to change the output of one process and the input of the other f ( out. 0) = g ( in. 0) = mid. 0 f ( out. 1) = g ( in. 1) = mid. 1 ( in. 0) = in. 0 , f ( in. 1) = in. 1 g ( out. 0) = out. 0 , g ( out. 1) = out. 1 The answer we want is CHAIN 2 = f ( COPY BIT ) k g ( COPY BIT ) Note: For the illustration figure (Fig. 2.7), please see page 63. 28
Image of page 28

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
& $ % Laws for Change of Symbol Note: (1) f ( B ) = { f ( x ) | x B } , (2) f - 1 is the inverse of f (3) f g is the composition of f and g After change of symbol, STOP still performs no event from its changed alphabet L1 f ( STOP A ) = STOP f ( A ) In the case of a choice, the symbols offered for selection are changed, and the subsequent behaviour is similarly changed L2 f ( x : B P ( x )) = ( y : f ( B ) f ( P ( f - 1 ( y )))) Change of symbol simply distributes through parallel composition L3 f ( P || Q ) = f ( P ) || f ( Q ) 29
Image of page 29
& $ % Change of symbol distributes in a slightly more complex way over recursion, changing the alphabet in the appropriate way L4 f ( μX : A F ( X )) = (
Image of page 30

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 31
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern