Automatic Realizations of Statically Safe Intra-Object - - PowerPoint PPT Presentation

automatic realizations of statically safe intra object
SMART_READER_LITE
LIVE PREVIEW

Automatic Realizations of Statically Safe Intra-Object - - PowerPoint PPT Presentation

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Automatic Realizations of Statically Safe Intra-Object Synchronization Schemes in MP-Eiffel Miguel Oliveira e


slide-1
SLIDE 1

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Automatic Realizations of Statically Safe Intra-Object Synchronization Schemes in MP-Eiffel

Miguel Oliveira e Silva (mos@det.ua.pt)

IEETA - Department of Electronics, Telecommunications, and Informatics University of Aveiro

First International Symposium on Concurrency, Real-Time and Distribution in Eiffel-like Languages, 2006

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-2
SLIDE 2

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Outline

1

Motivation

2

Basic Definitions

3

MP-Eiffel Brief Presentation

4

Intra-Object Synchronization

5

Inter-Object Synchronization

6

Other Issues

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-3
SLIDE 3

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Why an alternative approach to SCOOP?

Why an Alternative Approach to SCOOP?

Provide both models of inter-processor communication: x.f(y)

Shared memory (Current = processor(x)) Message passing (Current /= processor(x))

Intra-object concurrency Concurrent contracts Avoid redundancy within concurrent calls (wrapper routines with duplicated preconditions) Interesting and fun work for a PhD

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-4
SLIDE 4

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Basic Definitions

Processor (Writer, Reader) Concurrent objects Synchronization requirements:

Intra-object synchronization (server synchronization) Conditional synchronization Inter-object synchronization (client synchronization)

Concurrent condition Concurrent assertion Concurrent object availability COAx = Nc Nx x: readers/writers/all, c: maximum concurrent processors

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-5
SLIDE 5

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues General properties Shared memory inter-processor communication Message Passing Inter-Processor Communication Processor Life Cycle

MP-Eiffel

Explicit concurrent objects Static safety Abstract processors Both models of inter-processor communication Abstract synchronization Concurrency control language

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-6
SLIDE 6

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues General properties Shared memory inter-processor communication Message Passing Inter-Processor Communication Processor Life Cycle

Shared Memory Inter-Processor Communication

shared and remote objects shared entities: job_queue: shared QUEUE[JOB] remote entities: weather: remote WEATHER

Identify pure query services attributes functions without assignments to attributes and calls to impure routines. all possible redefinitions are also required to be pure

Synchronous exceptions (same processor)

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-7
SLIDE 7

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues General properties Shared memory inter-processor communication Message Passing Inter-Processor Communication Processor Life Cycle

Message Passing Inter-Processor Communication

triggers message sender: trigger x.f x is required to be a remote entity message receiver: explicit trigger interface trigger {A_CLASS} a,b,c Synchronous sequential preconditions

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-8
SLIDE 8

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues General properties Shared memory inter-processor communication Message Passing Inter-Processor Communication Processor Life Cycle

Processor Life Cycle

Created by a create call on a remote entity

START EXECUTE CREATION TRIGGER? END EXECUTE TRIGGER WAIT NO YES TRIGGER FINISH

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-9
SLIDE 9

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Concurrent Object Correctness

Abstract Data Type Stable times client usage ensure sequential correctness Public modifiable attributes forbidden Linearizability (Herlihy, 1990) Class contracts Total object covering Processor attributes (not yet adopted)

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-10
SLIDE 10

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Concurrent Contracts

Correct behavior?

assert C end if not C then raise exception end (1) reserve OBJs do if not C then raise exception end end (2) wait C end (3) CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-11
SLIDE 11

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Monitor

Object P1 . . . Pn Pi COAP = 1

n

: Processor Monitor : i ∈ {1, . . . , n}

Simplest synchronization scheme Lowest concurrent availability Requirements: Public service identification

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-12
SLIDE 12

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Readers-Writer Exclusion

Object R1 . . . Rp W1 . . . Wq R1 . . . Rp COAR = 100% , COAW = 0% Object R1 . . . Rp W1 . . . Wq Wi COAR = 0% , COAW = 1

q

Taking advantage of command/query separation Requirements: Query (pure) services identification

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-13
SLIDE 13

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Concurrent Readers-Writer

Object R1 . . . Rp W1 . . . Wq R1 . . . Rp Wi COAR = 100% COAW = 1

q

: Processor Readers-Writer Concurrent : i ∈ {1, . . . , q}

Similar requirements as readers-writer exclusion Starvation of readers is possible Wait-free algorithm (Peterson) for

  • bjects with a unique writer

(concurrent objects attached to remote entities) Repeatable pure queries

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-14
SLIDE 14

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Lock-Free and Software Transactional Memory

Object R1 . . . Rp W1 . . . Wq R1 . . . Rp W1 . . . Wq COAR = 100% COAW = 100% : Processor Lock-Free :

No blocking Immune to deadlocks and processor failure Complex schemes Requirements: Object state replication Repeatable services

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-15
SLIDE 15

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Mixed Exclusion Schemes

Object R1 . . . Rp W1 . . . Wq A B COAA = COACRW COAB = COALF Lock-Free (B) : Readers-Writer (A) Concurrent :

Mutual exclusion between schemes Solves the problem of intra-object and inter-object object synchronization integration Requirements: Total object covering Safety of each scheme

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-16
SLIDE 16

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues Concurrent Object Correctness Monitor Readers-Writer Exclusion Concurrent Readers-Writer Lock-free and software transactional memory Mixed synchronization schemes

Mixed Concurrent Schemes

Object R1 . . . Rp W1 . . . Wq C A B X exclusion Features in X require can run concurrently Features in A and B Readers-Writer Exclusion : Concurrent C :

Unsafe in general It may apply if concurrent services handle don’t use the same

  • attributes. However,

linearizable invariant verification is required!

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-17
SLIDE 17

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Inter-Object Synchronization

SCOOP:

Locking is attached with formal arguments It is a redundant approach (wrapping services and possible precondition duplication)

Certain instructions expect sequential consistency Example:

if buffer.empty then

  • - (1)
  • - (2)

... else

  • - (4)
  • - (5)

... end

Preconditions, iterative instructions

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-18
SLIDE 18

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Other issues

Conditional synchronization implementation

One condition variable per object, and signal all processors at the end of the object’s public routines Take advantage of commands and queries (MP-Eiffel)

Sub-type polymorphism

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel

slide-19
SLIDE 19

Motivation Basic Definitions MP-Eiffel Brief Presentation Intra-Object Synchronization Inter-Object Synchronization Other Issues

Summary

1

Motivation

2

Basic Definitions

3

MP-Eiffel Brief Presentation

4

Intra-Object Synchronization

5

Inter-Object Synchronization

6

Other Issues

CORDIE 2006, July, York, UK Synchronization in MP-Eiffel