1 ivan lanese computer science department university of bologna italy types for deadlock avoidance...

14
1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Upload: regan-parrett

Post on 31-Mar-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

1

Ivan LaneseComputer Science Department

University of BolognaItaly

Types for deadlock avoidance in SSCC

Page 2: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

What is SSCC?

SCC (Service Centered Calculus) is a Sensoria calculus for modelling web services and their interactions [see Rosario’s talk]

SSCC (Stream-based SCC) is a variation of SCC– For improving usability

– Has a stream construct for coordination among different services

– Developed with en eye on typability

Page 3: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

SSCC syntax

streamP asf inQfeedv:Pf (x):P

9=

;Coordination

P ::= P jQ(ºa)P0recX :PX

9>>>>=

>>>>;

Standard operators

a ) Pa ( P

¾

Services

v:P(x)P

¾Conversations

Page 4: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

An idea about the semantics

Service definitions and invocations interact creating sessions

Values can be exchanged between corresponding sessions

Streams can be used to make different systems interact

(ºr)(r B v:P jr C (x)Q) ! (ºr)(r B P jr C Q[v=x])

a ) P ja ( Q ! (ºr)(r B P jr C Q)

streamfeedv:P asf = hi inf (x):QstreamP asf = hvi inf (x):QstreamP asf = hi inQ[v=x]

Page 5: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Fast example

Invoke services a and b and use the results to invoke c

stream(a ( (x)feedx)j(b( (y)feedy)

asf = hi inf (z):f (w):c ( z:w:(t)feedt

Page 6: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Deadlock avoidance in SSCC

Many possible causes of deadlock in the system– Invoked service not available

– Client and server protocols not compatible

– Read stream empty

– Cyclic dependencies between the above things

Page 7: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Invoked service not available

Difficult to avoid in general– Services can be created and removed dynamically

– Service names can be communicated

There are some simple to treat cases– Only persistent services at top level (always available)

– Linear services (just one definition and one invocation)» Types for linearity in π-calculus can be adapted

Page 8: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Client and server protocols not compatible

Can be solved using session types Useful (and meaningful) to force sequentiality in

protocols Protocols

– ?T.U Input

– !T.U Output

– end End of protocol

Client and server protocols should be complementary

Page 9: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Read stream empty

Streams are static Easy to ensure that the number of feeds to a stream is

greater than the number of reads from the stream Attach to the stream a type that includes the number of

values it will contain

Page 10: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

Cyclic dependencies

The most difficult problem

(ºa)stream(a ( (x)feedx)

asf = hi inf (z):a ) 5

Page 11: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

How to solve it?

Operators in the program should be stratified according to some priority– An operator can depend only on operators with higher priority

– Corresponding operators (e.g., definition and invocation of a service) should have the same priority

Priorities should be added to:– Services

– Streams

– Steps in service protocols

Operators with maximal priority are enabled

Page 12: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

And finally…

If the system satisfies all these conditions…

… then it is deadlock-free

Page 13: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

What we have done?

Written a type system ensuring– Protocol compatibility

– Stream values available

– No cyclic dependencies

If services are available then the system is deadlock-free Now writing and checking the proofs

Page 14: 1 Ivan Lanese Computer Science Department University of Bologna Italy Types for deadlock avoidance in SSCC

End of talk