Tag: Job Control in urbiscript Jean-Christophe Baillie Akim - - PowerPoint PPT Presentation

tag job control in urbiscript
SMART_READER_LITE
LIVE PREVIEW

Tag: Job Control in urbiscript Jean-Christophe Baillie Akim - - PowerPoint PPT Presentation

Tag: Job Control in urbiscript Jean-Christophe Baillie Akim Demaille Quentin Hocquet Matthieu Nottale Gostai S.A.S. Control Architectures of Robots 2010 May 18th, 2010 Tag: Job Control in urbiscript Concurrency 1 Flow Control Events


slide-1
SLIDE 1

Tag: Job Control in urbiscript

Jean-Christophe Baillie Akim Demaille Quentin Hocquet Matthieu Nottale

Gostai S.A.S.

Control Architectures of Robots 2010 May 18th, 2010

slide-2
SLIDE 2

Tag: Job Control in urbiscript

1

Concurrency Flow Control Events

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 2 / 33

slide-3
SLIDE 3

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 3 / 33

slide-4
SLIDE 4

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 4 / 33

slide-5
SLIDE 5

Architecture

Windows Mac OS X Linux RT OS Xenomai Hardware

UObject

(Ex. : motors, camera)

C++ RTC Component

(Ex. : motors, camera)

C++

urbiscript

RTC Interface Urbi

Applications

  • Ex. : Gostai Lab,

remote surveillance...

Remote Component

  • Ex. : algorithms, applications...

liburbi Java liburbi C++

UObject C++

liburbi Matlab RAW TCP socket through simple protocol

code

Gostai RTC Runtime

N E T W O R K

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 5 / 33

slide-6
SLIDE 6

Architecture Windows Mac OS X Linux RT OS Xenomai Hardware

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 5 / 33

slide-7
SLIDE 7

Architecture Windows Mac OS X Linux RT OS Xenomai

UObject

(Ex. : motors, camera)

C++ RTC Component

(Ex. : motors, camera)

C++

urbiscript

RTC Interface Urbi

Gostai RTC Runtime

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 5 / 33

slide-8
SLIDE 8

Architecture

Remote Component

  • Ex. : algorithms, applications...

liburbi Java liburbi C++

UObject C++

liburbi Matlab RAW TCP socket through simple protocol

code

N E T W O R K

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 5 / 33

slide-9
SLIDE 9

Architecture

Applications

  • Ex. : Gostai Lab,

remote surveillance... liburbi Java RAW TCP socket

code

N E T W O

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 5 / 33

slide-10
SLIDE 10

Architecture

Windows Mac OS X Linux RT OS Xenomai Hardware

UObject

(Ex. : motors, camera)

C++ RTC Component

(Ex. : motors, camera)

C++

urbiscript

RTC Interface Urbi

Applications

  • Ex. : Gostai Lab,

remote surveillance...

Remote Component

  • Ex. : algorithms, applications...

liburbi Java liburbi C++

UObject C++

liburbi Matlab RAW TCP socket through simple protocol

code

Gostai RTC Runtime

N E T W O R K

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 6 / 33

slide-11
SLIDE 11

Concurrency

Concurrency

1

Concurrency Flow Control Events

2

Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 7 / 33

slide-12
SLIDE 12

Concurrency Flow Control

Flow Control

1

Concurrency Flow Control Events

2

Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 8 / 33

slide-13
SLIDE 13

Concurrency Flow Control

From Sequential to Concurrent

sequentiality

a;b

tight sequentiality

a|b

background concurrency

a,b

fair-start concurrency

a&b

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 9 / 33

slide-14
SLIDE 14

Concurrency Flow Control

From Sequential to Concurrent

sequentiality

a;b

tight sequentiality

a|b

background concurrency

a,b

fair-start concurrency

a&b

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 9 / 33

slide-15
SLIDE 15

Concurrency Flow Control

From Sequential to Concurrent

sequentiality

a;b

tight sequentiality

a|b

background concurrency

a,b

fair-start concurrency

a&b

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 9 / 33

slide-16
SLIDE 16

Concurrency Flow Control

From Sequential to Concurrent

sequentiality

a;b

tight sequentiality

a|b

background concurrency

a,b

fair-start concurrency

a&b

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 9 / 33

slide-17
SLIDE 17

Concurrency Flow Control

Backgrounding Commands

for (3) { sleep(1s); echo("ping"); }, sleep(0.5s); for (3) { sleep(1s); echo("pong"); }, sleep(4s); [00000316] *** ping [00000316] *** pong [00000316] *** ping [00000316] *** pong [00000316] *** ping [00000316] *** pong

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 10 / 33

slide-18
SLIDE 18

Concurrency Flow Control

Backgrounding Commands

for (3) { sleep(1s); echo("ping"); }, sleep(0.5s); for (3) { sleep(1s); echo("pong"); }, sleep(4s); [00000316] *** ping [00000316] *** pong [00000316] *** ping [00000316] *** pong [00000316] *** ping [00000316] *** pong

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 10 / 33

slide-19
SLIDE 19

Concurrency Flow Control

Concurrent Flavors of Flow Control Constructs

for (var i : 3.seq.reverse) { echo("%s: start" % i); sleep(i); echo("%s: done" % i) }; echo("done"); [00125189] *** 2: start [00127190] *** 2: done [00127190] *** 1: start [00128192] *** 1: done [00128192] *** 0: start [00128193] *** 0: done [00128194] *** done for& (var i : 3.seq.reverse) { echo("%s: start" % i); sleep(i); echo("%s: done" % i) }; echo("done"); [00105789] *** 2: start [00105789] *** 1: start [00105789] *** 0: start [00105793] *** 0: done [00106793] *** 1: done [00107793] *** 2: done [00107795] *** done

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 11 / 33

slide-20
SLIDE 20

Concurrency Flow Control

Concurrent Flavors of Flow Control Constructs

for (var i : 3.seq.reverse) { echo("%s: start" % i); sleep(i); echo("%s: done" % i) }; echo("done"); [00125189] *** 2: start [00127190] *** 2: done [00127190] *** 1: start [00128192] *** 1: done [00128192] *** 0: start [00128193] *** 0: done [00128194] *** done for& (var i : 3.seq.reverse) { echo("%s: start" % i); sleep(i); echo("%s: done" % i) }; echo("done"); [00105789] *** 2: start [00105789] *** 1: start [00105789] *** 0: start [00105793] *** 0: done [00106793] *** 1: done [00107793] *** 2: done [00107795] *** done

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 11 / 33

slide-21
SLIDE 21

Concurrency Flow Control

Factorial

function echoFact (var n) { var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]); }|; echoFact(9); [00003434] *** 9! = 362880 echoFact(10); [00003434] *** 10! = 3628800 for& (var i : 10.seq.reverse) echoFact(i); [00018878] *** 1! = 1 [00018878] *** 0! = 1 [00018879] *** 2! = 2 [00018879] *** 3! = 6 [00018879] *** 4! = 24 [00018880] *** 5! = 120 [00018880] *** 6! = 720 [00018880] *** 7! = 5040 [00018881] *** 8! = 40320 [00018881] *** 9! = 362880

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 12 / 33

slide-22
SLIDE 22

Concurrency Flow Control

Factorial

function echoFact (var n) { var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]); }|; echoFact(9); [00003434] *** 9! = 362880 echoFact(10); [00003434] *** 10! = 3628800 for& (var i : 10.seq.reverse) echoFact(i); [00018878] *** 1! = 1 [00018878] *** 0! = 1 [00018879] *** 2! = 2 [00018879] *** 3! = 6 [00018879] *** 4! = 24 [00018880] *** 5! = 120 [00018880] *** 6! = 720 [00018880] *** 7! = 5040 [00018881] *** 8! = 40320 [00018881] *** 9! = 362880

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 12 / 33

slide-23
SLIDE 23

Concurrency Flow Control

Factorial

echoFact = function (var n) { var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]) }|; for& (var i : 4.seq.reverse) echoFact(i); [00018878] *** 1! = 1 [00018878] *** 0! = 1 [00018879] *** 2! = 2 [00018879] *** 3! = 6 echoFact = function (var n) { nonInterruptible; var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]) }|; for& (var i : 4.seq.reverse) echoFact(i); [00000051] *** 3! = 6 [00000052] *** 2! = 2 [00000053] *** 1! = 1 [00000054] *** 0! = 1

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 13 / 33

slide-24
SLIDE 24

Concurrency Flow Control

Factorial

echoFact = function (var n) { var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]) }|; for& (var i : 4.seq.reverse) echoFact(i); [00018878] *** 1! = 1 [00018878] *** 0! = 1 [00018879] *** 2! = 2 [00018879] *** 3! = 6 echoFact = function (var n) { nonInterruptible; var res = 1; for (var i = 2; i <= n; i++) res *= i; echo("%2d! = %7d" % [n, res]) }|; for& (var i : 4.seq.reverse) echoFact(i); [00000051] *** 3! = 6 [00000052] *** 2! = 2 [00000053] *** 1! = 1 [00000054] *** 0! = 1

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 13 / 33

slide-25
SLIDE 25

Concurrency Events

Events

1

Concurrency Flow Control Events

2

Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 14 / 33

slide-26
SLIDE 26

Concurrency Events

Events are Messages

var e = Event.new|; at (e?) echo("ping"); e!; [00000000] *** ping e!; [00000000] *** ping

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 15 / 33

slide-27
SLIDE 27

Concurrency Events

Events carry Messages

var e = Event.new|; at (e?) echo("e"); at (e?(var x)) echo("e(x)"); at (e?(1)) echo("e(1)"); at (e?(var x) if x % 2) echo("e(odd)"); e!; [00000845] *** e e!(0); [00011902] *** e [00011902] *** e(x) e!(1); [00023327] *** e [00023327] *** e(x) [00023327] *** e(1) [00023327] *** e(odd)

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 16 / 33

slide-28
SLIDE 28

Concurrency Events

Events carry Messages

var e = Event.new|; at (e?) echo("e"); at (e?(var x)) echo("e(x)"); at (e?(1)) echo("e(1)"); at (e?(var x) if x % 2) echo("e(odd)"); e!; [00000845] *** e e!(0); [00011902] *** e [00011902] *** e(x) e!(1); [00023327] *** e [00023327] *** e(x) [00023327] *** e(1) [00023327] *** e(odd)

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 16 / 33

slide-29
SLIDE 29

Concurrency Events

Assignments are Events

var e = 0|; at (e) echo("e is true!")

  • nleave

echo("e is false!"); at (e == 2) echo("e is two!"); at (e % 2 == 0) echo("e is even!"); [00028013] *** e is even! e = 0|; // A big fat nothing. e = 1|; [00023327] *** e is true! e = 2|; // Still true. [00028013] *** e is two! [00028013] *** e is even! e = 0|; // Still even. [00126958] *** e is false! e = 2|; // Still even. [00137252] *** e is true! [00137252] *** e is two!

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 17 / 33

slide-30
SLIDE 30

Concurrency Events

Assignments are Events

var e = 0|; at (e) echo("e is true!")

  • nleave

echo("e is false!"); at (e == 2) echo("e is two!"); at (e % 2 == 0) echo("e is even!"); [00028013] *** e is even! e = 0|; // A big fat nothing. e = 1|; [00023327] *** e is true! e = 2|; // Still true. [00028013] *** e is two! [00028013] *** e is even! e = 0|; // Still even. [00126958] *** e is false! e = 2|; // Still even. [00137252] *** e is true! [00137252] *** e is two!

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 17 / 33

slide-31
SLIDE 31

Tags

Tags

1

Concurrency

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 18 / 33

slide-32
SLIDE 32

Tags

Managing Concurrent Executions

Backgrounded code might need to be killed paused resumed more generally, managed Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 19 / 33

slide-33
SLIDE 33

Tags

Managing Concurrent Executions

Backgrounded code might need to be killed paused resumed more generally, managed Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 19 / 33

slide-34
SLIDE 34

Tags

Managing Concurrent Executions

Backgrounded code might need to be killed paused resumed more generally, managed Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 19 / 33

slide-35
SLIDE 35

Tags

Managing Concurrent Executions

Backgrounded code might need to be killed paused resumed more generally, managed Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 19 / 33

slide-36
SLIDE 36

Tags

Managing Concurrent Executions

Backgrounded code might need to be killed paused resumed more generally, managed Tags

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 19 / 33

slide-37
SLIDE 37

Tags Jobs

Jobs

1

Concurrency

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 20 / 33

slide-38
SLIDE 38

Tags Jobs

Stop

var t = Tag.new|; var t0 = time|; t: every(1s) echo("foo"), sleep(2.2s); [00000158] *** foo [00001159] *** foo [00002159] *** foo t.stop; // Nothing runs. sleep(2.2s); t: every(1s) echo("bar"), sleep(2.2s); [00000158] *** bar [00001159] *** bar [00002159] *** bar t.stop;

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 21 / 33

slide-39
SLIDE 39

Tags Jobs

Stop

var t = Tag.new|; var t0 = time|; t: every(1s) echo("foo"), sleep(2.2s); [00000158] *** foo [00001159] *** foo [00002159] *** foo t.stop; // Nothing runs. sleep(2.2s); t: every(1s) echo("bar"), sleep(2.2s); [00000158] *** bar [00001159] *** bar [00002159] *** bar t.stop;

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 21 / 33

slide-40
SLIDE 40

Tags Jobs

Stop with a Value

var t = Tag.new|; var res; detach(res = { t: every(1s) echo("computing") })|; sleep(2.2s); [00000001] *** computing [00000002] *** computing [00000003] *** computing t.stop("result"); assert(res == "result");

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 22 / 33

slide-41
SLIDE 41

Tags Jobs

Block

var ping = Tag.new("ping")|; ping: every (1s) echo("ping"), assert(!ping.blocked); sleep(2.1s); [00000000] *** ping [00002000] *** ping [00002000] *** ping ping.block; assert(ping.blocked); ping: every (1s) echo("pong"), // Neither new nor old code runs. ping.unblock; assert(!ping.blocked); sleep(2.1s); // But we can use the tag again. ping: every (1s) echo("ping again"), sleep(2.1s); [00004000] *** ping again [00005000] *** ping again [00006000] *** ping again

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 23 / 33

slide-42
SLIDE 42

Tags Jobs

Block

var ping = Tag.new("ping")|; ping: every (1s) echo("ping"), assert(!ping.blocked); sleep(2.1s); [00000000] *** ping [00002000] *** ping [00002000] *** ping ping.block; assert(ping.blocked); ping: every (1s) echo("pong"), // Neither new nor old code runs. ping.unblock; assert(!ping.blocked); sleep(2.1s); // But we can use the tag again. ping: every (1s) echo("ping again"), sleep(2.1s); [00004000] *** ping again [00005000] *** ping again [00006000] *** ping again

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 23 / 33

slide-43
SLIDE 43

Tags Events

Events

1

Concurrency

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 24 / 33

slide-44
SLIDE 44

Tags Events

Tagging Event Catchers

var e = true|; var t = Tag.new|; t: at (e) echo("e is true!")

  • nleave

echo("e is false!"); [00000173] *** e is true! e = false|; [00000185] *** e is false! e = true|; [00000218] *** e is true! t.freeze; e = false|; e = true|; t.unfreeze; e = true|; e = false|; [00000967] *** e is false!

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 25 / 33

slide-45
SLIDE 45

Tags Events

Tagging Event Catchers

var e = true|; var t = Tag.new|; t: at (e) echo("e is true!")

  • nleave

echo("e is false!"); [00000173] *** e is true! e = false|; [00000185] *** e is false! e = true|; [00000218] *** e is true! t.freeze; e = false|; e = true|; t.unfreeze; e = true|; e = false|; [00000967] *** e is false!

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 25 / 33

slide-46
SLIDE 46

Tags Events

Trajectories

var y = 0; y = 0 cos:2s ampli:10,

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 26 / 33

slide-47
SLIDE 47

Tags Events

Trajectories

var y = 0; t: y = 0 cos:2s ampli:10, { sleep(1.5s); t.freeze; sleep(1s); t.unfreeze; },

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 27 / 33

slide-48
SLIDE 48

Tags Misc

Misc

1

Concurrency

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 28 / 33

slide-49
SLIDE 49

Tags Misc

Hierarchical Tags

var demo = Tag.new; demo.addChild("dance"); demo.addChild("sing"); function robot.demo() { demo.dance: { /* dance behavior */ } & demo.sing: { /* sing behavior */ } }; demo.dance.stop; // Stop dancing demo.sing.stop; // Stop singing demo.stop; // Stop both

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 29 / 33

slide-50
SLIDE 50

Tags Misc

Hierarchical Tags

var demo = Tag.new; demo.addChild("dance"); demo.addChild("sing"); function robot.demo() { demo.dance: { /* dance behavior */ } & demo.sing: { /* sing behavior */ } }; demo.dance.stop; // Stop dancing demo.sing.stop; // Stop singing demo.stop; // Stop both

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 29 / 33

slide-51
SLIDE 51

Tags Misc

Hierarchical Tags

var demo = Tag.new; demo.addChild("dance"); demo.addChild("sing"); function robot.demo() { demo.dance: { /* dance behavior */ } & demo.sing: { /* sing behavior */ } }; demo.dance.stop; // Stop dancing demo.sing.stop; // Stop singing demo.stop; // Stop both

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 29 / 33

slide-52
SLIDE 52

Tags Misc

Enter/Leave events

var tag = Tag.new|; at (tag.enter?) echo("pre"); at (tag.leave?) echo("post"); tag: echo("in"); [00000000] *** pre [00000000] *** in [00000000] *** post

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 30 / 33

slide-53
SLIDE 53

Tags Misc

Enter/Leave events

var tag = Tag.new|; at (tag.enter?) echo("pre"); at (tag.leave?) echo("post"); tag: echo("in"); [00000000] *** pre [00000000] *** in [00000000] *** post

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 30 / 33

slide-54
SLIDE 54

Tags Misc

Enter/Leave events

Safety function cook() { turnGasOn(); { if (!recipe) throw Exception.new("ENORCP"); if (alreadyCooked) return false; doStuff(); }; turnGasOff(); return true; }|; var withGas = Tag.new|; at (withGas.enter?) turnGasOn(); at (withGas.leave?) turnGasOff(); function cookSafely() { withGas: { if (!recipe) throw Exception.new("ENORCP"); if (alreadyCooked) return false; doStuff(); return true; }; }|;

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 31 / 33

slide-55
SLIDE 55

Tags Misc

Enter/Leave events

Safety function cook() { turnGasOn(); { if (!recipe) throw Exception.new("ENORCP"); if (alreadyCooked) return false; doStuff(); }; turnGasOff(); return true; }|; var withGas = Tag.new|; at (withGas.enter?) turnGasOn(); at (withGas.leave?) turnGasOff(); function cookSafely() { withGas: { if (!recipe) throw Exception.new("ENORCP"); if (alreadyCooked) return false; doStuff(); return true; }; }|;

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 31 / 33

slide-56
SLIDE 56

Tags Misc

Mutual Exclusion

var x; function inc(var who) { var from = x; sleep(500ms); var to = x += 1; echo("%s: %s -> %s" % [who, from, to]); }|; timeout (2s) { x = 0; every (1s) inc("1"), sleep(0.3s); every (1s) inc("2"), }; [00000658] *** 1: 0 -> 1 [00000967] *** 2: 0 -> 2 [00001658] *** 1: 2 -> 3 [00001966] *** 2: 2 -> 4 timeout (2s) { x = 0; var m = Mutex.new; every (1s) m: inc("1"), sleep(0.3s); every (1s) m: inc("2"), }; [00000657] *** 1: 0 -> 1 [00001158] *** 2: 1 -> 2 [00001659] *** 1: 2 -> 3

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 32 / 33

slide-57
SLIDE 57

Tags Misc

Mutual Exclusion

var x; function inc(var who) { var from = x; sleep(500ms); var to = x += 1; echo("%s: %s -> %s" % [who, from, to]); }|; timeout (2s) { x = 0; every (1s) inc("1"), sleep(0.3s); every (1s) inc("2"), }; [00000658] *** 1: 0 -> 1 [00000967] *** 2: 0 -> 2 [00001658] *** 1: 2 -> 3 [00001966] *** 2: 2 -> 4 timeout (2s) { x = 0; var m = Mutex.new; every (1s) m: inc("1"), sleep(0.3s); every (1s) m: inc("2"), }; [00000657] *** 1: 0 -> 1 [00001158] *** 2: 1 -> 2 [00001659] *** 1: 2 -> 3

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 32 / 33

slide-58
SLIDE 58

Tags Misc

Mutual Exclusion

var x; function inc(var who) { var from = x; sleep(500ms); var to = x += 1; echo("%s: %s -> %s" % [who, from, to]); }|; timeout (2s) { x = 0; every (1s) inc("1"), sleep(0.3s); every (1s) inc("2"), }; [00000658] *** 1: 0 -> 1 [00000967] *** 2: 0 -> 2 [00001658] *** 1: 2 -> 3 [00001966] *** 2: 2 -> 4 timeout (2s) { x = 0; var m = Mutex.new; every (1s) m: inc("1"), sleep(0.3s); every (1s) m: inc("2"), }; [00000657] *** 1: 0 -> 1 [00001158] *** 2: 1 -> 2 [00001659] *** 1: 2 -> 3

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 32 / 33

slide-59
SLIDE 59

Outro

Tag: Job Control in urbiscript

1

Concurrency Flow Control Events

2

Tags Jobs Events Misc

J.-C. Baillie et al. (Gostai) Tag: Job Control in urbiscript CAR’10 33 / 33