• Aucun résultat trouvé

J-O-Caml (6)

N/A
N/A
Protected

Academic year: 2022

Partager "J-O-Caml (6)"

Copied!
18
0
0

Texte intégral

(1)

J-O-Caml (6)

[email protected]

pauillac.inria.fr/~levy/qinghua/j-o-caml

Qinghua, December 4

vendredi 4 décembre 2009

(2)

Plan of this class

concurrency

threads, locks, conditions, shared memory

communication channels, CML

distributed setting

principles of Jocaml

a concurrent labeling program ?!!!

vendredi 4 décembre 2009

(3)

Exercices

???

vendredi 4 décembre 2009

(4)

Threads

light weight processes are implemented in Thread module

both VM threads (byte code) and Linux threads (binary if available)

produces

vendredi 4 décembre 2009

(5)

Concurrency - Shared memory

critical sections -- locks

vendredi 4 décembre 2009

(6)

Concurrency - Shared memory

concurrent FIFO with

locks + condition variables

vendredi 4 décembre 2009

(7)

Concurrency - Shared memory

locks and condition variables are light implementations of old Hoare/

Hansen/Dijkstra monitors

implemented in many languages with shared memory [Modula3, C#]

curiously missing in Java [locks but no conditions !]

impossible to write correct version of readers/writers without them

vendredi 4 décembre 2009

(8)

Communication channels

John Reppy’s Event module for CML (SML/NJ) in Ocaml

vendredi 4 décembre 2009

(9)

Distributed environments

asynchronous communications

rendez-vous on unlocalized channels are impossible because of distributed consensus

need for join patterns

vendredi 4 décembre 2009

(10)

Join-Patterns

asynchronous channels

vendredi 4 décembre 2009

(11)

Join-Patterns

synchronous channels

join patterns [waiting for presence of several messages]

vendredi 4 décembre 2009

(12)

Join-Patterns

actors without memory state !

half of J.-P. Banatre multi-functions paradigm

hiding internal channels

vendredi 4 décembre 2009

(13)

Join-Patterns

collectors are frequent programming scheme

example of a compute server

vendredi 4 décembre 2009

(14)

Distribution

server side (with help of nameserver) on here.inria.fr

client side (with help of nameserver)

vendredi 4 décembre 2009

(15)

Real examples

ray tracers (given in standard jocaml release)

one of which won the ICFP programming contest

slight modifications to get the concurrent or distributed version

join patterns are polyphonic C# (Benton), VB 9.0 (Russo)

Jocaml [without mobility] now follows Ocaml releases

and mobility ?

General philosophy

concurrent programming is very hard

distribution is impossible to debug

local and remote behaviors should be identical

vendredi 4 décembre 2009

(16)

Combien d’objets dans une image?

Jean- Jacques L évy INRIA

vendredi 4 décembre 2009

(17)

Labeling

16 objects in this picture 1

1

2 3

4 5 6

7

8 9

10

11 12

13 14

vendredi 4 décembre 2009

(18)

Concurrent algorithm

1) first pass

-

scan pixels left-to-right, top-to-bottom giving a new object id each time a new object is met, can be done on dual-core with half image per core.

2) second pass

-

generate equivalences between ids due to new adjacent relations met during scan of pixels, taking care of border (generating new equivalences)

3) third pass

-

compute the number of equivalence classes and give result in parallel

4) think of the distributed setting with several machines on the net

vendredi 4 décembre 2009

Références

Documents relatifs

This shows that boosting by assembling features extracted from our new “keypoint presence” family does work and allow to build a strong classifier able to

this paper is to represent and describe the set of the Gauss digitizations of Γ obtained using the grids generated by the action of the translation group on the standard

If one con- siders an existing recognition model, using some given type of local descriptors [SM96, LG96, SC96] the range of application is limited by the complexity of the images

ASP : abdomen sans préparation. CDCV : Cyclophosphamide, Doxorubicine, Carboplatine, Etoposide. CHOP : centre hospitalier pédiatrique d'oncologie. EMC : Elsevier

The renaming request travels from section to section until a producer is found (i.e. an instruction writing to s). In the sum function example, for any size of the data, the

Mechanisms include disclosure of financial dealings to allow public accountability; the employment of the tax system to broaden the base of party funds; state subsidy of

The Forum was organized by Memorial University of Newfoundland, specifically by the Leslie Harris Centre of Regional Policy and Development (based on the St.