Servers: Concurrency and Performance. Jeff Chase Duke University
|
|
- Amanda Briggs
- 6 years ago
- Views:
Transcription
1 Servers: Concurrency and Performance Jeff Chase Duke University
2 HTTP Server HTTP Server Creates a socket (socket) Binds to an address Listens to setup accept backlog Can call accept to block waiting for connections (Can call select to check for data on multiple socks) Handle request GET /index.html HTTP/1.0\n <optional body, multiple lines>\n \n
3 Inside your server packet queues Server application (Apache, Tomcat/Java, etc) accept queue Measures offered load response time throughput utilization listen queue
4 Example: Video On Demand Client() { fd = connect( server ); write (fd, video.mpg ); while (!eof(fd)) { read (fd, buf); display (buf); Server() { while (1) { cfd = accept(); read (cfd, name); fd = open (name); while (!eof(fd)) { read(fd, block); write (cfd, block); close (cfd); close (fd); How many clients can the server support? Suppose, say, 200 kb/s video on a 100 Mb/s network link? [MIT/Morris]
5 Performance analysis Server capacity: Network (100 Mbit/s) Disk(20 Mbyte/s) Obtained performance: one client stream Server is limited by software structure If a video is 200 Kbit/s, server should be able to support more than one client. 500? [MIT/Morris]
6 WebServer Flow Create ServerSocket TCP socket space connsocket = accept() read request from connsocket read local file write file to connsocket state: listening address: {*.6789, *.* completed connection queue: sendbuf: recvbuf: state: established address: { :6789, sendbuf: recvbuf: state: listening address: {*.25, *.* completed connection queue: sendbuf: recvbuf: close connsocket Discussion: what does step do and how long does it take?
7 Web Server Processing Steps Accept Client Connection may block waiting on network Read HTTP Request Header Find File may block waiting on disk I/O Send HTTP Response Header Read File Send Data Want to be able to process requests concurrently.
8 Process States and Transitions running (user) interrupt, exception trap/return Sleep running (kernel) Run Yield blocked Wakeup ready
9 Server Blocking accept() when no connect requests are waiting on the listen queue What if server has multiple ports to listen from? E.g., 80 for HTTP, 443 for HTTPS open/read/write on server files read() on a socket, if the client is sending too slowly write() on socket, if the client is receiving too slowly Yup, TCP has flow control like pipes What if the server blocks while serving one client, and another client has work to do?
10 Under the Hood start (arrival rate λ) CPU I/O completion I/O request I/O device exit (throughput λ until some center saturates)
11 Concurrency and Pipelining CPU DISK Before NET CPU DISK NET After
12 Better single-server performance Goal: run at server s hardware speed Disk or network should be bottleneck Method: Pipeline blocks of each request Multiplex requests from multiple clients Two implementation approaches: Multithreaded server Asynchronous I/O [MIT/Morris]
13 Concurrent threads or processes Using multiple threads/processes so that only the flow processing a particular request is blocked Java: extends Thread or implements Runnable interface Example: a Multi-threaded WebServer, which creates a thread for each request
14 Multiple Process Architecture Process 1 Accept Conn Read Request Find File Send Header Read File Send Data separate address spaces Process N Accept Conn Read Request Find File Send Header Read File Send Data Advantages Simple programming while addressing blocking issue Disadvantages Many processes; large context switch overheads Consumes much memory Optimizations involving sharing information among processes (e.g., caching) harder
15 Using Threads Thread 1 Accept Conn Read Request Find File Send Header Read File Send Data Thread N Accept Conn Read Request Find File Send Header Read File Send Data Advantages Lower context switch overheads Shared address space simplifies optimizations (e.g., caches) Disadvantages Need kernel level threads (why?) Some extra memory needed to support multiple stacks Need thread-safe programs, synchronization
16 Threads A thread is a schedulable stream of control. defined by CPU register values (PC, SP) suspend: save register values in memory resume: restore registers from memory Multiple threads can execute independently: They can run in parallel on multiple CPUs... - physical concurrency or arbitrarily interleaved on a single CPU. - logical concurrency Each thread must have its own stack.
17 Multithreaded server server() { while (1) { cfd = accept(); read (cfd, name); fd = open (name); while (!eof(fd)) { read(fd, block); write (cfd, block); close (cfd); close (fd); for (i = 0; i < 10; i++) threadfork (server); When waiting for I/O, thread scheduler runs another thread What about references to shared data? Synchronization [MIT/Morris]
18 Event-Driven Programming One execution stream: no CPU concurrency. Register interest in events (callbacks). Event loop waits for events, invokes handlers. No preemption of event handlers. Handlers generally shortlived. Event Loop Event Handlers [Ousterhout 1995]
19 Single Process Event Driven (SPED) Accept Conn Read Request Find File Send Header Read File Send Data Event Dispatcher Single threaded Asynchronous (non-blocking) I/O Advantages Single address space No synchronization Disadvantages In practice, disk reads still block
20 Asynchronous Multi-Process Event Driven (AMPED) Accept Conn Read Request Find File Send Header Read File Send Data Event Dispatcher Helper 1 Helper 1 Helper 1 Like SPED, but use helper processes/thread for disk I/O Use IPC to communicate with helper process Advantages Shared address space for most web server functions Concurrency for disk I/O Disadvantages IPC between main thread and helper threads This hybrid model is used by the Flash web server.
21 Event-Based Concurrent Servers Using I/O Multiplexing Maintain a pool of connected descriptors. Repeat the following forever: Use the Unix select function to block until: (a) New connection request arrives on the listening descriptor. (b) New data arrives on an existing connected descriptor. If (a), add the new connection to the pool of connections. If (b), read any available data from the connection Close connection on EOF and remove it from the pool. [CMU ]
22 Select If a server has many open sockets, how does it know when one of them is ready for I/O? int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); Issues with scalability: alternative event interfaces have been offered.
23 Asynchronous I/O struct callback { bool (*is_ready)(); void (*cb)(arg); void *arg; main() { while (1) { for (c = each callback) { if (c->is_ready()) c->handler(c->arg); Code is structured as a collection of handlers Handlers are nonblocking Create new handlers for blocking operations When operation completes, call handler [MIT/Morris]
24 Asychronous server init() { on_accept(accept_cb); accept_cb() { on_readable(cfd,name_cb); on_readable(fd, fn) { c = new callback(test_readable, fn, fd); add c to callback list; name_cb(cfd) { read(cfd,name); fd = open(name); on_readable(fd, read_cb); read_cb(cfd, fd) { read(fd, block); on_writeeable(fd, write_cb); write_cb(cfd, fd) { write(cfd, block); on_readable(fd, read_cb); [MIT/Morris]
25 Multithreaded vs. Async Hard to program Locking code Need to know what blocks Coordination explicit State stored on thread s stack Memory allocation implicit Context switch may be expensive Multiprocessors Hard to program Callback code Need to know what blocks Coordination implicit State passed around explicitly Memory allocation explicit Lightweight context switch Uniprocessors [MIT/Morris]
26 Coordination example Threaded server: Thread for network interface Interrupt wakes up network thread Protected (locks and conditional variables) shared buffer shared between server threads and network thread Asynchronous I/O Poll for packets How often to poll? Or, interrupt generates an event Be careful: disable interrupts when manipulating callback queue. [MIT/Morris]
27 One View Threads!
28 Should You Abandon Threads? No: important for high-end servers (e.g. databases). But, avoid threads wherever possible: Use events, not threads, for GUIs, distributed systems, low-end servers. Only use threads where true CPU concurrency is needed. Where threads needed, isolate usage in threaded application kernel: keep most of code single-threaded. Event-Driven Handlers Threaded Kernel [Ousterhout 1995]
29 Another view Events obscure control flow For programmers and tools Web Server Threads thread_main(int sock) { struct session s; accept_conn(sock, &s); read_request(&s); pin_cache(&s); write_response(&s); unpin(&s); pin_cache(struct session *s) { pin(&s); if(!in_cache(&s) ) read_file(&s); Events AcceptHandler(event e) { struct session *s = new_session(e); RequestHandler.enqueue(s); RequestHandler(struct session *s) { ; CacheHandler.enqueue(s); CacheHandler(struct session *s) { pin(s); if(!in_cache(s) ) ReadFileHandler.enqueue(s); else ResponseHandler.enqueue(s);... ExitHandlerr(struct session *s) { ; unpin(&s); free_session(s); Accept Conn. Read Request Pin Cache Write Response Exit Read File [von Behren]
30 Control Flow Events obscure control flow For programmers and tools Web Server Threads Events Accept Conn. thread_main(int sock) { struct session s; accept_conn(sock, &s); read_request(&s); pin_cache(&s); write_response(&s); unpin(&s); pin_cache(struct session *s) { pin(&s); if(!in_cache(&s) ) read_file(&s); CacheHandler(struct session *s) { pin(s); if(!in_cache(s) ) ReadFileHandler.enqueue(s); else ResponseHandler.enqueue(s); RequestHandler(struct session *s) { ; CacheHandler.enqueue(s);... ExitHandlerr(struct session *s) { ; unpin(&s); free_session(s); AcceptHandler(event e) { struct session *s = new_session(e); RequestHandler.enqueue(s); Read Request Pin Cache Write Response Exit [von Behren] Read File
31 Exceptions Exceptions complicate control flow Harder to understand program flow Cause bugs in cleanup code Web Server Threads Events Accept Conn. thread_main(int sock) { struct session s; accept_conn(sock, &s); if(!read_request(&s) ) return; pin_cache(&s); write_response(&s); unpin(&s); pin_cache(struct session *s) { pin(&s); if(!in_cache(&s) ) read_file(&s); CacheHandler(struct session *s) { pin(s); if(!in_cache(s) ) ReadFileHandler.enqueue(s); else ResponseHandler.enqueue(s); RequestHandler(struct session *s) { ; if( error ) return; CacheHandler.enqueue(s);... ExitHandlerr(struct session *s) { ; unpin(&s); free_session(s); AcceptHandler(event e) { struct session *s = new_session(e); RequestHandler.enqueue(s); Read Request Pin Cache Write Response Exit [von Behren] Read File
32 State Management Events require manual state management Hard to know when to free Use GC or risk bugs Web Server Threads Events Accept Conn. thread_main(int sock) { struct session s; accept_conn(sock, &s); if(!read_request(&s) ) return; pin_cache(&s); write_response(&s); unpin(&s); pin_cache(struct session *s) { pin(&s); if(!in_cache(&s) ) read_file(&s); CacheHandler(struct session *s) { pin(s); if(!in_cache(s) ) ReadFileHandler.enqueue(s); else ResponseHandler.enqueue(s); RequestHandler(struct session *s) { ; if( error ) return; CacheHandler.enqueue(s);... ExitHandlerr(struct session *s) { ; unpin(&s); free_session(s); AcceptHandler(event e) { struct session *s = new_session(e); RequestHandler.enqueue(s); Read Request Pin Cache Write Response Exit [von Behren] Read File
33 Thread 1 Accept Conn Read Request Find File Send Header Read File Send Data Thread N Accept Conn Read Request Find File Send Header Read File Send Data
34 Internet Growth and Scale The Internet How to handle all those client requests raining on your server?
35 Servers Under Stress Ideal Performance Peak: some resource at max Overload: some resource thrashing Load (concurrent requests, or arrival rate) [Von Behren]
36 Response Time Components Wire time + Queuing time + Service demand + Wire time (response) Depends on Cost/length of request Load conditions at server latency offered load
37 Queuing Theory for Busy People offered load request arrival rate λ wait here M/M/1 Service Center Process for mean service demand D Big Assumptions Queue is First-Come-First-Served (FIFO, FCFS). Request arrivals are independent (poisson arrivals). Requests have independent service demands. i.e., arrival interval and service demand are exponentially distributed (noted as M ).
38 Utilization What is the probability that the center is busy? Answer: some number between 0 and 1. What percentage of the time is the center busy? Answer: some number between 0 and 100 These are interchangeable: called utilization U If the center is not saturated, i.e., it completes all its requests in some bounded time, then: U = λd = (arrivals/t * service demand) Utilization Law The probability that the service center is idle is 1-U.
39 Little s Law For an unsaturated queue in steady state, mean response time R and mean queue length N are governed by: Little s Law: N = λr Suppose a task T is in the system for R time units. During that time: λr new tasks arrive. N tasks depart (all tasks ahead of T). But in steady state, the flow in balances flow out. Note: this means that throughput X = λ.
40 Inverse Idle Time Law R Service center saturates as 1/ λ approaches D: small increases in λ cause large increases in the expected response time R. U 1(100%) Little s Law gives response time R = D/(1 - U). Intuitively, each task T s response time R = D + DN. Substituting λr for N: R = D + D λr Substituting U for λd: R = D + UR R - UR = D --> R(1 - U) = D --> R = D/(1 - U)
41 What does this tell us about server behavior at saturation?
42 Under the Hood start (arrival rate λ) CPU I/O completion I/O request I/O device exit (throughput λ until some center saturates)
43 Common Bottlenecks No more File Descriptors Sockets stuck in TIME_WAIT High Memory Use (swapping) CPU Overload Interrupt (IRQ) Overload [Aaron Bannert]
44 Scaling Server Sites: Clustering Clients L4: TCP L7: HTTP SSL etc. virtual IP addresses (VIPs) smart switch server array Goals server load balancing failure detection access control filtering priorities/qos request locality transparent caching What to switch/filter on? L3 source IP and/or VIP L4 (TCP) ports etc. L7 URLs and/or cookies L7 SSL session IDs
45 Scaling Services: Replication Site A Site B Distribute service load across multiple sites. How to select a server site for each client or request? Is it scalable?? Internet Client
46 Extra Slides (Any new information on the following slides will not be tested.)
47 Event-Based Concurrent Servers Using I/O Multiplexing Maintain a pool of connected descriptors. Repeat the following forever: Use the Unix select function to block until: (a) New connection request arrives on the listening descriptor. (b) New data arrives on an existing connected descriptor. If (a), add the new connection to the pool of connections. If (b), read any available data from the connection Close connection on EOF and remove it from the pool. [CMU ]
48 Problems of Multi-Thread Server High resource usage, context switch overhead, contended locks Too many threads throughput meltdown, response time explosion Solution: bound total number of threads
49 Event-Driven Programming Event-driven programming, also called asynchronous i/o Using Finite State Machines (FSM) to monitor the progress of requests Yields efficient and scalable concurrency Many examples: Click router, Flash web server, TP Monitors, etc. Java: asynchronous i/o for an example see:
50 Traditional Processes Expensive and heavyweight One system call per process Fork overhead Coordination
51 Events Need async I/O Need select Wasn t originally available Not standardized Immature But efficient Code is distributed all through the program Harder to debug and understand
52 Threads Separate interface and implementation Pthreads interface Implementation is user-level or kernel (native) If user-level, needs async I/O But hide the abstraction behind the thread interface
53 Reference The State of the Art in Locally Distributed Webserver Systems Valeria Cardellini, Emiliano Casalicchio, Michele Colajanni and Philip S. Yu
CSCI-1680 Network Programming II. Rodrigo Fonseca
CSCI-1680 Network Programming II Rodrigo Fonseca Today Network programming Programming Paradigms Programming libraries Final project Low-level Sockets Address Family AF_PACKET Socket type: SOCK_RAW See
More informationCISC2200 Threads Spring 2015
CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates
More informationPROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8
PROCESSES AND THREADS THREADING MODELS CS124 Operating Systems Winter 2016-2017, Lecture 8 2 Processes and Threads As previously described, processes have one sequential thread of execution Increasingly,
More informationI/O Models. Kartik Gopalan
I/O Models Kartik Gopalan Types of Concurrency True Concurrency (multiple processes or threads) Multi-processor machines Child processes/threads execute in parallel. Multi-process (forking) servers If
More informationAssignment 2 Group 5 Simon Gerber Systems Group Dept. Computer Science ETH Zurich - Switzerland
Assignment 2 Group 5 Simon Gerber Systems Group Dept. Computer Science ETH Zurich - Switzerland t Your task Write a simple file server Client has to be implemented in Java Server has to be implemented
More informationException-Less System Calls for Event-Driven Servers
Exception-Less System Calls for Event-Driven Servers Livio Soares and Michael Stumm University of Toronto Talk overview At OSDI'10: exception-less system calls Technique targeted at highly threaded servers
More informationAsynchronous Events on Linux
Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),
More informationChapter 8: I/O functions & socket options
Chapter 8: I/O functions & socket options 8.1 Introduction I/O Models In general, there are normally two phases for an input operation: 1) Waiting for the data to arrive on the network. When the packet
More informationCS118 Discussion Week 2. Taqi
CS118 Discussion Week 2 Taqi Outline Any Questions for Course Project 1? Socket Programming: Non-blocking mode Lecture Review: Application Layer Much of the other related stuff we will only discuss during
More informationFlash: an efficient and portable web server
Flash: an efficient and portable web server High Level Ideas Server performance has several dimensions Lots of different choices on how to express and effect concurrency in a program Paper argues that
More informationSMD149 - Operating Systems
SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program
More informationOperating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering
Operating System Chapter 4. Threads Lynn Choi School of Electrical Engineering Process Characteristics Resource ownership Includes a virtual address space (process image) Ownership of resources including
More informationCOMP/ELEC 429/556 Introduction to Computer Networks
COMP/ELEC 429/556 Introduction to Computer Networks Creating a Network Application Some slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang 1 How to Programmatically
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Fall 2015 Lecture 4: Threads Geoffrey M. Voelker Announcements Project 0 due Project 1 out October 6, 2015 CSE 120 Lecture 4 Threads 2 Processes Recall that a process
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance I/O Hardware Incredible variety of I/O devices Common
More informationOperating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester
Operating System: Chap13 I/O Systems National Tsing-Hua University 2016, Fall Semester Outline Overview I/O Hardware I/O Methods Kernel I/O Subsystem Performance Application Interface Operating System
More informationLecture 15: I/O Devices & Drivers
CS 422/522 Design & Implementation of Operating Systems Lecture 15: I/O Devices & Drivers Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken from previous versions
More informationAgenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008
Agenda Threads CSCI 444/544 Operating Systems Fall 2008 Thread concept Thread vs process Thread implementation - user-level - kernel-level - hybrid Inter-process (inter-thread) communication What is Thread
More informationProcesses and Non-Preemptive Scheduling. Otto J. Anshus
Processes and Non-Preemptive Scheduling Otto J. Anshus Threads Processes Processes Kernel An aside on concurrency Timing and sequence of events are key concurrency issues We will study classical OS concurrency
More informationModule 12: I/O Systems
Module 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Performance Operating System Concepts 12.1 Silberschatz and Galvin c
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution
More informationJAVA CONCURRENCY FRAMEWORK. Kaushik Kanetkar
JAVA CONCURRENCY FRAMEWORK Kaushik Kanetkar Old days One CPU, executing one single program at a time No overlap of work/processes Lots of slack time CPU not completely utilized What is Concurrency Concurrency
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Spring 2009 Lecture 4: Threads Geoffrey M. Voelker Announcements Homework #1 due now Project 0 due tonight Project 1 out April 9, 2009 CSE 120 Lecture 4 Threads
More informationDevice-Functionality Progression
Chapter 12: I/O Systems I/O Hardware I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Incredible variety of I/O devices Common concepts Port
More informationChapter 12: I/O Systems. I/O Hardware
Chapter 12: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations I/O Hardware Incredible variety of I/O devices Common concepts Port
More informationThreads and Too Much Milk! CS439: Principles of Computer Systems January 31, 2018
Threads and Too Much Milk! CS439: Principles of Computer Systems January 31, 2018 Last Time CPU Scheduling discussed the possible policies the scheduler may use to choose the next process (or thread!)
More informationCSci 4061 Introduction to Operating Systems. (Thread-Basics)
CSci 4061 Introduction to Operating Systems (Thread-Basics) Threads Abstraction: for an executing instruction stream Threads exist within a process and share its resources (i.e. memory) But, thread has
More informationCSE 153 Design of Operating Systems Fall 2018
CSE 153 Design of Operating Systems Fall 2018 Lecture 4: Processes (2) Threads Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates and initializes a new PCB Creates
More informationOperating Systems 2 nd semester 2016/2017. Chapter 4: Threads
Operating Systems 2 nd semester 2016/2017 Chapter 4: Threads Mohamed B. Abubaker Palestine Technical College Deir El-Balah Note: Adapted from the resources of textbox Operating System Concepts, 9 th edition
More informationby I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS
by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests
More informationProcess Description and Control
Process Description and Control 1 Process:the concept Process = a program in execution Example processes: OS kernel OS shell Program executing after compilation www-browser Process management by OS : Allocate
More informationIntroduction to Asynchronous Programming Fall 2014
CS168 Computer Networks Fonseca Introduction to Asynchronous Programming Fall 2014 Contents 1 Introduction 1 2 The Models 1 3 The Motivation 3 4 Event-Driven Programming 4 5 select() to the rescue 5 1
More informationCPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.
CPSC/ECE 3220 Fall 2017 Exam 1 Name: 1. Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.) Referee / Illusionist / Glue. Circle only one of R, I, or G.
More informationBackground: I/O Concurrency
Background: I/O Concurrency Brad Karp UCL Computer Science CS GZ03 / M030 5 th October 2011 Outline Worse Is Better and Distributed Systems Problem: Naïve single-process server leaves system resources
More informationCS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017
CS 471 Operating Systems Yue Cheng George Mason University Fall 2017 Outline o Process concept o Process creation o Process states and scheduling o Preemption and context switch o Inter-process communication
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin
More informationProcess- Concept &Process Scheduling OPERATING SYSTEMS
OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple
More informationA Scalable Event Dispatching Library for Linux Network Servers
A Scalable Event Dispatching Library for Linux Network Servers Hao-Ran Liu and Tien-Fu Chen Dept. of CSIE National Chung Cheng University Traditional server: Multiple Process (MP) server A dedicated process
More informationProcess Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey
CSC400 - Operating Systems 3. Process Concepts J. Sumey Overview Concurrency Processes & Process States Process Accounting Interrupts & Interrupt Processing Interprocess Communication CSC400 - Process
More informationCS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University
CS 555: DISTRIBUTED SYSTEMS [THREADS] Shrideep Pallickara Computer Science Colorado State University Frequently asked questions from the previous class survey Shuffle less/shuffle better Which actions?
More informationSilberschatz and Galvin Chapter 12
Silberschatz and Galvin Chapter 12 I/O Systems CPSC 410--Richard Furuta 3/19/99 1 Topic overview I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O requests to hardware operations
More informationProcesses and Threads
TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Processes and Threads [SGG7] Chapters 3 and 4 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin
More informationIsoStack Highly Efficient Network Processing on Dedicated Cores
IsoStack Highly Efficient Network Processing on Dedicated Cores Leah Shalev Eran Borovik, Julian Satran, Muli Ben-Yehuda Outline Motivation IsoStack architecture Prototype TCP/IP over 10GE on a single
More informationYi Shi Fall 2017 Xi an Jiaotong University
Threads Yi Shi Fall 2017 Xi an Jiaotong University Goals for Today Case for Threads Thread details Case for Parallelism main() read_data() for(all data) compute(); write_data(); endfor main() read_data()
More informationModule 12: I/O Systems
Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Performance 12.1 I/O Hardware Incredible variety of I/O devices Common
More informationAnswer to exercises chap 13.2
Answer to exercises chap 13.2 The advantage of supporting memory-mapped I/O to device-control registers is that it eliminates the need for special I/O instructions from the instruction set and therefore
More informationNotes based on prof. Morris's lecture on scheduling (6.824, fall'02).
Scheduling Required reading: Eliminating receive livelock Notes based on prof. Morris's lecture on scheduling (6.824, fall'02). Overview What is scheduling? The OS policies and mechanisms to allocates
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance Objectives Explore the structure of an operating
More informationThreads and Too Much Milk! CS439: Principles of Computer Systems February 6, 2019
Threads and Too Much Milk! CS439: Principles of Computer Systems February 6, 2019 Bringing It Together OS has three hats: What are they? Processes help with one? two? three? of those hats OS protects itself
More informationComparing the Performance of Web Server Architectures
Comparing the Performance of Web Server Architectures David Pariag, Tim Brecht, Ashif Harji, Peter Buhr, and Amol Shukla David R. Cheriton School of Computer Science University of Waterloo, Waterloo, Ontario,
More informationLecture 4: Threads; weaving control flow
Lecture 4: Threads; weaving control flow CSE 120: Principles of Operating Systems Alex C. Snoeren HW 1 Due NOW Announcements Homework #1 due now Project 0 due tonight Project groups Please send project
More informationChapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues
Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues 4.2 Silberschatz, Galvin
More informationPrepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University
EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run
More information! How is a thread different from a process? ! Why are threads useful? ! How can POSIX threads be useful?
Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads! How is a thread different from a process?! Why are threads useful?! How can OSIX threads be useful?! What are user-level and kernel-level
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 Lecture 8 Threads and Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many threads
More informationCS5460: Operating Systems
CS5460: Operating Systems Lecture 5: Processes and Threads (Chapters 3-4) Context Switch Results lab2-15 gamow home 3.8 us 1.6 us 1.0 us VirtualBox on lab2-25 VirtualBox on gamow VirtualBox on home 170
More informationProcess. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.
EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs
More information!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful?
Chapter 2: Threads: Questions CSCI [4 6]730 Operating Systems Threads!! How is a thread different from a process?!! Why are threads useful?!! How can OSIX threads be useful?!! What are user-level and kernel-level
More informationCS333 Intro to Operating Systems. Jonathan Walpole
CS333 Intro to Operating Systems Jonathan Walpole Threads & Concurrency 2 Threads Processes have the following components: - an address space - a collection of operating system state - a CPU context or
More informationLast class: Today: Thread Background. Thread Systems
1 Last class: Thread Background Today: Thread Systems 2 Threading Systems 3 What kind of problems would you solve with threads? Imagine you are building a web server You could allocate a pool of threads,
More informationCHAPTER 2: PROCESS MANAGEMENT
1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:
More informationProcess! Process Creation / Termination! Process Transitions in" the Two-State Process Model! A Two-State Process Model!
Process! Process Creation / Termination!!! A process (sometimes called a task, or a job) is a program in execution"!! Process is not the same as program "!! We distinguish between a passive program stored
More informationCOMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.
COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr. Kamran Sartipi Name: Student ID: Question 1 (Disk Block Allocation):
More informationLecture 2 Process Management
Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Fall 2000 Lecture 5: Threads Geoffrey M. Voelker Processes Recall that a process includes many things An address space (defining all the code and data pages) OS
More informationCSE 333 Lecture fork, pthread_create, select
CSE 333 Lecture 22 -- fork, pthread_create, select Steve Gribble Department of Computer Science & Engineering University of Washington Administrivia HW4 out on Monday - you re gonna love it Final exam
More informationOPERATING SYSTEM. Chapter 4: Threads
OPERATING SYSTEM Chapter 4: Threads Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples Objectives To
More informationCONCURRENCY MODEL. UNIX Programming 2014 Fall by Euiseong Seo
CONCURRENCY MODEL UNIX Programming 2014 Fall by Euiseong Seo Echo Server Revisited int main (int argc, char *argv[]) {... listenfd = socket(af_inet, SOCK_STREAM, 0); bzero((char *)&saddr, sizeof(saddr));
More informationCS350: Final Exam Review
University of Waterloo CS350: Final Exam Review Gwynneth Leece, Andrew Song, Rebecca Putinski Winter, 2010 Intro, Threads & Concurrency What are the three views of an operating system? Describe them. Define
More informationCS631 - Advanced Programming in the UNIX Environment Interprocess Communication II
CS631 - Advanced Programming in the UNIX Environment Slide 1 CS631 - Advanced Programming in the UNIX Environment Interprocess Communication II Department of Computer Science Stevens Institute of Technology
More informationCapriccio : Scalable Threads for Internet Services
Capriccio : Scalable Threads for Internet Services - Ron von Behren &et al - University of California, Berkeley. Presented By: Rajesh Subbiah Background Each incoming request is dispatched to a separate
More informationProblem Set: Processes
Lecture Notes on Operating Systems Problem Set: Processes 1. Answer yes/no, and provide a brief explanation. (a) Can two processes be concurrently executing the same program executable? (b) Can two running
More informationProcesses. CS 475, Spring 2018 Concurrent & Distributed Systems
Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1
More informationCS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio
CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Fall 2017 1 Outline Inter-Process Communication (20) Threads
More informationCS420: Operating Systems
Threads James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Threads A thread is a basic unit of processing
More informationProcesses Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.
Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program
More informationSEDA: An Architecture for Well-Conditioned, Scalable Internet Services
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University of California, Berkeley Operating Systems Principles
More informationPart I: Communication and Networking
Review what we learned Part I: Communication and Networking Communication and Networking: Week 5-6, Lectures 2-7 Lecture 1 OSI vs TCP/IP model OSI model Protocols TCP/IP model Application FTP SMTP HTTP
More informationMain Points of the Computer Organization and System Software Module
Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a
More informationChapter 4: Multi-Threaded Programming
Chapter 4: Multi-Threaded Programming Chapter 4: Threads 4.1 Overview 4.2 Multicore Programming 4.3 Multithreading Models 4.4 Thread Libraries Pthreads Win32 Threads Java Threads 4.5 Implicit Threading
More informationWeb Client And Server
Web Client And Server Project Part A Overview In this part of the project, you and your partner will build a simple web client and a succession of servers to which it can connect. The goal is to slowly
More informationTechno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:
Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)
More informationOperating Systems. Review ENCE 360
Operating Systems Review ENCE 360 High level Concepts What are three conceptual pieces fundamental to operating systems? High level Concepts What are three conceptual pieces fundamental to operating systems?
More informationChapter 13: I/O Systems
Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin
More informationChapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)
Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin
More informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 6: Threads Recap: Process Components Per- Process State Per- Thread State A process is named using its process ID (PID) A process contains all of
More informationChapter 4: Threads. Chapter 4: Threads
Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples
More informationCSI3131 Final Exam Review
CSI3131 Final Exam Review Final Exam: When: April 24, 2015 2:00 PM Where: SMD 425 File Systems I/O Hard Drive Virtual Memory Swap Memory Storage and I/O Introduction CSI3131 Topics Process Computing Systems
More informationCS370 Operating Systems Midterm Review
CS370 Operating Systems Midterm Review Yashwant K Malaiya Fall 2015 Slides based on Text by Silberschatz, Galvin, Gagne 1 1 What is an Operating System? An OS is a program that acts an intermediary between
More informationToday s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1
Today s class Scheduling Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1 Aim of Scheduling Assign processes to be executed by the processor(s) Need to meet system objectives regarding:
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2018 Lecture 5: Thread Ryan Huang Slides adapted from Geoff Voelker s and David Mazières lectures Administrivia Lab 0 grading in progress Lab 1 review session
More informationThreads. Computer Systems. 5/12/2009 cse threads Perkins, DW Johnson and University of Washington 1
Threads CSE 410, Spring 2009 Computer Systems http://www.cs.washington.edu/410 5/12/2009 cse410-20-threads 2006-09 Perkins, DW Johnson and University of Washington 1 Reading and References Reading» Read
More information3.1 Introduction. Computers perform operations concurrently
PROCESS CONCEPTS 1 3.1 Introduction Computers perform operations concurrently For example, compiling a program, sending a file to a printer, rendering a Web page, playing music and receiving e-mail Processes
More informationApplications, services. Middleware. OS2 Processes, threads, Processes, threads, communication,... communication,... Platform
Operating System Support Introduction Distributed systems act as resource managers for the underlying hardware, allowing users access to memory, storage, CPUs, peripheral devices, and the network Much
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2017 Lecture 5: Thread Ryan Huang Administrivia HW1 solution released on Piazza resources Lab 0 grading - In progress - Cheating policy Lab 1 review session
More informationDr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year
Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Operating System Sem.-II 1.What is operating system? a)
More informationADVANCED OPERATING SYSTEMS
ADVANCED OPERATING SYSTEMS UNIT 2 FILE AND DIRECTORY I/O BY MR.PRASAD SAWANT Prof.Prasad Sawant,Assitiant Professor,Dept. Of CS PCCCS Chichwad Prof.Prasad Sawant,Assitiant Professor,Dept. Of CS PCCCS Chichwad
More informationCPS 214: Computer Networks. Slides by Adolfo Rodriguez
CPS 214: Computer Networks Slides by Adolfo Rodriguez Paper Evaluations 1 page maximum evaluation of reading for each class Evaluations submitted in advance of class from course Web page Describe: Biggest
More informationChapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads
Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Objectives To introduce the notion of a
More information