1 / 16

Cooperative Task Management without Manual Stack Management

This presentation discusses a cooperative task management approach that eliminates the need for manual stack management in event-driven programming. It introduces the definitions of task and stack management, outlines both automatic and manual stack management methods, and proposes a hybrid approach that combines the benefits of both. The presentation also explores related work and concludes with the advantages of the proposed approach.

sbowler
Download Presentation

Cooperative Task Management without Manual Stack Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. Outline • Introduction • Definitions • Stack Management • Hybrid Approach • Related Work • Conclusion

  3. 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

  4. 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

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

  6. Task Management Vs Stack Management

  7. 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 Management

  8. 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

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

  10. 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

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

  12. 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/Oand yield back to main fiber

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

  14. 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

  15. 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

  16. Thank you Questions??? Suggestions!!!

More Related