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

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.
SEDA: An Architecture for Well- Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University.
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
CS533 Concepts of Operating Systems Class 5 Integrated Task and Stack Management.
Why Events Are A Bad Idea (for high-concurrency servers) By Rob von Behren, Jeremy Condit and Eric Brewer.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
Capriccio: Scalable Threads for Internet Services ( by Behren, Condit, Zhou, Necula, Brewer ) Presented by Alex Sherman and Sarita Bafna.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
Capriccio: Scalable Threads for Internet Services (von Behren) Kenneth Chiu.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, George Necula and Eric Brewer University of California at Berkeley.
Capriccio: Scalable Threads For Internet Services Authors: Rob von Behren, Jeremy Condit, Feng Zhou, George C. Necula, Eric Brewer Presentation by: Will.
Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
3.5 Interprocess Communication
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]
“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,
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for Threads.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
Threads. Processes and Threads  Two characteristics of “processes” as considered so far: Unit of resource allocation Unit of dispatch  Characteristics.
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.
CS 3013 & CS 502 Summer 2006 Threads1 CS-3013 & CS-502 Summer 2006.
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
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services by, Matt Welsh, David Culler, and Eric Brewer Computer Science Division University.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Threads, Thread management & Resource Management.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Presented by Changdae Kim and Jaeung Han OFFENCE.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
Scheduler Activations: Effective Kernel Support for the User- Level Management of Parallelism. Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Review The Joys and Pains of Threads and Multithreading –what is a thread –threads vs. processes –opportunities and risks.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
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)
Department of Computer Science and Software Engineering
Capriccio: Scalable Threads for Internet Service
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Holistic Systems Programming Qualifying Exam Presentation UC Berkeley, Computer Science Division Rob von Behren June 21, 2004.
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.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Cooperative Task Management without Manual Stack management Hanyun Tao EECS 582 – W161.
Paper Review of Why Events Are A Bad Idea (for high-concurrency servers) Rob von Behren, Jeremy Condit and Eric Brewer By Anandhi Sundaram.
Operating System Concepts
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Chapter 4 – Thread Concepts
Capriccio:Scalable Threads for Internet Services
Threads & Multithreading
Chapter 4: Threads.
Capriccio : Scalable Threads for Internet Services
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
Why Events Are A Bad Idea (for high-concurrency servers)
Chapter 4 – Thread Concepts
Chapter 4: Multithreaded Programming
Chapter 4 Threads.
Presenter: Godmar Back
Capriccio – A Thread Model
Page Replacement.
Multithreaded Programming
Capriccio: Scalable Threads for Internet Services
Why Events Are a Bad Idea (for high concurrency servers)
CS703 – Advanced Operating Systems
CS 5204 Operating Systems Lecture 5
Presentation transcript:

Capriccio: Scalable Threads for Internet Services Rob von Behren, Jeremy Condit, Feng Zhou, Geroge Necula and Eric Brewer University of California at Berkeley Presenter: Cong Lin

Outline Part IMotivation & Goals Part IICapriccio: Approaches Thread Package Linked Stacks Resource-aware Scheduling Part IIIExperiments & Results Part IVConclusion & Future work

Part IMotivation Increasing scalability demands for Internet services

The situation is… Hardware:“I’m ready” Current implementations are event based Software:“…Wait for me”

Event Based Systems - Drawbacks Events systems hide the control flow Difficult to understand and debug Programmers need to match related events

Goals: Capriccio Support for existing thread API Scalability to hundreds of thousands of threads Flexibility to address application- specific needs

Part II Capriccio: Approach Thread package User-Level thread &Cooperative scheduling Linked stacks Address the problem of stack allocation for large numbers of threads Combination of compile-time and run-time analysis Resource-aware scheduler

Thread package: User Level Thread Performance Ease thread synchronization overhead No kernel crossing for preemptive threading More efficient memory management at user level Flexibility Decoupling user and kernel threads allows faster innovation Can use new kernel thread features without changing application code Scheduler tailored for applications Advantages

Additional Overhead Replacing blocking calls with non- blocking calls Multiple CPU synchronization Disadvantages Thread package: User Level Thread

It is Worthy.

Context Switches Fast context switches provided by Edgar Toernig’s coroutine library I/O Intercepts blocking I/O calls & uses epoll() for asynchronous I/O Scheduling Very much like an event-driven application Events are hidden from programmers Synchronization Supports cooperative threading on single-CPU machines Thread package: User Level Thread Implementation

Question It seems that cooperative scheduling is a must for highly concurrent servers. Does this carry to multiprocessors? (i.e. does cooperative scheduling maintain its advantages on a multiprocessor?)

Linked Stack The problem: fixed stacks Overflow vs. wasted space Limits thread numbers The solution: dynamic allocation Allocate space as needed Compiler aid Add runtime checkpoints on Call Graph Guarantee enough space until next check Fixed Stacks Linked Stack

Parameters MaxPath(Bound) Steps Break cycles Trace back MaxPath = 8

Linked Stack Parameters MaxPath Steps Break cycles Trace back MaxPath = 8

Linked Stack Parameters MaxPath Steps Break cycles Trace back MaxPath = 8 6

Linked Stack Parameters MaxPath Steps Break cycles Trace back MaxPath = 8

Linked Stack Parameters MaxPath Steps Break cycles Trace back MaxPath = 8

Linked Stack Parameters MaxPath Steps Break cycles Trace back MaxPath = 8

Questions Each execution of checkpoint needs a kernel thread, since it needs a new allocation of memory, and in the large recursive program, it may occur thousands of times. How about the time assumption and the newly created kernel threads? Is it efficient for all the conditions?

Resource-aware Scheduling Similar to event-based: Whether a process is close to completion Whether a system is overloaded Blocking Graph

Resource-aware Scheduling The Blocking Graph Close Write ReadSleep ThreadcreateMain Thread-based View applications as sequence of stages, separated by blocking calls

Resource-aware Scheduling Track resources used along BG edges Mark memory, file descriptors, CPU Predict future from the past Algorithm Increase use when underutilized Decrease use near saturation Advantages Workload-sensitive admission control Operate before thrashing

Questions Given that resource status is hard to detect inside a process and other processes in the operating system may influence the resource status, - Is it so important to design a resource aware scheduling mechanism in a user level thread library? - How to estimate the maximum capacity of a particular resource?

Thread Primitive - Latency CapriccioLinuxThreadsNPTL Thread creation Thread context switch Uncontended mutex lock Part III Experiments & Results

Results: Thread Scalability EECS Advanced Operating Systems Northwestern University

Results: I/O performance Web server performance Runtime overhead

Part IV Conclusion & Future Work Capriccio simplifies high concurrency Scalable & high performance Control over concurrency model Stack safety Resource-aware scheduling

Future work Threading Multi-CPU support Compile-time techniques Parameters tuning Scheduling More sophisticated prediction

Questions In the Resource Aware Scheduling, it is mentioned that it has workload sensitive form of admission control. How does it actually measure whether a given thread is near to complete ? Besides I/O, there is another user level operation which can affect the kernel thread into block, that is page fault. Then, how to deal with the page fault problem in Capriccio?

The "linked stacks" mechanism isn't specific to Capriccio or User space threading. Has this mechanism been investigated in combination with normal kernel threads, as an attempt to increase scalability by reducing address space pressure? Do you think the Berkley team downplays the difficulty of programming in parallel? They mention starvation a few times, and in 6 say that "any apparent advantages of events [over user-level threads] are simply artifacts of poor thread implementations". The paper focuses on performance and efficiency and ease of debugging and leaves out the fact that people are bad at writing parallel programs free of deadlock and starvation.