Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cooperative Task Management without Manual Stack Management or, Event-driven programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,

Similar presentations


Presentation on theme: "Cooperative Task Management without Manual Stack Management or, Event-driven programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,"— Presentation transcript:

1 Cooperative Task Management without Manual Stack Management or, Event-driven programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell, Marvin Theimer, William J. Bolosky, John R. Douceur Microsoft Research Presented by: Yujing He ( hey@cecs.pdx.edu ) CS 533-April 24 th, 2006

2 Event-Driven Programming

3 Threads & Fibers ☆ Threads ♦ lightest unit of kernel scheduling; ♦ preemptively scheduled; ♦ a stack and a copy of the registers; ☆ Fibers ♦ implemented in user space; ♦ cooperatively scheduled; ♦ efficient context switching;

4 Definitions ☆ Task Management preemptive, serial, cooperative ☆ Stack Management manual (event-driven), automatic (procedure-oriented) ☆ I/O Management synchronous, asynchronous ☆ Conflict Management pessimistic, optimistic ☆ Data Partitioning might reduce resource conflict

5 Concepts Relations

6 Other Concepts ☆ Continuation ♦ bundles state indicating where the event left off working on the task; ♦ plus a reference to an event-handler that encodes what should be done when the requested I/O has completed. ☆ Stack Ripping ♦ functions along the path ripped into more parts because of I/O calls; ♦ primary drawback to manual stack management in event- driven programming

7 Hybrid Approach ☆ Based on Windows Operating System ♦ Threads are scheduled preemptively; Fibers are scheduled cooperatively; ♦ Scheduling multiple fibers on a thread; Only one fiber is active at any time. ♦ Using adapter to connect between threaded programming and event programming; ☆ Examples ♦ Manual calling Automatic—Event calling Thread; ♦ Automatic calling Manual—Thread calling Event;

8 Hybrid Approach (Continued) ☆ Function Names GetCertData—Looks up certificate in the memory catch or disk/network and returns the answer; (manual) GetCAInfo—looks in a hash-table for a specified certificate authority (CA) id and returns a pointer to the corresponding object; (manual) VerifyCert—calls “GetCAInfo” to obtain a CA with which to verify a certificate; (automatic) FetchCert—fetches a security certificate using “GetCertData” and then calls “VerifyCert” in order to confirm its validity; (manual) FiberContinue—a continuation for event handlers; (manual) CFA—Continuation-to-Fiber Adapter (in Manual calling Automatic) FCA—Fiber-to-Continuation Adapter (in Automatic calling Manual)

9 Manual Calling Automatic FetchCert—fetches a security certificate using “GetCertData” and then calls “VerifyCert” in order to confirm its validity;

10

11 Automatic Calling Manual FetchCert—fetches a security certificate using “GetCertData” and then calls “VerifyCert” in order to confirm its validity;

12

13 Automatic Calling Manual Short Circuit Branch No I/O Block

14 Implementation ☆ Farsite: a distributed, secure, serverless file system running over desktops; (Windows NT) ☆ UCoM: a wireless phone application for hand-held devices such as PDAs. (Windows CE)

15 Conclusion ☆ Task management is best done cooperatively, and stack management is best done automatically ; ☆ A hybrid model adapts between code with automatic and with manual stack management, enabling cooperation among disparate programmers and software evolution of disparate code bases; ☆ The hybrid approach is in fact complicated, but it is also necessary sometimes.

16 References [1] Stephen Ferg; Event-Driven Programming: Introduction, Tutorial, history; 2006. http://eventdrivenpgm.sourceforge.net/ [2] Atul Adya, Jon Howell, Marvin Theimer, et al. Cooperative Task Management without Manual Stack Management or, Event-driven Programming is Not the Opposite of Threaded Programming. Proceedings of the USENIX 2002 Annual Conference, pages 289-302, June 2002. [3] Wikipedia, the free encyclopedia; http://en.wikipedia.org/wiki/Main_Page [4] Satish Gottimukkala; Presentation of Cooperative Task Management without Manual Stack Management or, Event-driven Programming is Not the Opposite of Threaded Programming; http://web.cecs.pdx.edu/~walpole/class/cs533/spring2005/slides/71.ppt

17 17 Thank You !


Download ppt "Cooperative Task Management without Manual Stack Management or, Event-driven programming is Not the Opposite of Threaded Programming Atul Adya, Jon Howell,"

Similar presentations


Ads by Google