cooperative task management without manual stack management or presented by tina swenson cs533 -...

15
Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the Opposite of Threaded Programming Published by USENIX 2002 Annual Technical Conference

Upload: may-anthony

Post on 18-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack

ManagementOR

Presented by Tina Swenson CS533 - February 12, 2007

Event-driven Programming is Not the Opposite of Threaded Programming

Published by USENIX2002 Annual Technical Conference

Page 2: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

The Authors

Atul Adya PhD MIT. Boston, MA

Thor – distributed, object-oriented database

Microsoft Research. Redmond, WA Farsite – serverless, distributed file system http://research.microsoft.com/Farsite/

et al. (Howell, Theimer, Bolosky, Douceur)

Page 3: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Paper’s Goal

Clarify concepts associated with the event-driven and multi-threaded programming models. The models’ names tend to merge several

concepts and this causes confusion.Present a hybrid approach to allow the two

types of stack management to co-exist in the same software.

Page 4: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Events vs. Threads The Source of Confusion

Task Management Serial Preemptive

Stack Management Manual Automatic

Page 5: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Events vs. Threads The Source of Confusion

Task Management Serial Preemptive Cooperative

Stack Management Manual Automatic Hybrid

One can choose cooperative task management while preserving the

automatic stack management.

Page 6: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Stack Management

Manual (big pain) Event handler registers continuation with EH

scheduler. The continuation creates another EH that knows what to do with original’s info.

Programmer must figure this all out. Better not have bugs.

As the code evolves, managing the stack becomes more unwieldy.

Benefit: Yields are visible in the code.

Page 7: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Stack Management

Automatic (less pain) Compiler manages stack. Danger: Hidden concurrency.

Solution = Check for declared assumptions.

Page 8: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Stack Management - Hybrid

The two flavors of stack management both have passionate advocates.

Both flavors can work together via a Hybrid approach. Adapters are used to bridge the two styles.

Page 9: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Adapter Functions

Main Thread:VerifyCertCFA

Page 10: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Adapter Functions

VerifyFiber was created by VerifyCertCFA in the MainFiber

Page 11: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Adapter Functions

Page 12: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

Adapter Functions

Verify Thread: FiberStart

Main Thread:VerifyCertCFA

VerifyCertCFA2

Page 13: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

In Practice

Farsite Started out as traditional event-driven. Code grew, manual-stack-management

became costly. Mechanized the wrapping IO functions.

Page 14: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

What the Authors Think

Task management and stack management are orthogonal concepts.

As code evolves: Event-based programs have the code

restructuring burdon of stack ripping. Both styles must reconfirm invariant logic

because assumptions change, etc.Hybrid-stack-management allows use of

both styles of stack management.

Page 15: Cooperative Task Management without Manual Stack Management OR Presented by Tina Swenson CS533 - February 12, 2007 Event-driven Programming is Not the

Cooperative Task Management without Manual Stack Management

What I Think