Nonempty buffer contains empty slots Producer ready Consumer
(有限長バッファの同期記述) Non-empty ⊃buffer contains empty slots Producer ready Consumer ready S 1 Buffer slot allocated Message placed in buffer slot M S 2 Message removed from buffer slot Buffer slot returned Non-empty ⊂buffer contains messages 2. 2 Petri Net solution to the Message Buffer Problem
Network of communicating processes -- stream-based programming -☆ cons の arg は全て lazy evaluation すると仮定 addl x = ((car x) + 1) : addl(cdr( x)) x : list (addl(x) ≡ cons(car(x) + 1, addl(cdr(x)))) “: ”はcons operation x = [e 1, e 2, e 3……. ] addl x = [e 1+l, e 2+l, e 3+l……] ☆ integers = l : (addl integers) l cons integers [1, 2, 3…] add 1 x →はstream, はprocessと考えられる y cons(x. y)
Merger x 3 merger x 2 x 5 Hamming 問題の解法 l cons
Eratothenes篩 primes = sieve(integer-from-2) sieve (x ) = cons(car(x), sieve(filter((car x), cdr(x))) x filter integer-from-2 car cdr car(x) cdr(x) sieve primes
- Slides: 22