Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.

Slides:



Advertisements
Similar presentations
SCOOP: Simple Concurrent Object-Oriented Programming Extend the pure, strongly typed, object-oriented language Eiffel with a general and powerful concurrency.
Advertisements

Operating Systems Lecture 7.
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 10: Advanced Object-Oriented Mechanisms (based on.
Ch4. Processes Process Concept (1) new waiting terminate readyrunning admitted interrupt exit scheduler dispatch I/O or event completion.
2 nd Microsoft Rotor Workshop, Pisa, April 23-25, SCOOPLI for.NET: a library for concurrent object-oriented programming Volkan Arslan, Piotr Nienaltowski.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Denis Caromel1 Joint work with Ludovic Henrio – Eric Madelaine et. OASIS members OASIS Team INRIA -- CNRS - I3S – Univ. of Nice Sophia-Antipolis, IUF.
Chair of Software Engineering PPoPP 2003, , San Diego SCOOP it up! Piotr Nienaltowski Chair of Software Engineering, ETH Zurich, Switzerland.
Task Scheduling and Distribution System Saeed Mahameed, Hani Ayoub Electrical Engineering Department, Technion – Israel Institute of Technology
Introduction in algorithms and applications Introduction in algorithms and applications Parallel machines and architectures Parallel machines and architectures.
Chair of Software Engineering Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
User Level Interprocess Communication for Shared Memory Multiprocessor by Bershad, B.N. Anderson, A.E., Lazowska, E.D., and Levy, H.M.
Concurrency CS 510: Programming Languages David Walker.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
Learning Objectives Understanding the difference between processes and threads. Understanding process migration and load distribution. Understanding Process.
3.5 Interprocess Communication
USER LEVEL INTERPROCESS COMMUNICATION FOR SHARED MEMORY MULTIPROCESSORS Presented by Elakkiya Pandian CS 533 OPERATING SYSTEMS – SPRING 2011 Brian N. Bershad.
Computer Science Lecture 2, page 1 CS677: Distributed OS Last Class: Introduction Distributed Systems – A collection of independent computers that appears.
Asynchronous Message Passing EE 524/CS 561 Wanliang Ma 03/08/2000.
Foundations of Agents. Agent World Agent Definitions Agent’s Properties Classification of Agents Agent Autonomy Concurrent Programming.
1/26/2007CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Concurrency - 1 Tasking Concurrent Programming Declaration, creation, activation, termination Synchronization and communication Time and delays conditional.
Fundamentals of Python: From First Programs Through Data Structures
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
Comparative Programming Languages hussein suleman uct csc304s 2003.
Chapter 6 Operating System Support. This chapter describes how middleware is supported by the operating system facilities at the nodes of a distributed.
Oct Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt Istvàn June 2013 –
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Programming Languages and the Software Production Process Informal Cardelli’s metrics of programming languages fitness to real-time applications: Economy.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
The Complexity of Distributed Algorithms. Common measures Space complexity How much space is needed per process to run an algorithm? (measured in terms.
Multithreading in Java Sameer Singh Chauhan Lecturer, I. T. Dept., SVIT, Vasad.
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Synchronization Methods in Message Passing Model.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-4 Process Communication Department of Computer Science and Software.
PREPARED BY : MAZHAR JAVED AWAN BSCS-III Process Communication & Threads 4 December 2015.
Multithreading Chapter Introduction Consider ability of _____________ to multitask –Breathing, heartbeat, chew gum, walk … In many situations we.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Presentation 3: Designing Distributed Objects. Ingeniørhøjskolen i Århus Slide 2 af 14 Outline Assumed students are knowledgeable about OOP principles.
CS- 492 : Distributed system & Parallel Processing Lecture 7: Sun: 15/5/1435 Foundations of designing parallel algorithms and shared memory models Lecturer/
VDM++ Tutorial Concurrency. Overview Introduction Concurrency primitives in VDM++ Example: POP3 Server Concurrency and VDMTools ®
Lecture 4 Introduction to Promela. Promela and Spin Promela - process meta language G. Holzmann, Bell Labs (Lucent) C-like language + concurrency dyamic.
Synchronization These notes introduce:
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Concurrent Object-Oriented Programming Languages Chris Tomlinson Mark Scheevel.
Agenda  Quick Review  Finish Introduction  Java Threads.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Concurrency/synchronization using UML state models November 27th, 2007 Michigan State University.
Last Class: Introduction
Chapter 3: Process Concept
“Language Mechanism for Synchronization”
Chapter 3: Process Concept
Distributed Systems - Comp 655
DISTRIBUTED COMPUTING
Operating System Concepts
Background and Motivation
Subject : T0152 – Programming Language Concept
Presentation transcript:

Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan

Chair of Software Engineering 2 Lecture 2: Task Creation and Communication Primitives

Chair of Software Engineering 3 What is a Task?  It is an entity with resources:  memory (so-called address space), and  processing time.  A task may have a priority.  A task may execute an activity.  A task may be idle (waiting).  A task may terminate.  The degree of parallelism of a system at a given time is the number of active tasks executing on that system.

Chair of Software Engineering 4 Special case: Synchronous Tasks  Synchronous tasks:  The same program is executed on all CPUs  Progression is in lock-step.  Tasks are always active.  Typical of SIMD for Data-Parallelism ( ) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y) x := 1; y:= 3; if (x = y)

Chair of Software Engineering 5 We shall only consider the asynchronous task model!

Chair of Software Engineering 6 Actions, Objects and Tasks  Tasks execute actions on behalf of objects.  Assume a program counter  Define a partial function  is total on and can be:  surjective ( tasks for 1 object)  bijective (1 task for 1 object)  injective ( passive objects) task ActionsObjects not surjective: inter-object parallelism intra-object parallelism

Chair of Software Engineering 7 The Nature of and objects  An object can be passive:  either not supported by any task, or  supported by a task but no autonomous behavior.  Data structure or service repository.  It is re-active, acting only when called.  An object can be active:  Has a task of its own.  Method for the object’s body (live routine).  live terminates: task stops (passivation?).  Active, it may or may not provide services.  Many mixed approaches (CEiffel, ProActive,…).

Chair of Software Engineering 8 The nature of (Inter)actions  Message passing:  explicit send/receive primitives.  Remote routine invocation:  transparent remote invocation,  no receive statement necessary.  Synchronous communication:  the client is blocked until the supplier finishes.  Asynchronous communication:  a call never blocks the client.

Chair of Software Engineering 9 Relevant issues How to create tasks? How to make tasks active? How to coordinate tasks?

Chair of Software Engineering 10 Passive Objects without Task (1)  Essentially  Routine invocations execute in client’s task.

Chair of Software Engineering 11 Passive Objects without Task (1)  Allow intra-object concurrency.  Use synchronous interaction.  Clients can communicate through side-effects.  Concerns orthogonal to task creation.  Objects can be garbage-collected.  Exception: implicit mobility like in Oz.

Chair of Software Engineering 12 Passive objects with a Task  Essentially  One or many tasks.  Accessed through routine invocation.  Routines execute in the supplier’s task(s).  Can easily simulate active objects.  Examples: SCOOP, Actors…  Garbage collection is problematic (shared task).

Chair of Software Engineering 13 Active objects  Upon creation, a task is idle!  Creating an active object is:  create a passive object and a task,  “start” the object (autonomous routine).  in Java: t = new Thread(); t.start;  Starting is automated: live routine (POOL).  An active objects raises the degree of parallelism.  Use message passing or method invocation.

Chair of Software Engineering 14 Example live routine in POOL CLASS Queue … Method enq (item : T) BEGIN cell ! put (rear, item); rear := (rear+1) MOD size END enq METHOD deq (): T BEGIN RESULT cell ! get (front) ; % early return front := (front + 1) MOD size END deq BODY DO IF empty THEN ANSWER (enq) ELSIF full THEN ANSWER (deq) ELSE ANSWER ANY FI OD YDOB

Chair of Software Engineering 15 Other Possibility in CEiffel  Communication based on method invocation.  One can place autonomy annotations.  Annotated method step is repeated forever. class MOVING creation Init … feature {} … step is -->-- do position.set(…) end … end -- MOVING

Chair of Software Engineering 16 Coordination  Objects have a state.  The set of available routines may depend on the current state.  The Queue exhibits such a non-uniform service.  Activity-centered coordination:  clients coordinate to prevent indelicate actions.  Invocations are never delayed (synchrony).  Boundary coordination:  the supplier may delay the acceptance of a call.  Introduction of synchronization code.

Chair of Software Engineering 17 Issues in Communication  active objects have different address spaces!  Call-by-value or call-by-name?  Call-by-value: sending values away.  Call-by-name: sending references away.  For objects:  weak versus strong mobility,  mobility of active objects?  Issue with meta-classes (Smalltalk)  an object needs a copy of its code to execute.  replicating stateful classes is expensive.  keep (meta-)classes stateless (distr. Smalltalk).

Chair of Software Engineering 18 Efficiency (1)  Using synchronous interaction

Chair of Software Engineering 19 Efficiency (2)  Using asynchronous interaction

Chair of Software Engineering 20 Synchrony vs Asynchrony  Synchrony coded with asynchrony:  send and return message for every interaction.  Can be quite heavy!  Asynchrony coded with synchrony:  intermediate passive buffer between objects.  Synchrony tends to be too strong (inefficient).  Asynchrony can be cumbersome.  Allow the two of them?  Multicast and broadcast allow high fan-out (GARF).

Chair of Software Engineering 21 Early Return Optimization  Using synchronous interaction

Chair of Software Engineering 22 Other Improvements  Serve many invocations at a time  using synchronization primitives,  allow pure methods to execute freely, or  tag concurrent methods (CEiffel).  create one task for each invocation (Diadem).  Use a task pool to delegate calls (ACT++).  wait-by-necessity.

Chair of Software Engineering 23 Next time  SCOOP Primer  Coordinating objects, first act.