Cooperative Task Management without Manual Stack Management Or, Event-driven Programming is not the Opposite of Thread Programming Atul Adya, John Howell,

Slides:



Advertisements
Similar presentations
Operating Systems ECE344 Midterm review Ding Yuan
Advertisements

CS 443 Advanced OS Fabián E. Bustamante, Spring 2005 Cooperative Task Management without Manual Stack Management or Event-driven programming is not the.
Computer Systems/Operating Systems - Class 8
CS533 Concepts of Operating Systems Class 5 Integrated Task and Stack Management.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer.
Fast Servers Robert Grimm New York University Or: Religious Wars, part I, Events vs. Threads.
Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna.
490dp Synchronous vs. Asynchronous Invocation Robert Grimm.
Fast Servers Robert Grimm New York University Or: Religious Wars, part I, Events vs. Threads.
Avishai Wool lecture Priority Scheduling Idea: Jobs are assigned priorities. Always, the job with the highest priority runs. Note: All scheduling.
Cooperative Task Management without Manual Stack Management or, Event-driven Programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
UCoM Software Architecture Universal Communicator Research UCoM Programming Model The Problem  Multi-threaded code is difficult to write.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
3.5 Interprocess Communication
Why Events Are a Bad Idea (for high-concurrency servers) Author: Rob von Behren, Jeremy Condit and Eric Brewer Presenter: Wenhao Xu Other References: [1]
“Why Events are a Bad Idea (For high-concurrency servers)” Paper by Rob von Behren, Jeremy Condit and Eric Brewer, May 2003 Presentation by Loren Davis,
CS533 Concepts of Operating Systems Class 7 Integrated Task and Stack Management.
Concurrency, Threads, and Events Robbert van Renesse.
CS533 Concepts of Operating Systems Class 2 The Duality of Threads and Events.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
CS533 Concepts of Operating Systems Class 9 User-Level Remote Procedure Call.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
Why Threads Are A Bad Idea (for most purposes) John Ousterhout Sun Microsystems Laboratories
Exceptions and Mistakes CSE788 John Eisenlohr. Big Question How can we improve the quality of concurrent software?
What is Concurrent Programming? Maram Bani Younes.
CS 153 Design of Operating Systems Spring 2015
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Concurrent Programming. Concurrency  Concurrency means for a program to have multiple paths of execution running at (almost) the same time. Examples:
Cooperative Task Management without Manual Stack Management or, Event-driven programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Review The Joys and Pains of Threads and Multithreading –what is a thread –threads vs. processes –opportunities and risks.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the.
Presenting: Why Events Are A “Bad” Idea ( for high-concurrency servers) Paper by: Behren, Condit and Brewer, 2003 Presented by: Rania Elnaggar 1/30/2008.
CSE 60641: Operating Systems Next topic: CPU (Process/threads/scheduling, synchronization and deadlocks) –Why threads are a bad idea (for most purposes).
1 Cooperative Task Management without Manual Stack Management or Event-driven Programming is not the Opposite of Threaded Programming Atul Adya, Jon Howell,
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Threads versus Events CSE451 Andrew Whitaker. This Class Threads vs. events is an ongoing debate  So, neat-and-tidy answers aren’t necessarily available.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
1 Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer (May 2003) CS533 – Spring 2006 – DONG, QIN.
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.
Atul Adya, Jon Howell, Marvin Theimer, William J. Bolosky, John R. Douceur Microsoft Research Presented by Poonam Singh CS 533 – Winter 2010.
CS533 Concepts of Operating Systems Jonathan Walpole.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Cooperative Task Management without Manual Stack management Hanyun Tao EECS 582 – W161.
Assembly Language Co-Routines
Chapter 4 – Thread Concepts
Processes and threads.
Why Events Are A Bad Idea (for high-concurrency servers)
Chapter 4 – Thread Concepts
Computer Engg, IIT(BHU)
Cooperative Task Management without Manual Stack Management or, Event-driven Programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,
What is Concurrent Programming?
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
CS703 – Advanced Operating Systems
CS 5204 Operating Systems Lecture 5
Ch 3.
Presentation transcript:

Cooperative Task Management without Manual Stack Management Or, Event-driven Programming is not the Opposite of Thread Programming Atul Adya, John Howell, Marvin Theimer, William J. Bolosky, John R. Douceur Microsoft Research  Presented by : Satish Gottimukkala

Outline  Introduction  Definitions  Stack Management  Hybrid Approach  Related Work  Conclusion

Introduction  Two major Concurrency models :  Multithreaded programming   Difficult to handle race conditions, deadlocks (Ousterhout 96)  Event-driven programming   Task explicitly yields control by returning to the scheduler   Task runs serially between yield points Vs

Definitions  Task management  Serial, preemptive, cooperative  Stack management  Automatic, manual  I/O management  Synchronous, asynchronous  Conflict management  With concurrency, need locks, semaphores, monitors  Data partitioning  Shared, task-specific

Cooperative Task Management Cooperative Task Management   Concurrency considered only at I/O yield points  Task must re-validate state after resuming

Task Management Vs Stack Management

Stack Management   Automatic Stack Management (ASM)  Each complete task a procedure  Task state stored on stack  Allows natural code structure   Manual Stack Management (MSM)  Each step an event handler  Event handlers invoked by scheduler  Control flow expressed through continuations  Necessary state + next event handler   Forces programmer to abandon basic programming language features   Mistakenly conflated with cooperative task mgmt

Stack Ripping  Function Scoping  Two or more functions represent a single conceptual function  Automatic variables  From stack to heap  Control structures  Loops can get nasty  Debugging stack  Need to recover call stack

Hidden assumptions  Hidden assumptions become explicit  Concurrency  Static check: yielding, atomic  Dynamic check: startAtomic(), endAtomic(), yield()

Hybrid approach  Separate out concerns of task and stack mgmt  Cooperative task management  Avoid synchronization issues  Allow interactions between manual and automatic stack mgmt code styles

Hybrid approach  Based on Windows fibers  User-level, cooperative threads  Main fiber  Event scheduler  Event handlers  Auxiliary fibers  Blocking code

Manual calling automatic  Set up continuation  Copy result  Invoke original continuation  Set up fiber  Switch to fiber  Issue: I/O  Are we really blocking?  No, we use asynchronous I/O and yield back to main fiber

Automatic calling manual  Set up special continuation  Test whether we actually switched fibers  If not, simply return  Invoke event handler  Return to main fiber  When done with task  Resume fiber

Related work   “Event-driven” to reduce concurrency bugs [Oust96]   Cooperative task management conflated with MSM   “Event-driven” model for performance   Popular for web servers   Inter-stage: each task reads as in MSM   Equivalence of “procedure-oriented” and “message-oriented” systems [Lauer+Needham]   Cooperative task management not considered

Conclusion  Clears debate between event driven versus threaded programming models by separating concerns of task and stack management  Manual stack management leads to poor code structure  Code evolution exacerbates problem  Automatic stack management leads to natural code structure  Adopts hybrid approach which shows that Manual and Automatic Stack Management code can co-exist  Enables cooperation among disparate programmers and software evolution of disparate code bases

Thank you Thank you Questions??? Questions??? Suggestions!!! Suggestions!!!