By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan-25-2012.

Slides:



Advertisements
Similar presentations
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Advertisements

Chess Review May 8, 2003 Berkeley, CA Compiler Support for Multithreaded Software Jeremy ConditRob von Behren Feng ZhouEric Brewer George Necula.
1 Capriccio: Scalable Threads for Internet Services Matthew Phillips.
Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University of.
Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, George Necula and Eric Brewer University of California at Berkeley.
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
Scheduler Activations Effective Kernel Support for the User-Level Management of Parallelism.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Why Events Are a Bad Idea (for high-concurrency servers) Author: Rob von Behren, Jeremy Condit and Eric Brewer Presenter: Wenhao Xu Other References: [1]
Threads CSCI 444/544 Operating Systems Fall 2008.
“Why Events are a Bad Idea (For high-concurrency servers)” Paper by Rob von Behren, Jeremy Condit and Eric Brewer, May 2003 Presentation by Loren Davis,
CS533 Concepts of Operating Systems Class 2 Thread vs Event-Based Programming.
Concurrency, Threads, and Events Robbert van Renesse.
CS533 Concepts of Operating Systems Class 2 The Duality of Threads and Events.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Thread definitions and relationship to process Multithreading.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer Computer Science Division, University of California.
Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer University of California at Berkeley
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer Presented by: Hisham Benotman CS533 - Concepts of.
Cooperative Task Management without Manual Stack Management Or, Event-driven Programming is not the Opposite of Thread Programming Atul Adya, John Howell,
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
CS 153 Design of Operating Systems Spring 2015
Threads, Thread management & Resource Management.
Dave Archer - CS533 - Spring On the Duality of Operating System Structures Hugh C. Lauer, Roger M. Needham.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Presented by Changdae Kim and Jaeung Han OFFENCE.
Lecture 2 Foundations and Definitions Processes/Threads.
Scheduler Activations: Effective Kernel Support for the User- Level Management of Parallelism. Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Concurrent Programming. Concurrency  Concurrency means for a program to have multiple paths of execution running at (almost) the same time. Examples:
CS533 - Concepts of Operating Systems 1 On The Duality of Operating System Structures Hugh Lauer, Xerox Roger Needham, Cambridge University 1979 Presented.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
CS333 Intro to Operating Systems Jonathan Walpole.
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.
5204 – Operating Systems Threads vs. Events. 2 CS 5204 – Operating Systems Forms of task management serial preemptivecooperative (yield) (interrupt)
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Department of Computer Science and Software Engineering
Presenting: Why Events Are A “Bad” Idea ( for high-concurrency servers) Paper by: Behren, Condit and Brewer, 2003 Presented by: Rania Elnaggar 1/30/2008.
CSE 60641: Operating Systems Next topic: CPU (Process/threads/scheduling, synchronization and deadlocks) –Why threads are a bad idea (for most purposes).
1 Cooperative Task Management without Manual Stack Management or Event-driven Programming is not the Opposite of Threaded Programming Atul Adya, Jon Howell,
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
Threads versus Events CSE451 Andrew Whitaker. This Class Threads vs. events is an ongoing debate  So, neat-and-tidy answers aren’t necessarily available.
1 Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer (May 2003) CS533 – Spring 2006 – DONG, QIN.
CS533 Concepts of Operating Systems Jonathan Walpole.
Paper Review of Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer By Anandhi Sundaram.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Introduction to threads
Processes and threads.
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Why Events Are A Bad Idea (for high-concurrency servers)
Processes and Threads Processes and their scheduling
CS399 New Beginnings Jonathan Walpole.
Capriccio – A Thread Model
Chapter 4: Threads.
On the Duality of Operating System Structures
Background and Motivation
Multithreaded Programming
Structuring of Systems using Upcalls
CS510 Operating System Foundations
Why Events Are a Bad Idea (for high concurrency servers)
Foundations and Definitions
CS703 – Advanced Operating Systems
Presentation transcript:

By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 2

Background-Event based models Small, static number of processes Explicit message system for communication and synchronization A message-oriented system Pre-defined static communication mechanism One execution stream, no CPU concurrency No preemption of event handlers Blocked I/O is complex to handle. Stack ripping 3

Background-Thread-based models Large, rapidly changing processes Synchronization mechanism is based on shared data A procedure-oriented system through fork and join System recourses encoded as global data structures and shared through locks Blocked I/O is a blocked thread 4

Background-Three Opinions Events are better: There is no stack: managing state has lower overhead Cooperative multitasking: free synchronization (no need to mutexes and handle wait queues) Application level information: better scheduling, perform optimizations, and locality More flexible control flow 5

Background-Three Opinions Events and threads are equal Based on Lauer & Needham study Message-oriented and procedure-oriented systems are duals The choice should be made based on the nature of the machine architecture upon which the system is going to be built  What they missed: Most modern event systems use cooperative scheduling Most event systems use shared memory and global data structure, which are assumed atypical in their study SEDA is an exception 6

Background-Three Opinions Threads are better: Threads can have the same properties as events Threads can have some advantages over events for high concurrent systems Compiler improvements can eliminate historical drawbacks with threads 7

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 8

Criticisms about threads 1- Performance: have not performed well for high concurrency Respond: Poor thread implementations (thread packages were designed for both high concurrency and blocking operations) Operations with O(n) in the number of threads The context switch overhead and kernel crossing Have modified the GNU Pth user-level threading package Remove O(n) operations from the scheduler Repeated the SEDA threaded server benchmark Performance matches the event-based server 9

Criticisms about threads cont’d 2- Control Flow: restrictive control flow. - Encourage the programmer to think too linearly Respond: Complex patterns are not used (difficult and error prone) Threads express common patterns more naturally: - call/return - parallel calls - pipelines 10

Criticism about threads cont’d 3- Synchronization: heavyweight synchronization -Events have “free” synchronization Respond: Adya et al show that this advantage is due to cooperative multitasking, not events themselves It is “free” only with uniprocessor High-concurrency servers have multi processors 11

Criticisms about threads cont’d 4- State Management: Thread are not effective in managing live state A tradeoff between risking stack overflow and wasting address space on large stacks Event systems unwind the thread stack after each event handler Respond: Have proposed a mechanism which allow stack to grow dynamically. (later) 12

Criticisms about threads cont’d 5- Scheduling: can’t optimize scheduling decisions Runtime system is too generic in thread-based Event systems can schedule at application level (better scheduling, and code locality) Respond: Lauer and Needham indicate that the cooperatively scheduled threads can have the same scheduling tricks Threads and events are equivalent in power 13

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 14

Advantages of Threads Observations about modern servers : 1- The concurrency is because of the largely independent concurrent requests 2- The code that handles each code is usually sequential  Threads provide a better programming abstraction for servers. 15

Advantages of Threads cont’d Control Flow: Event-based systems: tend to obfuscate the control flow 1- Programmer has to manually match the call/return pairs 2-Manually save and restore live state. “Stack Ripping” Thread-based systems: express control flow in a more natural manner 1- Group calls with returns. Ensuring a one-to-one relationship. 2- live state encapsulate at stack. Much easier debugging 16

Advantages of Threads cont’d Exception Handling and state Lifetime -The thread stack tracks the live state. cleaning up task state is simple. -In event systems, task state is typically heap allocated. (difficult to freeing it on time) -Garbage collection is inappropriate for high performance systems. 17

Advantages of Threads cont’d Existing Systems: - The event-based systems, using thread in the complex parts of the code: Ninja system - Applications without a high concurrency also using threads for simplicity: FTP server in Harvest uses threads Just Fix Events: - Fixing the problems with events is equal to switching to threads Threads have advantages over events 18

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 19

Compiler support for threads Minor modification can improve safety and performance of the threaded systems 1-Dynamic Stack Growth: Analyze upper bound on the stack size when calling a function Determine which call sites may require stack growth 20

Compiler support for threads cont’d 2- Live State Management: Remove unnecessary state from the stack -temporary variables before calling subroutines -popped entire frame in tail call. 3- Synchronization With compiler analysis can: - Warn the programmer about data races (reduce the occurrence of bugs) - Determine which atomic sections are safe to run concurrently. 21

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 22

Evaluation Designed and implemented a simple user-level cooperative threading package for Linux (5000 line) used the package to write a test web server, Knot. (700 line) Compared the performance of Knot with Haboob (SEDA’s event-driven web server) Two different scheduling policies for Knot: 1-favors processing of current connections 2-favors processing of accepting connections 23

Web server bandwidth versus the number f simultaneous clients. 24

Contents  Background  Criticisms about threads  Advantages of Threads  Compiler support for threads  Evaluation  Conclusion 25

Conclusion Threads have the similar or better performance than events in high concurrency systems Improvement to compiler can eliminate threads’ problems 26