J-O-Caml (6) pauillac.inria.fr/~levy/qinghua/j-o-caml Qinghua, December 4.

Slides:



Advertisements
Similar presentations
Ken Birman 1. Refresher: Dekers Algorithm Assumes two threads, numbered 0 and 1 CSEnter(int i) { int J = i^1; inside[i] = true; turn = J; while(inside[J]
Advertisements

COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
SE-292 High Performance Computing
Relaxed Consistency Models. Outline Lazy Release Consistency TreadMarks DSM system.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Evaluation of Message Passing Synchronization Algorithms in Embedded Systems 1 Evaluation of Message Passing Synchronization Algorithms in Embedded Systems.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles Seventh Edition By William Stallings.
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 7 Chapter 4: Threads (cont)
Concurrency: Mutual Exclusion and Synchronization Why we need Mutual Exclusion? Classical examples: Bank Transactions:Read Account (A); Compute A = A +
1 Distributed Computing Algorithms CSCI Distributed Computing: everything not centralized many processors.
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
DISTRIBUTED AND HIGH-PERFORMANCE COMPUTING CHAPTER 7: SHARED MEMORY PARALLEL PROGRAMMING.
Concurrent & Distributed Systems Lecture 4: ME solutions Lecture 3 considered possible algorithms for achieving Mutual Exclusion between the critical sections.
Concurrency CS 510: Programming Languages David Walker.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003.
Chapter 11: Distributed Processing Parallel programming Principles of parallel programming languages Concurrent execution –Programming constructs –Guarded.
Concurrency and Software Transactional Memories Satnam Singh, Microsoft Faculty Summit 2005.
Chapter 4.1 Interprocess Communication And Coordination By Shruti Poundarik.
Modern Concurrency Abstractions for C# by Nick Benton, Luca Cardelli & C´EDRIC FOURNET Microsoft Research.
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Lecture 6: Introduction to Distributed Computing.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
Oct Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt Istvàn June 2013 –
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
12/1/98 COP 4020 Programming Languages Parallel Programming in Ada and Java Gregory A. Riccardi Department of Computer Science Florida State University.
Architectures of distributed systems Fundamental Models
- 1 - Embedded Systems - SDL Some general properties of languages 1. Synchronous vs. asynchronous languages Description of several processes in many languages.
Lab 2 Group Communication Farnaz Moradi Based on slides by Andreas Larsson 2012.
CS 152: Programming Language Paradigms May 7 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
Farnaz Moradi Based on slides by Andreas Larsson 2013.
Programming Paradigms for Concurrency Pavol Cerny Vasu Singh Thomas Wies Part III – Message Passing Concurrency.
J-O-Caml (2) pauillac.inria.fr/~levy/qinghua/j-o-caml Qinghua, November 20.
Using a simple Rendez-Vous mechanism in Java
Lecture 8 Page 1 CS 111 Online Other Important Synchronization Primitives Semaphores Mutexes Monitors.
Shuman Guo CSc 8320 Advanced Operating Systems
Slide 13.1 © The McGraw-Hill Companies, 2002 Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach.
J-O-Caml (3) pauillac.inria.fr/~levy/qinghua/j-o-caml Qinghua, November 26.
J-O-Caml (1) Qinghua, November 19.
MW Tech IS 8040 Data Comm and Networking Dr. Hoganson Middleware Technology Communication Mechanisms Synchronous – process on client side must stop and.
Stacey Levine Chapter 4.1 Message Passing Communication.
C H A P T E R E L E V E N Concurrent Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
AtomCaml: First-class Atomicity via Rollback Michael F. Ringenburg and Dan Grossman University of Washington International Conference on Functional Programming.
Operating System Chapter 5. Concurrency: Mutual Exclusion and Synchronization Lynn Choi School of Electrical Engineering.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Testing Concurrent Programs Sri Teja Basava Arpit Sud CSCI 5535: Fundamentals of Programming Languages University of Colorado at Boulder Spring 2010.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Lecture 5. Example for periority The average waiting time : = 41/5= 8.2.
Introduction to threads
“Language Mechanism for Synchronization”
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Processes and Threads Processes and their scheduling
Outline Other synchronization primitives
Operating System (013022) Dr. H. Iwidat
Other Important Synchronization Primitives
Advanced Topics in Software Engineering 1
Parallel Programming in Contemporary Programming Languages (Part 2)
Chapter 4 Multithreading programming
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Transactional Memory Semaphores, monitors, and conditional critical regions all suffer from limitations based on lock semantics Naïve synchronization may.
Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach
CS 501: Software Engineering Fall 1999
A Refinement Calculus for Promela
Chapter 4: Threads.
CSE 451: Operating Systems Autumn 2003 Lecture 7 Synchronization
CSE 451: Operating Systems Autumn 2005 Lecture 7 Synchronization
CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization
Presentation transcript:

J-O-Caml (6) pauillac.inria.fr/~levy/qinghua/j-o-caml Qinghua, December 4

Plan of this class concurrency threads, locks, conditions, shared memory communication channels, CML distributed setting principles of Jocaml a concurrent labeling program ?!!!

Exercices ???

Threads light weight processes are implemented in Thread module both VM threads (byte code) and Linux threads (binary if available) produces

Concurrency - Shared memory critical sections -- locks

Concurrency - Shared memory concurrent FIFO with locks + condition variables

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

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

Distributed environments asynchronous communications rendez-vous on unlocalized channels are impossible because of distributed consensus need for join patterns

Join-Patterns asynchronous channels

Join-Patterns synchronous channels join patterns [waiting for presence of several messages]

Join-Patterns actors without memory state ! half of J.-P. Banatre multi-functions paradigm hiding internal channels

Join-Patterns collectors are frequent programming scheme example of a compute server

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

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

Combien d’objets dans une image? Jean-Jacques Lévy INRIA

Labeling 16 objects in this picture

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. second pass - generate equivalences between ids due to new adjacent relations met during scan of pixels, taking care of border (generating new equivalences) third pass - compute the number of equivalence classes and give result in parallel think of the distributed setting with several machines on the net