Correct Concurrency with Chalice

Correct Concurrency with Chalice Correct Concurrency with Chalice - Start

2016-02-29 42K 42 0 0

Correct Concurrency with Chalice - Description

K. Rustan M. Leino. Research in Software Engineering (. RiSE. ). MSR Redmond. INRIA-MSR. 16 January 2009. Orsay. , France. Joint work with:. Peter Müller, ETH Zurich. Jan Smans, KU Leuven. Chalice. Experimental language with focus on:. ID: 236562 Download Presentation

Download Presentation

Correct Concurrency with Chalice




Download Presentation - The PPT/PDF document "Correct Concurrency with Chalice" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentations text content in Correct Concurrency with Chalice

Slide1

Correct Concurrency with Chalice

K. Rustan M. LeinoResearch in Software Engineering (RiSE)MSR Redmond

INRIA-MSR16 January 2009Orsay, France

Joint work with:

Peter Müller, ETH Zurich

Jan Smans, KU Leuven

Slide2

Chalice

Experimental language with focus on:

Share-memory concurrency

Static verification

Features:

Object/class-based memory (no

subclassing

)

Fractional-permissions

model

Locks: mutual exclusion and readers/writers

Two-state monitor invariants

Deadlock prevention

Dynamic lock re-ordering

Slide3

Permissions

Every memory location has an associated permission, which dynamically can be divided between threads and monitors

acc(

o.x

, p)

specifies that the holder has p% permission to location

o.x

acc(

o.x

)

=

acc(

o.x

, 100)

Slide4

Encoding

Value of o.x is stored in Heap[o,x]Current thread’s permission for o.x is stored in Mask[o,x]

Heap

Mask

Slide5

Predicate evaluation

The evaluation of a predicate results in a transfer of permissions

For

method M() requires Pre ensures Post

caller

exhales

Pre and

inhales

Post

callee

inhales

Pre and

exhales

Post

Exhaling

acc(

o.x

, p)

amounts to:

assert p

Mask[

o,x

];

Mask[

o,x

] := Mask[

o,x

] – p;

As in linear logic and separation logic,

acc(

o.x

)

 acc(

o.x

)

is equivalent to

false

Slide6

More about predicates

A predicate must be defined

o.x

= 25

bad

acc(

o.x

)

o.x

= 25

good

Note that

acc

expressions can be guarded

o ≠ null

 acc(

o.x

)

acc

expressions can appear only in positive positions in predicates

Slide7

Object life cycle

thread

local

shared

acquired

new

share

acquire

release

unshare

Slide8

Monitor invariants

A monitor invariant holds when an object is in the shared state

class C { invariant J; … }

A monitor invariant must hold permissions for the locations it mentions

Slide9

Monitor invariant checks

thread

local

shared

acquired

new

share

acquire

release

unshare

Slide10

Threads

Fork/join provide asynchronous calls

Roughly:

call

o.M

()

Exhale Pre; Inhale Post

fork

o.M

()

Exhale Pre

join

o.M

()

Inhale Post

Slide11

Preventing deadlocks

When shared, an object is inserted into a global ordering among monitors

share p between o and q

Monitors must be acquired in ascending order

Position in locking order can be changed with the

reorder

statement

Slide12

-autoMagic

Filling in specifications to make them defined

o ≠ null

 acc(

o.x

) 

o.x

= 5

can be written just as:

o.x

= 5

Demo:

RockBand

Slide13

Example

Hand-over-hand locking

Slide14

Advanced permissions

A permission is a pair (

p,n

)

Intuitively, (

p,n

) represents the permission p + n*

rd(

o.x

, n)

specifies n*

rd(

o.x

)

=

rd(

o.x

, 1)

rd(

o.x

, *)

specifies an unbounded supply of ’s

Issue: good specification of read access


About DocSlides
DocSlides allows users to easily upload and share presentations, PDF documents, and images.Share your documents with the world , watch,share and upload any time you want. How can you benefit from using DocSlides? DocSlides consists documents from individuals and organizations on topics ranging from technology and business to travel, health, and education. Find and search for what interests you, and learn from people and more. You can also download DocSlides to read or reference later.