Continuations And Java Regis -

Slides:



Advertisements
Similar presentations
Improving Rotor for Dynamically Typed Languages Fabio Mascarenhas and Roberto Ierusalimschy.
Advertisements

Chapter 4 Threads Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Threads, SMP, and Microkernels
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Day 10 Threads. Threads and Processes  Process is seen as two entities Unit of resource allocation (process or task) Unit of dispatch or scheduling (thread.
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
Threads CSCI 444/544 Operating Systems Fall 2008.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Threads. Processes and Threads  Two characteristics of “processes” as considered so far: Unit of resource allocation Unit of dispatch  Characteristics.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Thread definitions and relationship to process Multithreading.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Threads Chapter 4. Modern Process & Thread –Process is an infrastructure in which execution takes place  (address space + resources) –Thread is a program.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Cooperative Task Management without Manual Stack Management Or, Event-driven Programming is not the Opposite of Thread Programming Atul Adya, John Howell,
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
Threads, Thread management & Resource Management.
A Revolutionary Programming Pattern that Will Clean up your Code : Coroutines in C++ David Sackstein ACCU 2015.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Thread Scheduling.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Rapid Development of High Performance Servers Khaled ElMeleegy Alan Cox Willy Zwaenepoel.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Servlet Life cycle Bill Chu. © Bei-Tseng Chu Aug 2000 Java JAVA as an object oriented language Learned from experiences of other OO languages More completely.
Threads G.Anuradha (Reference : William Stallings)
Getting started with Programming using IDE. JAVA JAVA IS A PROGRAMMING LANGUAGE AND A PLATFORM. IT CAN BE USED TO DELIVER AND RUN HIGHLY INTERACTIVE DYNAMIC.
Using a simple Rendez-Vous mechanism in Java
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Department of Computer Science and Software Engineering
LAIO: Lazy Asynchronous I/O For Event Driven Servers Khaled Elmeleegy Alan L. Cox.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
Assembly Language Co-Routines
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
Multithreading vs. Event Driven in Code Development of High Performance Servers.
RealTimeSystems Lab Jong-Koo, Lim
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Cgi programs rise from ash then burn again upon each request.
Chapter 4 – Thread Concepts
Processes and threads.
Fibers – blocking is cheap in a Parallel Universe jPrime Stefan Minev
Processes and Threads Processes and their scheduling
Scheduler activations
Day 12 Threads.
Chapter 4 – Thread Concepts
Event driven architectures
Chapter 4 Threads.
RTS: Kernel Design 11/30/2018.
RTS: Kernel Design 1/2/2019.
Threads and Concurrency
Threads Chapter 4.
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Still Chapter 2 (Based on Silberchatz’s text and Nachos Roadmap.)
Outline Operating System Organization Operating System Examples
CS703 – Advanced Operating Systems
Presentation transcript:

Continuations And Java Regis -

Agenda  What is Continuations  Why Continuations  Implementations in Java Jetty Continuations API JavaFlow Kilim JVM Continuations

What is Continuations  Definition from wikipedia: Give a programming language the ability to save the execution state at any point and return to that point at alter point in the program  Basic characteristics: Local data (variables,...) is restored on successive calls. Execution of a coroutine is only suspended when it yields, to be resumed when the coroutine is called again.

started! 0 returned a continuation 1 returned another continuation

Why Continuations  Thread is heavy and expensive  Writing asynchronous code in the synchronous style  Supporting functional languages  SAX parser  Web servers linearize complex interactions “ back button ” problem

Implemented As Library  Jetty 6.0 For resolving AJAX polling problem Event based + retry

Implemented As Library (Cont.)  Instrumentation byte code Save current stack frames  Store local variables  Save PC Restore stack trace  goto + switch table

From A Thread of One ’ s Own

Implemented As Library (Cont.)  Implementations JavaFlow  Asymmetric coroutines: each yield needs to specify which coroutine should come next. Kilim  Symmetric coroutines: a scheduler decides which coroutine should run next after a yield.  Framework has a thread pool and decide which coroutine run on which thread. RIFE/Continuations (WebWork)

Implemented In JVM  Support save and restore stack frames by JVM  No instrumentation needed  APIs is similar with library provided

References   tml tml      html  A Thread of One ’ s Own  Lazy Continuations for Java Virtual Machines

Question?