Title: SCOOP: Simple Concurrent Object-Oriented Programming
1SCOOP Simple Concurrent Object-Oriented
Programming
- Piotr Nienaltowski, Volkan Arslan, Bertrand Meyer
- presented by Mark Schall
2The Problem
- What is the simplest, smallest and most
convincing extension to the method of systematic
object-oriented software construction that can
address the needs of concurrent and distributed
computing as well as those of sequential
computation? Bertrand Meyer
3SCOOP Model
- High-level concurrency mechanism
- Based on Design by Contract
- Full use of inheritance
- Applicable to many physical setups
multiprocessing, multithreading, distributed
execution
4Brief History
- First published in 1993 by Bertrand Meyer
- Designed as extension to Eiffel
- First prototype was implemented in 1995
5Architecture
- Top Layer
- platform independent
- Bottom Layer
- language/platform specific
6Bottom Layer
- Eiffel
- Added single new keyword separate
- .NET
- Add two new classes to be inherited
- SEPARATE_CLIENT
- SEPARATE_SUPPLIER
7Separate Calls
- Keyword separate declares if an object should be
handled on the same processor or not
- SOME_ROUTINE( x separate CLASS ) is
- do
- x.f()
- end
-
- x separate CLASS
- create x.make
- b.SOME_ROUTINE(x)
x.f() will be handled on a different processor
then the call b.SOME_ROUTINE(x)
8Client and Supplier
Object b (Client) Processor 1
Object x (Supplier) Processor 2
SOME_ROUTINE(x) x.f()
f() is do end
9Processors
- Not just mean physical CPU
- Threads
- Processes
- Computers in a distributed system
- Application Domain
10Access control policy
- Separate calls are valid if the target of the
call is an argument of the enclosing routine - SOME_ROUTINE( x separate CLASS ) is
- do
- x.f()
- end
-
- a separate CLASS
- create a.make
- SOME_ROUTINE(a) -- instead of a.f()
11Basic Access Control Policy Example
- Processor 1
- while( !lock(a) )
- wait( a )
- SOME_ROUTINE(a)
- a.f()
- release(a)
Processor 2 f() is do end
12Access control policy
- Using Design by Contract
- store(buffer separate BUFFER value INTEGER) is
- require -- precondition
- buffer_not_full not buffer.is_full
- do
- buffer.put(value)
- ensure -- postcondition
- buffer_not_empty not buffer.is_empty
- end
-
- buf separate BUFFER
- store(buf, 20)
13Wait by necessity
- Client Objects
- do not need to wait for feature calls of a
supplier in order to call another feature call - must wait on query calls for all previous calls
to finish on the same supplier
14Example
- some_feature( x, y, z separate CLASS ) is
- do
- x.f
- y.f
- x.g
- z.f
- y.g
- v x.is_empty -- wait for x.f and x.g
- v x.value gt y.value -- wait for y.f and y.g
- end
15Producer/Consumer Example
- ProduceAndConsume( p separate PRODUCER, c
separate CONSUMER ) is - do
- c.consume_n(5)
- p.produce_n(5)
- end
-
- buf separate BUFFER
- consumer separate CONSUMER
- producer separate PRODUCER
- create c.make(buf)
- create p.make(buf)
- ProduceAndConsume(producer, consumer)
16Producer
store (buffer separate BUFFER INTEGER value
INTEGER) is require buffer_not_full not
buffer.is_full value_provided value /
Void do buffer.put (value) end
- produce_n (n INTEGER) is
- local
- value INTEGER
- i INTEGER
- do
- from i 1
- until i gt n
- loop
- value random_gen.next
- store (buf, value)
- i i 1
- end
- end
- end -- class PRODUCER
17Consumer
- consume_n (n INTEGER) is
- local
- i INTEGER
- do
- from i 1
- until i gt n
- loop
- consume_one (buf)
- i i 1
- end
- end
consume_one (buffer separate BUFFER INTEGER)
is require buffer_specified buffer /
Void buffer_not_empty not buffer.is_empty do valu
e buffer.item buffer.remove end
18Producer/Consumer Example
- ProduceAndConsume( p separate PRODUCER, c
separate CONSUMER ) is - do
- c.consume_n(5)
- p.produce_n(5)
- end
-
- buf separate BUFFER
- consumer separate CONSUMER
- producer separate PRODUCER
- create c.make(buf)
- create p.make(buf)
- ProduceAndConsume(producer, consumer)
19Reusing old software
- Support for inheritance allows for reuse of
non-concurrent software - May only require a simple wrapper class
- separate class BUFFER
- inherit QUEUE
- end
20Distributed Computing
- Processors can be Computers in the network
- Concurrency Control File
- maps processors to physical addresses
- machines
- processes
- etc.
- Can take advantage of .NET Remoting library
21Distributed Computing
Internet
Home Desktop
arctic.cse.msu.edu
LAN
pacific.cse.msu.edu
Processor 1
Processor 4
Processor 3
o5
o1
o3
Processor 5
Processor 2
o4
o6
o2
22Duels
- An attempt to grab a shared object from the
current holder - Holder
- retain (default)
- yield
- Challenger
- wait_turn (default)
- demand
- insist
- Exceptions interrupt either the Holder or
Challenger to settle the Duel
23Future Work
- Real-time programming
- Priority mechanisms
- Timeout controls
- Deadlock Avoidance
24Future Work
- RECOOP Reliable and Efficient Concurrent
Object-Oriented Programs - Microsofts Safe and Scalable Multicore Computing
RFP - Continuation of SCOOP
- Developing a practical formal semantics and proof
mechanism