SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Operating Systems
          CMPSCI 377
        Queuing Systems
            Emery Berger
University of Massachusetts Amherst




  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Queuing Systems & Servers
    Queuing systems


        High-level model of concurrent applications
    

    Flux


        Language for building servers
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   2
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   3
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   4
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   5
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   6
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




    arrival rate
        ()




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   7
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




                        waiting time




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   8
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




                                    service time




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   9
Queuing Networks
    Model of tasks or services


        Node includes queue (line) & server
    




        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   10
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   11
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   12
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   13
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




    What happens if  > departure rate?





      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   14
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




    What happens if  > departure rate?





      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   15
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




    What happens if  > departure rate?





      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   16
Stable Systems
    Stable queuing system:


    arrival rate = departure rate




    What happens if  > departure rate?





      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   17
Networks of Queues
    Can build system from connected servers


        Latency = time for one thing to get through
    

        Throughput = service rate
    




        5/sec                          5/sec                              5/sec


    Throughput?


        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science      18
Networks of Queues
    Can build system with numerous


    connected servers
        Latency = time for one thing to get through
    

        Throughput = service rate
    




        5/sec                          1/sec                              5/sec

    Throughput?


        Lowest throughput = bottleneck
    

        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science      19
Little’s Law
    Little’s Law – applies to any “blackbox”


    server
        Queue length (N) =
    

        arrival rate () * average waiting time (T)
              N=T
          




              N

                                      T



        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   20
Applications of Little’s Law
    Compute waiting time to get into


    restaurant, bar, etc.
        If N = 20 people in front of you,
    

         = departure rate = 1 / 5 min.,
        how long will you wait in line?



                                   N=T
             N

                                       T

        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   21
Applications of Little’s Law
    Required service time?


        Arrival rate = one job @ 500 ms
    

        Average queue length = 10
    

        T=?
    

              What’s the average latency?
          




                                   N=T
              N

                                       T

        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   22
Applications of Little’s Law
    Required service time?


        Arrival rate = one job @ 500 ms
    

        Average queue length = 5
    

        T=?
    

              What’s the average latency?
          




                                   N=T
              N

                                       T

        UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   23
Motivating Example: Image Server
                                                                       image
                                                                       server
    Client


        Requests image @ desired
    

        quality, size                                                               not found

    Server


        Images: RAW
    
                                              http://server/Easter-bunny/
                                              200x100/75
        Compresses to JPG
    

        Caches requests
    

        Sends to client
    




                                                  client
             UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Problem: Concurrency
                                                                     image
    Could write sequential code                                      server

    but…
        More clients (latency)
    

        Bigger server
    

             Multicores, multiprocessors
         


    One approach: threads


        Limit reuse,
    

        risk deadlock,
        burden programmer
        Complicate debugging
    

        Mixes program logic &
    

        concurrency control                             clients

               UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
The Flux Programming Language
        High-performance & deadlock-free
concurrent programming w/ sequential components
     Flux = Components + Flow + Atomicity
 

         Components               unmodified C, C++ (or Java)
     

         Flow                     implicitly || path thru components
     

         Atomicity                high-level mutual exclusion
     



     Compiler generates:
 

         Deadlock-free, runtime-independent server
     

              Threads, thread pools, events, …
          


         Path profiling
     

         Discrete event simulator
     

                UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Flux Outline

     Intro to Flux: building a server
 

         Components
     

         Flows
     

         Atomicity
     

     Performance results
 

         Server performance
     

         Performance prediction (QNMs)
     




         UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Flux Server “Main”

    Source nodes originate flows


        Conceptually in separate thread
    

        Executes inside implicit infinite loop
    

             Here: initiates flow for each image request
         



                  source Listen  Image;




                      Listen
                                                           image server
                                                      ReadRequest      Compress       Write     Complete
                                                       ReadRequest      Compress       Write     Complete
                                                         ReadRequest     Compress       Write     Complete




               UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Flux Image Server
     Basic image server requires:
 
        HTTP parsing (http)
      

       Socket handling (socket)

       JPEG compression (libjpeg)

       All UNIX-style C libraries

     Abstract node = flow across nodes
 
          Concrete or abstract
      



     Image = ReadRequest  Compress  Write  Complete;

     image server
                     ReadRequest            Compress              Write          Complete


                         http                libjpeg             socket            http

          UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Control Flow
    Direct flow via user-supplied predicate types


         Type test applied to output
    

              Note: no variables – dispatch on output “type”
          


         Here: cache frequently requested images
    



typedef hit TestInCache;
Handler:[_,_,hit] = ;
Handler:[_,_,_] = ReadFromDisk  Compress  StoreInCache;


                                                  hit   handler
                   ReadRequest     CheckCache                                      Write     Complete
Listen


                         handler
                                                                              StoreInCache
                                      ReadInFromDisk        Compress



                 UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Supporting Concurrency
    Many clients = concurrent flows


        Must keep cache consistent
    

    Atomicity constraints


        Same name = mutual exclusion
    

        Apply to nodes or whole flow (abstract node)
    


         atomic CheckCache                   {};
                                             {, };
         atomic Complete
         atomic StoreInCache                 {};

                                                            CheckCache hit
                                             ReadRequest                      Write      Complete
                                                              CheckCache hit     hit
                                               ReadRequest                      Write      Complete
                                                               CheckCache hit     Writehandler
                                                ReadRequest                                 Complete
                          Listen                  ReadInFromDisk     Compress       StoreInCache
                                                 ReadRequest          CheckCache      StoreInCache Write   Complete
                                                    ReadInFromDisk     Compress
                                                     ReadInFromDisk     Compress        StoreInCache

                                               handler
                                                                                                    StoreInCache
                                                              ReadInFromDisk         Compress




             UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
More Atomicity

    Reader / writer constraints


        Multiple readers or single writer (default)
    


              atomic ReadList: {listAccess?};
              atomic AddToList: {listAccess!};


    Per-session constraints


        User-supplied function ≈ hash on source
    

             Added to flow ≈ chooses from array of locks
         




             atomic AddHasChunk: {chunks(session)};
               UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Preventing Deadlock

       Naïve execution can deadlock
   



       atomic A: {z,y};                                    atomic A: {y,z};
       atomic B: {y,z};                                    atomic B: {y,z};

       Establish canonical lock order
   

            Partial order
        

            Alphabetic by name
        




            UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   33
Preventing Deadlock, II
    Harder with abstract nodes


 A = B;
 C = D;
                             A:{z}
                             A
                             A{z}
 atomic A{z};                                                                C{y}
                                                                              C
                                           B
 atomic B{y};
 atomic C{y,z};

    Solution: Elevate constraints; fixed point


 A = B;
 C = D;                      A{y,z}
                                                                                  C
 atomic A{y,z};
                                           B
 atomic B{y};
 atomic C{y,z};

           UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science       34
Handling Errors
    What if image requested doesn’t exist?


        Error = negative return value from component
    

        Remember – nodes oblivious to Flux
    

    Solution: error handlers


        Go to alternate paths on error
    

        Possible extension – can match on error paths
    


         handle error ReadInFromDisk  FourOhFour;
                                                                            hit
                                                                                  handler
                                             ReadRequest        CheckCache                   Write    Complete


                              Listen       handler
                                                                                               StoreInCache
                                                           ReadInFromDisk         Compress




                                                                                     FourOhFour


             UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Almost Complete Flux Image Server
source Listen  Image;
Image =
 ReadRequest  CheckCache  Handler  Write  Complete;
Handler[_,_,hit] = ;
Handler[_,_,_] = ReadFromDisk  Compress  StoreInCache;
atomic CheckCache:   {cacheLock};
atomic StoreInCache: {cacheLock};
atomic Complete:     {cacheLock};
handle error ReadInFromDisk  FourOhFour;
    Concise, readable expression of server logic


        No threads, etc.: simplifies programming, debugging
    

     image                                                             hit
                                                                             handler
     server                             ReadRequest        CheckCache                   Write    Complete
                     Listen
                                      handler
                                                                                          StoreInCache
                                                      ReadInFromDisk         Compress




                UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Flux Outline

     Intro to Flux: building a server
 

         Components, flow
     

         Atomicity, deadlock avoidance
     

     Performance results
 

         Server performance
     

         Performance prediction
     

     Future work
 




         UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
Flux Results

        Four servers:
    
            Image server (+ libjpeg) [23 lines of Flux]
        

            Multi-player online game [54]
        

            BitTorrent (2 undergrads: 1 week!) [84]
        

            Web server (+ PHP) [36]
        


        Evaluation
    
            Benchmark: variant of SPECweb99
        

            Three different runtimes here
        

                 Thread:                  one per connection
             

                 Thread pool:             fixed max # threads
             

                 Event-driven:            helper threads for blocking calls
             


            Compared to Capriccio [SOSP03], SEDA [SOSP01]
        


            UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   38
Web Server




      UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   39
Performance Prediction




 observed
parameters




             UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   40
Performance Prediction




 observed
parameters




             UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   41
The End




  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science   42

Mais conteúdo relacionado

Destaque

Types of operating system
Types of operating systemTypes of operating system
Types of operating systemMohammad Alam
 
Unit 6 input modeling problems
Unit 6 input modeling problemsUnit 6 input modeling problems
Unit 6 input modeling problemsraksharao
 
Unit 1 introduction contd
Unit 1 introduction contdUnit 1 introduction contd
Unit 1 introduction contdraksharao
 
Chapter3 general principles of discrete event simulation
Chapter3   general principles of discrete event simulationChapter3   general principles of discrete event simulation
Chapter3 general principles of discrete event simulationDe La Salle University-Manila
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation ExamplesStephen Gilmore
 
Queuing theory and simulation (MSOR)
Queuing theory and simulation (MSOR)Queuing theory and simulation (MSOR)
Queuing theory and simulation (MSOR)snket
 
Discrete And Continuous Simulation
Discrete And Continuous SimulationDiscrete And Continuous Simulation
Discrete And Continuous SimulationNguyen Chien
 
New Method for Simulation Of Fractures
New Method for Simulation Of FracturesNew Method for Simulation Of Fractures
New Method for Simulation Of Fracturesdavid_schechter
 
Elements Of Stochastic Processes
Elements Of Stochastic ProcessesElements Of Stochastic Processes
Elements Of Stochastic ProcessesMALAKI12003
 
Unit 4 queuing models
Unit 4 queuing modelsUnit 4 queuing models
Unit 4 queuing modelsraksharao
 
4 stochastic processes
4 stochastic processes4 stochastic processes
4 stochastic processesSolo Hermelin
 
Stochastic modelling and its applications
Stochastic modelling and its applicationsStochastic modelling and its applications
Stochastic modelling and its applicationsKartavya Jain
 
Introduction to Discrete-Event Simulation Using SimPy
Introduction to Discrete-Event Simulation Using SimPyIntroduction to Discrete-Event Simulation Using SimPy
Introduction to Discrete-Event Simulation Using SimPypycontw
 
basics of stochastic and queueing theory
basics of stochastic and queueing theorybasics of stochastic and queueing theory
basics of stochastic and queueing theoryjyoti daddarwal
 

Destaque (20)

14 queuing
14 queuing14 queuing
14 queuing
 
Types of operating system
Types of operating systemTypes of operating system
Types of operating system
 
Queuing analysis
Queuing analysisQueuing analysis
Queuing analysis
 
Guide to Queuing System
Guide to Queuing SystemGuide to Queuing System
Guide to Queuing System
 
Chapter1
Chapter1Chapter1
Chapter1
 
Unit 6 input modeling problems
Unit 6 input modeling problemsUnit 6 input modeling problems
Unit 6 input modeling problems
 
Unit 1 introduction contd
Unit 1 introduction contdUnit 1 introduction contd
Unit 1 introduction contd
 
Chapter3 general principles of discrete event simulation
Chapter3   general principles of discrete event simulationChapter3   general principles of discrete event simulation
Chapter3 general principles of discrete event simulation
 
Extend sim 01
Extend sim 01Extend sim 01
Extend sim 01
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation Examples
 
Queuing theory and simulation (MSOR)
Queuing theory and simulation (MSOR)Queuing theory and simulation (MSOR)
Queuing theory and simulation (MSOR)
 
Discrete And Continuous Simulation
Discrete And Continuous SimulationDiscrete And Continuous Simulation
Discrete And Continuous Simulation
 
New Method for Simulation Of Fractures
New Method for Simulation Of FracturesNew Method for Simulation Of Fractures
New Method for Simulation Of Fractures
 
Elements Of Stochastic Processes
Elements Of Stochastic ProcessesElements Of Stochastic Processes
Elements Of Stochastic Processes
 
Unit 4 queuing models
Unit 4 queuing modelsUnit 4 queuing models
Unit 4 queuing models
 
4 stochastic processes
4 stochastic processes4 stochastic processes
4 stochastic processes
 
Stochastic modelling and its applications
Stochastic modelling and its applicationsStochastic modelling and its applications
Stochastic modelling and its applications
 
Introduction to Discrete-Event Simulation Using SimPy
Introduction to Discrete-Event Simulation Using SimPyIntroduction to Discrete-Event Simulation Using SimPy
Introduction to Discrete-Event Simulation Using SimPy
 
Simulation
SimulationSimulation
Simulation
 
basics of stochastic and queueing theory
basics of stochastic and queueing theorybasics of stochastic and queueing theory
basics of stochastic and queueing theory
 

Semelhante a Operating Systems - Queuing Systems

Processes and Threads
Processes and ThreadsProcesses and Threads
Processes and ThreadsEmery Berger
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual MemoryEmery Berger
 
Memory Management for High-Performance Applications
Memory Management for High-Performance ApplicationsMemory Management for High-Performance Applications
Memory Management for High-Performance ApplicationsEmery Berger
 
Asynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet AplicationsAsynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet AplicationsSubramanyan Murali
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With TerracottaPT.JUG
 
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from FacebookEdge AI and Vision Alliance
 
Netcetera Proactive Management Service
Netcetera Proactive Management ServiceNetcetera Proactive Management Service
Netcetera Proactive Management ServicePeter Skelton
 
Interpreting Performance Test Results
Interpreting Performance Test ResultsInterpreting Performance Test Results
Interpreting Performance Test ResultsEric Proegler
 
Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyBrian Moschel
 
The Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With RubyThe Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With Rubymattmatt
 
Giorgio Natilli - Blaze DS Connectivity Framework
Giorgio Natilli - Blaze DS Connectivity FrameworkGiorgio Natilli - Blaze DS Connectivity Framework
Giorgio Natilli - Blaze DS Connectivity Framework360|Conferences
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svenssonrajivmordani
 
Services Oriented Infrastructure in a Web2.0 World
Services Oriented Infrastructure in a Web2.0 WorldServices Oriented Infrastructure in a Web2.0 World
Services Oriented Infrastructure in a Web2.0 WorldLexumo
 
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...IEEEGLOBALSOFTSTUDENTPROJECTS
 

Semelhante a Operating Systems - Queuing Systems (20)

Processes and Threads
Processes and ThreadsProcesses and Threads
Processes and Threads
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
Memory Management for High-Performance Applications
Memory Management for High-Performance ApplicationsMemory Management for High-Performance Applications
Memory Management for High-Performance Applications
 
Asynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet AplicationsAsynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet Aplications
 
Reliability and clock synchronization
Reliability and clock synchronizationReliability and clock synchronization
Reliability and clock synchronization
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With Terracotta
 
Web 2.0 Expo Notes
Web 2.0 Expo NotesWeb 2.0 Expo Notes
Web 2.0 Expo Notes
 
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
“Practical DNN Quantization Techniques and Tools,” a Presentation from Facebook
 
Netcetera Proactive Management Service
Netcetera Proactive Management ServiceNetcetera Proactive Management Service
Netcetera Proactive Management Service
 
Interpreting Performance Test Results
Interpreting Performance Test ResultsInterpreting Performance Test Results
Interpreting Performance Test Results
 
Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called Jabbify
 
The Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With RubyThe Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With Ruby
 
Smallsat 2021
Smallsat 2021Smallsat 2021
Smallsat 2021
 
XS 2008 Boston Capacity Planning
XS 2008 Boston Capacity PlanningXS 2008 Boston Capacity Planning
XS 2008 Boston Capacity Planning
 
Giorgio Natilli - Blaze DS Connectivity Framework
Giorgio Natilli - Blaze DS Connectivity FrameworkGiorgio Natilli - Blaze DS Connectivity Framework
Giorgio Natilli - Blaze DS Connectivity Framework
 
saurabh soni rac
saurabh soni racsaurabh soni rac
saurabh soni rac
 
Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
 
Services Oriented Infrastructure in a Web2.0 World
Services Oriented Infrastructure in a Web2.0 WorldServices Oriented Infrastructure in a Web2.0 World
Services Oriented Infrastructure in a Web2.0 World
 
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Adaptive algorithm for minimizing clo...
 

Mais de Emery Berger

Doppio: Breaking the Browser Language Barrier
Doppio: Breaking the Browser Language BarrierDoppio: Breaking the Browser Language Barrier
Doppio: Breaking the Browser Language BarrierEmery Berger
 
Dthreads: Efficient Deterministic Multithreading
Dthreads: Efficient Deterministic MultithreadingDthreads: Efficient Deterministic Multithreading
Dthreads: Efficient Deterministic MultithreadingEmery Berger
 
Programming with People
Programming with PeopleProgramming with People
Programming with PeopleEmery Berger
 
Stabilizer: Statistically Sound Performance Evaluation
Stabilizer: Statistically Sound Performance EvaluationStabilizer: Statistically Sound Performance Evaluation
Stabilizer: Statistically Sound Performance EvaluationEmery Berger
 
DieHarder (CCS 2010, WOOT 2011)
DieHarder (CCS 2010, WOOT 2011)DieHarder (CCS 2010, WOOT 2011)
DieHarder (CCS 2010, WOOT 2011)Emery Berger
 
Operating Systems - Advanced File Systems
Operating Systems - Advanced File SystemsOperating Systems - Advanced File Systems
Operating Systems - Advanced File SystemsEmery Berger
 
Operating Systems - File Systems
Operating Systems - File SystemsOperating Systems - File Systems
Operating Systems - File SystemsEmery Berger
 
Operating Systems - Advanced Synchronization
Operating Systems - Advanced SynchronizationOperating Systems - Advanced Synchronization
Operating Systems - Advanced SynchronizationEmery Berger
 
Operating Systems - Synchronization
Operating Systems - SynchronizationOperating Systems - Synchronization
Operating Systems - SynchronizationEmery Berger
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and PagingEmery Berger
 
MC2: High-Performance Garbage Collection for Memory-Constrained Environments
MC2: High-Performance Garbage Collection for Memory-Constrained EnvironmentsMC2: High-Performance Garbage Collection for Memory-Constrained Environments
MC2: High-Performance Garbage Collection for Memory-Constrained EnvironmentsEmery Berger
 
Vam: A Locality-Improving Dynamic Memory Allocator
Vam: A Locality-Improving Dynamic Memory AllocatorVam: A Locality-Improving Dynamic Memory Allocator
Vam: A Locality-Improving Dynamic Memory AllocatorEmery Berger
 
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementQuantifying the Performance of Garbage Collection vs. Explicit Memory Management
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementEmery Berger
 
Garbage Collection without Paging
Garbage Collection without PagingGarbage Collection without Paging
Garbage Collection without PagingEmery Berger
 
DieHard: Probabilistic Memory Safety for Unsafe Languages
DieHard: Probabilistic Memory Safety for Unsafe LanguagesDieHard: Probabilistic Memory Safety for Unsafe Languages
DieHard: Probabilistic Memory Safety for Unsafe LanguagesEmery Berger
 
Exterminator: Automatically Correcting Memory Errors with High Probability
Exterminator: Automatically Correcting Memory Errors with High ProbabilityExterminator: Automatically Correcting Memory Errors with High Probability
Exterminator: Automatically Correcting Memory Errors with High ProbabilityEmery Berger
 
Operating Systems - Garbage Collection
Operating Systems - Garbage CollectionOperating Systems - Garbage Collection
Operating Systems - Garbage CollectionEmery Berger
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Emery Berger
 
Composing High-Performance Memory Allocators with Heap Layers
Composing High-Performance Memory Allocators with Heap LayersComposing High-Performance Memory Allocators with Heap Layers
Composing High-Performance Memory Allocators with Heap LayersEmery Berger
 
Reconsidering Custom Memory Allocation
Reconsidering Custom Memory AllocationReconsidering Custom Memory Allocation
Reconsidering Custom Memory AllocationEmery Berger
 

Mais de Emery Berger (20)

Doppio: Breaking the Browser Language Barrier
Doppio: Breaking the Browser Language BarrierDoppio: Breaking the Browser Language Barrier
Doppio: Breaking the Browser Language Barrier
 
Dthreads: Efficient Deterministic Multithreading
Dthreads: Efficient Deterministic MultithreadingDthreads: Efficient Deterministic Multithreading
Dthreads: Efficient Deterministic Multithreading
 
Programming with People
Programming with PeopleProgramming with People
Programming with People
 
Stabilizer: Statistically Sound Performance Evaluation
Stabilizer: Statistically Sound Performance EvaluationStabilizer: Statistically Sound Performance Evaluation
Stabilizer: Statistically Sound Performance Evaluation
 
DieHarder (CCS 2010, WOOT 2011)
DieHarder (CCS 2010, WOOT 2011)DieHarder (CCS 2010, WOOT 2011)
DieHarder (CCS 2010, WOOT 2011)
 
Operating Systems - Advanced File Systems
Operating Systems - Advanced File SystemsOperating Systems - Advanced File Systems
Operating Systems - Advanced File Systems
 
Operating Systems - File Systems
Operating Systems - File SystemsOperating Systems - File Systems
Operating Systems - File Systems
 
Operating Systems - Advanced Synchronization
Operating Systems - Advanced SynchronizationOperating Systems - Advanced Synchronization
Operating Systems - Advanced Synchronization
 
Operating Systems - Synchronization
Operating Systems - SynchronizationOperating Systems - Synchronization
Operating Systems - Synchronization
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
 
MC2: High-Performance Garbage Collection for Memory-Constrained Environments
MC2: High-Performance Garbage Collection for Memory-Constrained EnvironmentsMC2: High-Performance Garbage Collection for Memory-Constrained Environments
MC2: High-Performance Garbage Collection for Memory-Constrained Environments
 
Vam: A Locality-Improving Dynamic Memory Allocator
Vam: A Locality-Improving Dynamic Memory AllocatorVam: A Locality-Improving Dynamic Memory Allocator
Vam: A Locality-Improving Dynamic Memory Allocator
 
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementQuantifying the Performance of Garbage Collection vs. Explicit Memory Management
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
 
Garbage Collection without Paging
Garbage Collection without PagingGarbage Collection without Paging
Garbage Collection without Paging
 
DieHard: Probabilistic Memory Safety for Unsafe Languages
DieHard: Probabilistic Memory Safety for Unsafe LanguagesDieHard: Probabilistic Memory Safety for Unsafe Languages
DieHard: Probabilistic Memory Safety for Unsafe Languages
 
Exterminator: Automatically Correcting Memory Errors with High Probability
Exterminator: Automatically Correcting Memory Errors with High ProbabilityExterminator: Automatically Correcting Memory Errors with High Probability
Exterminator: Automatically Correcting Memory Errors with High Probability
 
Operating Systems - Garbage Collection
Operating Systems - Garbage CollectionOperating Systems - Garbage Collection
Operating Systems - Garbage Collection
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
 
Composing High-Performance Memory Allocators with Heap Layers
Composing High-Performance Memory Allocators with Heap LayersComposing High-Performance Memory Allocators with Heap Layers
Composing High-Performance Memory Allocators with Heap Layers
 
Reconsidering Custom Memory Allocation
Reconsidering Custom Memory AllocationReconsidering Custom Memory Allocation
Reconsidering Custom Memory Allocation
 

Último

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Último (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Operating Systems - Queuing Systems

  • 1. Operating Systems CMPSCI 377 Queuing Systems Emery Berger University of Massachusetts Amherst UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 2. Queuing Systems & Servers Queuing systems  High-level model of concurrent applications  Flux  Language for building servers  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 2
  • 3. Queuing Networks Model of tasks or services  Node includes queue (line) & server  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 3
  • 4. Queuing Networks Model of tasks or services  Node includes queue (line) & server  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 4
  • 5. Queuing Networks Model of tasks or services  Node includes queue (line) & server  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 5
  • 6. Queuing Networks Model of tasks or services  Node includes queue (line) & server  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 6
  • 7. Queuing Networks Model of tasks or services  Node includes queue (line) & server  arrival rate () UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 7
  • 8. Queuing Networks Model of tasks or services  Node includes queue (line) & server  waiting time UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 8
  • 9. Queuing Networks Model of tasks or services  Node includes queue (line) & server  service time UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 9
  • 10. Queuing Networks Model of tasks or services  Node includes queue (line) & server  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 10
  • 11. Stable Systems Stable queuing system:  arrival rate = departure rate UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 11
  • 12. Stable Systems Stable queuing system:  arrival rate = departure rate UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 12
  • 13. Stable Systems Stable queuing system:  arrival rate = departure rate UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 13
  • 14. Stable Systems Stable queuing system:  arrival rate = departure rate What happens if  > departure rate?  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 14
  • 15. Stable Systems Stable queuing system:  arrival rate = departure rate What happens if  > departure rate?  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 15
  • 16. Stable Systems Stable queuing system:  arrival rate = departure rate What happens if  > departure rate?  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 16
  • 17. Stable Systems Stable queuing system:  arrival rate = departure rate What happens if  > departure rate?  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 17
  • 18. Networks of Queues Can build system from connected servers  Latency = time for one thing to get through  Throughput = service rate  5/sec 5/sec 5/sec Throughput?  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 18
  • 19. Networks of Queues Can build system with numerous  connected servers Latency = time for one thing to get through  Throughput = service rate  5/sec 1/sec 5/sec Throughput?  Lowest throughput = bottleneck  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 19
  • 20. Little’s Law Little’s Law – applies to any “blackbox”  server Queue length (N) =  arrival rate () * average waiting time (T) N=T  N  T UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 20
  • 21. Applications of Little’s Law Compute waiting time to get into  restaurant, bar, etc. If N = 20 people in front of you,   = departure rate = 1 / 5 min., how long will you wait in line? N=T N  T UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 21
  • 22. Applications of Little’s Law Required service time?  Arrival rate = one job @ 500 ms  Average queue length = 10  T=?  What’s the average latency?  N=T N  T UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 22
  • 23. Applications of Little’s Law Required service time?  Arrival rate = one job @ 500 ms  Average queue length = 5  T=?  What’s the average latency?  N=T N  T UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 23
  • 24. Motivating Example: Image Server image server Client  Requests image @ desired  quality, size not found Server  Images: RAW  http://server/Easter-bunny/ 200x100/75 Compresses to JPG  Caches requests  Sends to client  client UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 25. Problem: Concurrency image Could write sequential code server  but… More clients (latency)  Bigger server  Multicores, multiprocessors  One approach: threads  Limit reuse,  risk deadlock, burden programmer Complicate debugging  Mixes program logic &  concurrency control clients UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 26. The Flux Programming Language High-performance & deadlock-free concurrent programming w/ sequential components Flux = Components + Flow + Atomicity  Components unmodified C, C++ (or Java)  Flow implicitly || path thru components  Atomicity high-level mutual exclusion  Compiler generates:  Deadlock-free, runtime-independent server  Threads, thread pools, events, …  Path profiling  Discrete event simulator  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 27. Flux Outline Intro to Flux: building a server  Components  Flows  Atomicity  Performance results  Server performance  Performance prediction (QNMs)  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 28. Flux Server “Main” Source nodes originate flows  Conceptually in separate thread  Executes inside implicit infinite loop  Here: initiates flow for each image request  source Listen  Image; Listen image server ReadRequest Compress Write Complete ReadRequest Compress Write Complete ReadRequest Compress Write Complete UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 29. Flux Image Server Basic image server requires:  HTTP parsing (http)   Socket handling (socket)  JPEG compression (libjpeg)  All UNIX-style C libraries Abstract node = flow across nodes  Concrete or abstract  Image = ReadRequest  Compress  Write  Complete; image server ReadRequest Compress Write Complete http libjpeg socket http UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 30. Control Flow Direct flow via user-supplied predicate types  Type test applied to output  Note: no variables – dispatch on output “type”  Here: cache frequently requested images  typedef hit TestInCache; Handler:[_,_,hit] = ; Handler:[_,_,_] = ReadFromDisk  Compress  StoreInCache; hit handler ReadRequest CheckCache Write Complete Listen handler StoreInCache ReadInFromDisk Compress UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 31. Supporting Concurrency Many clients = concurrent flows  Must keep cache consistent  Atomicity constraints  Same name = mutual exclusion  Apply to nodes or whole flow (abstract node)  atomic CheckCache {}; {, }; atomic Complete atomic StoreInCache {}; CheckCache hit ReadRequest Write Complete CheckCache hit hit ReadRequest Write Complete CheckCache hit Writehandler ReadRequest Complete Listen ReadInFromDisk Compress StoreInCache ReadRequest CheckCache StoreInCache Write Complete ReadInFromDisk Compress ReadInFromDisk Compress StoreInCache handler StoreInCache ReadInFromDisk Compress UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 32. More Atomicity Reader / writer constraints  Multiple readers or single writer (default)  atomic ReadList: {listAccess?}; atomic AddToList: {listAccess!}; Per-session constraints  User-supplied function ≈ hash on source  Added to flow ≈ chooses from array of locks  atomic AddHasChunk: {chunks(session)}; UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 33. Preventing Deadlock Naïve execution can deadlock  atomic A: {z,y}; atomic A: {y,z}; atomic B: {y,z}; atomic B: {y,z}; Establish canonical lock order  Partial order  Alphabetic by name  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 33
  • 34. Preventing Deadlock, II Harder with abstract nodes  A = B; C = D; A:{z} A A{z} atomic A{z}; C{y} C B atomic B{y}; atomic C{y,z}; Solution: Elevate constraints; fixed point  A = B; C = D; A{y,z} C atomic A{y,z}; B atomic B{y}; atomic C{y,z}; UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 34
  • 35. Handling Errors What if image requested doesn’t exist?  Error = negative return value from component  Remember – nodes oblivious to Flux  Solution: error handlers  Go to alternate paths on error  Possible extension – can match on error paths  handle error ReadInFromDisk  FourOhFour; hit handler ReadRequest CheckCache Write Complete Listen handler StoreInCache ReadInFromDisk Compress FourOhFour UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 36. Almost Complete Flux Image Server source Listen  Image; Image = ReadRequest  CheckCache  Handler  Write  Complete; Handler[_,_,hit] = ; Handler[_,_,_] = ReadFromDisk  Compress  StoreInCache; atomic CheckCache: {cacheLock}; atomic StoreInCache: {cacheLock}; atomic Complete: {cacheLock}; handle error ReadInFromDisk  FourOhFour; Concise, readable expression of server logic  No threads, etc.: simplifies programming, debugging  image hit handler server ReadRequest CheckCache Write Complete Listen handler StoreInCache ReadInFromDisk Compress UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 37. Flux Outline Intro to Flux: building a server  Components, flow  Atomicity, deadlock avoidance  Performance results  Server performance  Performance prediction  Future work  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science
  • 38. Flux Results Four servers:  Image server (+ libjpeg) [23 lines of Flux]  Multi-player online game [54]  BitTorrent (2 undergrads: 1 week!) [84]  Web server (+ PHP) [36]  Evaluation  Benchmark: variant of SPECweb99  Three different runtimes here  Thread: one per connection  Thread pool: fixed max # threads  Event-driven: helper threads for blocking calls  Compared to Capriccio [SOSP03], SEDA [SOSP01]  UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 38
  • 39. Web Server UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 39
  • 40. Performance Prediction observed parameters UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 40
  • 41. Performance Prediction observed parameters UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 41
  • 42. The End UNIVERSITY OF MASSACHUSETTS AMHERST • Department of Computer Science 42