490dp Synchronous vs. Asynchronous Invocation Robert Grimm.

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

Multiprocessors— Large vs. Small Scale Multiprocessors— Large vs. Small Scale.
WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Computer Systems/Operating Systems - Class 8
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 5 Processes and Threads Copyright © 2008.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University of.
CS 584. A Parallel Programming Model We need abstractions to make it simple. The programming model needs to fit our parallel machine model. Abstractions.
1: Operating Systems Overview
G Robert Grimm New York University Extensibility: SPIN and exokernels.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
3.5 Interprocess Communication
Concurrency, Threads, and Events Robbert van Renesse.
CS533 Concepts of Operating Systems Class 2 The Duality of Threads and Events.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
CSE 490dp Resource Control Robert Grimm. Problems How to access resources? –Basic usage tracking How to measure resource consumption? –Accounting How.
1 MPI-2 and Threads. 2 What are Threads? l Executing program (process) is defined by »Address space »Program Counter l Threads are multiple program counters.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Cooperative Task Management without Manual Stack Management Or, Event-driven Programming is not the Opposite of Thread Programming Atul Adya, John Howell,
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
Operating System 4 THREADS, SMP AND MICROKERNELS
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Programming Models & Runtime Systems Breakout Report MICS PI Meeting, June 27, 2002.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
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,
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Processes Introduction to Operating Systems: Module 3.
CS333 Intro to Operating Systems Jonathan Walpole.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
1: Operating Systems Overview 1 Jerry Breecher Fall, 2004 CLARK UNIVERSITY CS215 OPERATING SYSTEMS OVERVIEW.
Operating System 4 THREADS, SMP AND MICROKERNELS.
CSC Multiprocessor Programming, Spring, 2012 Chapter 11 – Performance and Scalability Dr. Dale E. Parson, week 12.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Chapter 4 – Thread Concepts
Advanced Operating Systems CIS 720
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Alternative system models
Chapter 4 – Thread Concepts
CS399 New Beginnings Jonathan Walpole.
Presentation by Omar Abu-Azzah
Chapter 4 Multithreading programming
Chapter 4: Threads.
Threads, SMP, and Microkernels
Modified by H. Schulzrinne 02/15/10 Chapter 4: Threads.
Lecture 4- Threads, SMP, and Microkernels
Operating System 4 THREADS, SMP AND MICROKERNELS
Chapter 4: Threads.
Operating System Overview
CSC Multiprocessor Programming, Spring, 2011
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

490dp Synchronous vs. Asynchronous Invocation Robert Grimm

Definitions by Merriam-Webster Synchronism –chronological arrangement of historical events and personages so as to indicate coincidence or coexistence; also : a table showing such concurrences Asynchrony –the quality or state of being asynchronous : absence or lack of concurrence in time Invocation –the act or process of petitioning for help or support

What’s It All About Control flow –Model –Usage –Implementation

Synchronous Invocation Model –Structured programming –One process waits for another to complete a sub-task Usage –Procedure / method call Implementation –Call instruction, stack

Asynchronous Invocation Model –Sending a message to another process Usage –Raising an event to be processed by an event handler Implementation –Event loop Queue of pending events

Adding Concurrency Process several tasks at the same time Synchronous invocation –Threads Stack, registers Locks, condition variables Asynchronous invocation –“Just” drop events for different tasks into event loop

Advantages of Threads Sequential programming style –Familiar to programmers Mature programming tools –Multi-threaded debuggers Scalability with number of processors –One thread per processor

Problems with Threads Elimination of race conditions –Michael Burrows –Eraser [Savage et al., TOCS, (15)4: ] Performance tuning –Lock contention

Advantages of Events “Natural” fit to some problem domains –User interfaces Robustness under pressure –Better scalability with load

Problems with Events Debugging –No standard tools Performance –Events do not scale over processors –Event processing may still block Page faults, GC

The Best of Both Worlds Welsh et al. –Spectrum from threads to pure events Components –Queue of pending events –Pool of one or more threads –Taken together Task handler or animator

Design Patterns Wrap Pipeline Combine Replicate

Wrap Wrap a functional unit with an animator Simplest case –One thread in pool –No concurrency issues More complex –Multiple threads in pool –Higher throughput

Pipeline Split functional unit into two or more –Units are cascaded –Each unit has its own animator Limit number of threads for low-concurrency operations –I/O operations Increase locality –Process less code –Touch less data

Combine Merge functional units and their animators Inverse of pipeline Limit overall number of threads

Replicate Copy functional unit and animator Improve parallelism –Increased throughput Improve reliability –Added resilience

Summary of Patterns Wrap to introduce load conditioning Pipeline to avoid wasting threads Pipeline for cache performance Replicate for fault tolerance Replicate to scale concurrency Combine to limit the number of threads

Coding for Spectrum Stateless functional units –No concurrency control necessary Pass-by-value to avoid sharing –Consistency –Access –Reclamation –Alternative: Release references Avoid fate sharing –Improve fault tolerance Admission control at front –Avoid internal congestions

Coding for Spectrum Stateless functional units –No state shared between units Pass-by-value –Crucial! Avoid fate sharing –Part of replicate pattern Admission control at front –Good practice

Break

The Case for Events Scale better than just threads Make execution state explicit –Needed for check-pointing and migration Provide control over scheduling –Useful for real-time applications TinyOSPalm OSChinook Windows Mac OS Ninja

The Case for a Hybrid Scheme Enables better performance conditioning –As discussed by Welsh et al. Provides isolation between applications –Separate applications from each other Activation, termination Check-pointing, migration –Separate core system from applications

Practical Considerations Functional units in Ninja –Explicitly include task handlers –Call specific event handlers Important goal for one.world –Flexibility, ability to experiment Composition of functional units Break-down amongst animators

Functionality Events and event handlers –Basic abstractions Components –Building blocks for functional units –Export and import event handlers Statically declared Dynamically linked –Instantiated in environments Containers for stored tuples, components, other environments

Implementation of Event Passing Simple implementation Animator –Queue and pool of one or more threads –Mechanism –Represented by concurrency domain One per environment

Simple Implementation Method invocation –Default for event passing within environment Advantages –Simple, cheap Problems –Breaks for some interactions Infinite recursion –Sender needs to wait for long time Thread is busy executing event handler

Animators Default for event passing across environments –Forcibly linked through animator Advantages –Handles all interactions –Sender regains control immediately Drawback –More expensive

Concurrency Remember: Pool of one or more threads Declare components concurrency safe –Protect access to internal state Least common denominator for environment –No more than one thread if any component is not concurrency safe

Putting It All Together Environment determines –Concurrency domain and animator Concurrency safe flag determines –Number of threads Forcibly linked flag determines –Simple implementation or animator