TAME Event Based Concurrency System Nabil S. Al Ramli.

Slides:



Advertisements
Similar presentations
Programming Languages and Paradigms
Advertisements

CSI 3120, Implementing subprograms, page 1 Implementing subprograms The environment in block-structured languages The structure of the activation stack.
CS 443 Advanced OS Fabián E. Bustamante, Spring 2005 Cooperative Task Management without Manual Stack Management or Event-driven programming is not the.
Multiprocessors and Multithreading – classroom slides.
The Interface Definition Language for Fail-Safe C Kohei Suenaga, Yutaka Oiwa, Eijiro Sumii, Akinori Yonezawa University of Tokyko.
Apr. 12, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 6: Branching and Procedures in MIPS* Jeremy R. Johnson Wed. Apr. 12, 2000.
The Kernel Abstraction. Challenge: Protection How do we execute code with restricted privileges? – Either because the code is buggy or if it might be.
Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna.
Remote Procedure Call in SR Programming Language By Tze-Kin Tsang 3/20/2000.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Run-Time Storage Organization
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.
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.
Processes CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Scheduler Activations Jeff Chase. Threads in a Process Threads are useful at user-level – Parallelism, hide I/O latency, interactivity Option A (early.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
CS510 Concurrent Systems Introduction to Concurrency.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
VB.Net - Exceptions Copyright © Martin Schray
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Race Conditions Defined 1. Every data structure defines invariant conditions. defines the space of possible legal states of the structure defines what.
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Activation Records (in Tiger) CS 471 October 24, 2007.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
5204 – Operating Systems Threads vs. Events. 2 CS 5204 – Operating Systems Forms of task management serial preemptivecooperative (yield) (interrupt)
Operating Systems Process Creation
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1 9/6/05CS360 Windows Programming CS360 Windows Programming.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
12/22/ Thread Model for Realizing Concurrency B. Ramamurthy.
1 Condition Variables CS 241 Prof. Brighten Godfrey March 16, 2012 University of Illinois.
CS510 Concurrent Systems Jonathan Walpole. RCU Usage in Linux.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
1 OS Review Processes and Threads Chi Zhang
Threads A thread is an alternative model of program execution
C Programming Chapters 11, . . .
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
CS510 Concurrent Systems Jonathan Walpole. Introduction to Concurrency.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
7/9/ Realizing Concurrency using Posix Threads (pthreads) B. Ramamurthy.
Concepts of Multithreading CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
Maxwell Krohn, Eddie Kohler, and M. Frans Kaashoek
Module 12: I/O Systems I/O hardware Application I/O Interface
Process concept.
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Module 9: Memory and Resource Management
Protection of System Resources
CS510 Operating System Foundations
CS510 Operating System Foundations
Capriccio – A Thread Model
I/O Systems I/O Hardware Application I/O Interface
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Dynamic Memory.
CSE 153 Design of Operating Systems Winter 19
TAME – Event Style Programming with Threads
Chapter 3: Process Management
Module 12: I/O Systems I/O hardwared Application I/O Interface
Threads CSE 2431: Introduction to Operating Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

TAME Event Based Concurrency System Nabil S. Al Ramli

TAME CS 5204 – Fall, 2009 What is TAME? Event based concurrency system  C++ libraries and source-to-source translation  For network applications  No “stack-ripping”  Type safe (templates)  Performance of events  Programmabiliy of threads

TAME CS 5204 – Fall, 2009 Events Vs. Threads MeasureThreadsEvents Support for extremely high concurrencyX√ PortabilityX√ Better performance, Less use of memoryX√ No stack-rippingX√

TAME CS 5204 – Fall, 2009 Events Vs. Threads blocking operation Function B Function A Threads non-blocking operation Function B Function A Events

TAME CS 5204 – Fall, 2009 Semantics Example // Threads void wait_then_print_threads() { sleep(10); // blocks this function and all callers printf("Done!"); } // Tame primitives tamed wait_then_print_tame() { tvars { rendezvous<> r; } event<> e = mkevent(r); // allocate event on r timer(10, e); // cause e to be triggered after 10 sec twait(r); // block until an event on r is triggered // only blocks this function, not its callers! printf("Done!"); } // Tame syntactic sugar tamed wait_then_print_simple_tame() { twait { timer(10, mkevent()); } printf("Done!"); }

TAME CS 5204 – Fall, 2009 TAME Primitives

TAME CS 5204 – Fall, 2009 Wait Points blocks calling function until 1+ events triggered function returns to its caller but the function does not complete execution point and local vars are preserved When an event occurs, the function “unblocks” and resumes processing at the wait point twait { statements; } { rendezvous<> __r; statements; // where mkevent calls create events on __r while (not all __r events have completed) twait(__r); }

TAME CS 5204 – Fall, 2009 Safe Local Variables Their values are preserved across wait points Preserved in a heap-allocated closure tvars {} Unsafe local variables have indeterminate values after a wait point Compile warnings when a local variable should be made safe

TAME CS 5204 – Fall, 2009 Closures Internally, Tame writes a new C++ structure for each tamed function Each tamed function has one closure, contains: – Next statement to execute – Function parameters – tvars variables – rendezvouz

TAME CS 5204 – Fall, 2009 Closures Translation tamed A::f(int x) { tvars { rendezvous<> r; } a(mkevent(r)); twait(r); b(); } void A::f(int __tame_x, A_f_closure *__cls) { if (__cls == 0) __cls = new A__f__closure(this, &A::fn, __tame_x); assert(this == __cls->this_A); int &x = __cls->x; rendezvous<> &r = __cls->r; switch (__cls->entry_point) { case 0: // original entry goto __A__f__entry__0; case 1: // reentry after first twait goto __A__f__entry__1; } __A__f__entry__0: a(_mkevent(__cls,r)); if (!r.has_queued_trigger()) { __cls->entry_point = 1; r.set_reenter_closure(__cls); return; } __A__f__entry__1: b(); }

TAME CS 5204 – Fall, 2009 A “Tame” solution f (non-blocking, asynchronous operation, e.g., I/O) c handler (signal + data) e(a): r: e.trigger(data) a; slot e rendezvous event a <- data (11) (9) (8) (7) (6) (5) (4) (2) (1) (10) (3) wait point

TAME CS 5204 – Fall, 2009 Composeability

TAME CS 5204 – Fall, 2009 Memory Management tamed broken(dnsname nm) { tvars { rendezvous<> r; ipaddr res; } gethost_ev(nm, mkevent(r, res)); // Whoops: forgot to twait(r)! } Solution is reference-counting Keep track of events and closures C++ “smart pointer” classes Two types of reference counts Strong references are conventional reference counts Weak references Allow access to the object only if not deallocated

TAME CS 5204 – Fall, 2009 Related Work SystemSimilaritiesDifferences Capriccio Uses events Automatic stack management Thread interface Adya et al. Uses events Some manual stack management SEDA Can be used together with TAME Uses threads and events