Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Tiago Cogumbreiro
cogumbreiro@di.fc.ul.pt
Universidade de Lisboa
Outline
1 Motivation
2 A Lock Discipline
3 Data Races
4 The Language
5 Examples
Singlecore
Multicore
MIL
Motivation
Context
Fine-grained multithreading
Thousand of threads
MIL
Motivation
Goal
Concurrency primitives
Shared memory
Security properties:
typed
enforce a memory usage discipline
MIL
Motivation
Our approach
MIL’s Architecture
registers registers
local local
memory memory
Outline
1 Motivation
2 A Lock Discipline
3 Data Races
4 The Language
5 Examples
MIL
A Lock Discipline
/*
* Lock surface. (Don’t forget to call Unlock)
*/
void nD3D9Surface::Lock(int &pitch, void** data)
WINE 20050211
MIL
A Lock Discipline
CODA 5.3.20
MIL
A Lock Discipline
Is that a solution?
MIL
A Lock Discipline
Rules
Outline
1 Motivation
2 A Lock Discipline
3 Data Races
4 The Language
5 Examples
What if I could change your
poker’s hand?
MIL
Data Races
Mutual Exclusion
No race conditions!
MIL
The Language
Outline
1 Motivation
2 A Lock Discipline
3 Data Races
4 The Language
5 Examples
MIL
The Language
Move r := v
Alloc r := malloc [~τ ]
Load r := v [n]
Store r [n] := v
Jump jump v
Conditional Jump if r = v jump v
No call stack.
MIL
The Language
Security properties
Threads
Create fork v
Finish yield
Cooperative threads
MIL
The Language
Security properties
Atomic operation:
Locks
Create α, r := newLock
Acquire r := testSetLock v
Release unlock v
Share share r guarded by α
MIL
The Language
Security properties
Outline
1 Motivation
2 A Lock Discipline
3 Data Races
4 The Language
5 Examples
MIL
Examples
Factorial
fract (r1:int) {
r2 := 1
if r1 = 0 jump fractFinish
jump doFract
}
doFract (r1:int, r2:int) {
if r1 = 1 jump fractFinish
r2 := r2 * r1
r1 := r1 - 1
jump doFract
}
fractFinish (r2:int) {
-- do some work
}
MIL
Examples
Creating a tuple
prepare () {
r1 := malloc [int, int]
r1[0] := 10
r1[1] := 20
share r1 guarded by l
jump compute
}
compute (r1: <int, int>^l) {
-- do some work
}
MIL
Examples
Spin-lock
Sleep-lock
Omitted features
Universal quantifier
Existential quantifier
Recursive type
Read-only tuples
MIL
Examples
Further work
Thank you.
Any questions?