Event-Driven Programming Vivek Pai Dec 4, 2001. 2 GedankenEvents  Enron – bad news all around  What are these numbers: $1B, $100B, $80B, $200M  Korean.

Slides:



Advertisements
Similar presentations
Dissemination-based Data Delivery Using Broadcast Disks.
Advertisements

Threads, SMP, and Microkernels
CHAPTER 15 WEBPAGE OPTIMIZATION. LEARNING OBJECTIVES How to test your web-page performance How browser and server interactions impact performance What.
Effects of Virtual Cache Aliasing on the Performance of the NetBSD Operating System Rafal Boni CS 535 Project Presentation.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Flash: An efficient and portable Web server Authors: Vivek S. Pai, Peter Druschel, Willy Zwaenepoel Presented at the Usenix Technical Conference, June.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
Jump to first page Flash An efficient and portable Web server presented by Andreas Anagnostatos CSE 291 Feb. 2, 2000 Vivek S. Pai Peter Druschel Willy.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Event-Driven Programming Vivek Pai Dec 5, GedankenBits  What does a raw bit cost?  IDE  40GB: $100  120GB: $180  32MB USB Pen: $38  FireWire:
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
Preemptive Scheduling Vivek Pai / Kai Li Princeton University.
Preemptive Scheduling Vivek Pai / Kai Li Princeton University.
Basic Networking & Interprocess Communication Vivek Pai Nov 27, 2001.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
Computer System Architectures Computer System Software
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
DMWR Livorno Web Site Structure ACTIVITIES IN EXISTENCE: UTEP Tax Exemption Office DCC Club BOWLING SPORTS Gym, Fields SEA PINES Hotel ITR Travel Office.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Flash An efficient and portable Web server. Today’s paper, FLASH Quite old (1999) Reading old papers gives us lessons We can see which solution among.
Threads, SMP, and Microkernels Chapter 4. 2 Outline n Threads n Symmetric Multiprocessing (SMP) n Microkernel n Linux Threads.
LiNK: An Operating System Architecture for Network Processors Steve Muir, Jonathan Smith Princeton University, University of Pennsylvania
Operating System 4 THREADS, SMP AND MICROKERNELS
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
Web Page Design I Basic Computer Terms “How the Internet & the World Wide Web (www) Works”
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Final Review!. So how’s it all work? I boot my machine I open my browser and type The page loads What all just happened?
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Application Block Diagram III. SOFTWARE PLATFORM Figure above shows a network protocol stack for a computer that connects to an Ethernet network and.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Multimedia and Networks. Protocols (rules) Rules governing the exchange of data over networks Conceptually organized into stacked layers – Application-oriented.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
Multithreaded Programing. Outline Overview of threads Threads Multithreaded Models  Many-to-One  One-to-One  Many-to-Many Thread Libraries  Pthread.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Processes & Threads Introduction to Operating Systems: Module 5.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.
Node.Js 1. 2 Contents About Node.Js Web requirement latest trends Introduction Simple web server creation in Node.Js Dynamic Web pages Dynamic web page.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
for Event Driven Servers
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
10/15: Lecture Topics Input/Output –Types of I/O Devices –How devices communicate with the rest of the system communicating with the processor communicating.
2.2 Threads  Process: address space + code execution  There is no law that states that a process cannot have more than one “line” of execution.  Threads:
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Introduction to threads
Chapter 4: Threads.
CS 6560: Operating Systems Design
Cross-platform Libraries Technology Presentation
Chapter 4: Multithreaded Programming
Chapter 4: Threads.
Chapter 4: Threads.
Multithreaded Programming
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Chapter 4: Threads.
Introduction to JavaScript
Lecture 12 Input/Output (programmer view)
Chapter 3: Process Management
Threads CSE 2431: Introduction to Operating Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Event-Driven Programming Vivek Pai Dec 4, 2001

2 GedankenEvents  Enron – bad news all around  What are these numbers: $1B, $100B, $80B, $200M  Korean facts  Largest on-line game has 3M+ subscribers  What’s the comparable figure for the US?  What are the populations of the two countries?  How many albums does the Wu Tang Clan have?  What is Ginger?

3 A Random Aside  What do these companies have in common  VA Linux, Penguin Computing  RLX Technologies, Fibercycle  HP, Compaq  Dell, IBM

4 Mechanics  Project 3 grading in progress  Project 4 grading in progress  All feedback questions answered  One mail dropped – extra project proposals  Speaking of which  We need to agree on a one-page proposal

5 Project 5  Tyranny of the majority  Several goals  Performance improvement via caching  Dynamic adjustment to load  Master/slave or symmetric programming  Probably due on Dean’s Date  Extra credit: 6 points (15 base)

6 Another Random Aside  You may want to read  Flash: An Efficient and Portable Web Server  Available from my home page  Caveat: far more complicated than Project 5

7 Official Goals  Discuss the difference between standard programming styles and event-driven programming  Show the difference between structuring servers using processes and application-level multiplexing  Discuss the benefits and drawbacks of each approach

8 What Is An Event?  Some kind of notification  Interrupts  Signals  Polling (via poll/select/etc)  Callback (via function pointer)  Similarities?

9 “Reactive” Environments  Windowing systems  Network-aware programs  Drivers of all sorts

10 Traditional Environments  One thing going on at a time  Finish that thing, go on to next  Any step can block indefinitely  Resumption from blocking is simple – OS provided

11 What Goes On In A Web Browser?  Drawing the current page  Inline images  Translating machine names to IP addresses  Launching connections  Sending requests  Getting piecemeal responses, drawing images  User clicking to next link

12 Threads Versus Events  One stack versus many stacks  What happens on blocking operations  Parallelism  Shared variables  State

13 Let’s Think Of States  How many possible states are there?  Take all pieces of information  Decide valid range for all pieces  Enumerate  Can we reduce states?  Some combinations invalid  Still, lots of states

14 Really Reducing States  Take all major pieces of program  Add extra tags to state  What do tags look like?  Position  Count #

15 State Examples  If-then-else  3 states: start, then-clause, else-clause  For loop  1 state + count  Why do we care?  Resuming at the right state

16 Remember This Diagram? Read File Send Data Accept Conn Read Request Find File Send Header end

17 Structure of Event-Driven Programs  Lots of state machines  Maintaining information about each one  Some way of moving through states  As few restrictions as possible on timing

18 The Real Structure While (1) Get event Dispatch event  Or, while loop in library  Event handlers in main program

19 Delays  Are delays possible?  Interrupt handlers – generally not  Otherwise? Depends on event rate  How to avoid delays?  More events – asynchronous operations  What happens if no async support?  Fake it

20 Blocking Steps Read File Send Data Accept Conn Read Request Find File Send Header end Network Blocking Disk Blocking

21 Overcoming Disk Blocking States Read File Send Data Accept Conn Read Request Find File Send Header end Helper

22 New Architecture - AMPED Helpers are threads or processes Read File Send Data Accept Conn Read Request Find File Send Header Event Dispatcher Asymmetric Multiple Process Event Driven Helper 1Helper 2Helper N

23 Caches in Flash Web Server Read File Send Data Accept Conn Read Request Find File Send Header end Pathname Translation Cache Helper Mapped File Cache Response Header Cache