We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byMicheal Underdown
Modified over 2 years ago
CMPT 401 Dr. Alexandra Fedorova Lecture III: OS Support
2 CMPT 401 © A. Fedorova The Role of the OS The operating system needs to provide support for implementation of distributed systems We will look at how distributed systems services interact with the operating systems We will discuss the support that the operating system needs to provide
3 CMPT 401 © A. Fedorova Direct Interaction with the OS OS Process: a DS component system calls A process directly interacts with the OS via system calls Example: a web browser, a web server
4 CMPT 401 © A. Fedorova Interaction via Middleware Layer OS Process: a DS component system calls Middleware Function calls or IPC A process directly interacts with the OS via a middleware layer A middleware layer directly interacts with the OS Example: a peer-to-peer file system implemented over a distributed hash table
5 CMPT 401 © A. Fedorova Interaction via Inclusion OS DS component A DS component is a part of the operating system, i.e., an operating system daemon Example: Network File System (NFS) daemon Runs as a kernel thread, shares address space with the kernel, interacts with the rest of the OS via function calls Why would one want to build a DS component that interacts with the OS via inclusion?
6 CMPT 401 © A. Fedorova Infrastructure Provided by the OS Networking –Interface to network devices –Implementation of common protocols: TPC, UDP, IP Processes and threads –Efficient scheduling, load balancing and thread switching –Efficient thread synchronization –Efficient inter-process communication (IPC)
7 CMPT 401 © A. Fedorova The Need for Good Process/Thread Support Many distributed applications are implemented using multiple threads or processes Why?
8 CMPT 401 © A. Fedorova Motivation for Multithreaded Designs Servers provide access to large data sets (web servers, e-commerce servers) Even in the presence of caching, they often need to do I/O (to access files on disk or a network FS) I/O takes much longer than computation Overlapping I/O with computation to improve response time Threads make it easy to overlap I/O with computation While one thread blocks on I/O another can perform computation block Single thread time compute Multiple threads 1 request1.6 requests
9 CMPT 401 © A. Fedorova Process or Thread Scheduling Will use “process” and “thread” interchangeably –A single-threaded process maps to a kernel thread –Each thread in a multithreaded process (usually) maps to a kernel thread A scheduler decides which thread runs next on the CPU To ensure good support for DS components, a scheduler must: –Be scalable –Balance the load well –Ensure good interactive response –Keep context switches to a minimum (why?)
10 CMPT 401 © A. Fedorova Case Study: Solaris™ 10 OS Solaris is often used on server systems Known for its good scalability, good load balancing and interactive performance We will look at Solaris runqueues and how they are managed –A runqueue is a scheduling queue –A structure containing pointers to runnable threads – i.e., threads that are waiting for CPU
11 CMPT 401 © A. Fedorova Runqueues in Solaris Global kernel priority queue kpqueue User priority queues for CPU0 disp_q s User priority queues for CPU1 disp_q s …… Pri 0Pri 1Pri NPri 0Pri 1Pri N There is a user-level queue for each priority level A dispatcher runs the thread from the highest-priority non-empty queue
12 CMPT 401 © A. Fedorova Processor Load Balancing Load balancing ensures that the load is evenly distributed among the CPUs on a multiprocessor This improves the overall response time Solaris kernel ensures that queues are well balanced when it enqueues a thread into a runqueue /* * setbackdq() keeps runqs balanced such that the difference in length * between the chosen runq and the next one is no more than RUNQ_MAX_DIFF. * (…) */ A comment from Solaris source code. Source: line 1200
13 CMPT 401 © A. Fedorova Tuning Thread Priorities For Improved Response Time If a thread has waited too long for a processor, its priority is elevated, so no thread is starved Threads holding critical resources are put to the front of the queue so that they release those resources as quickly as possible /* * Put the specified thread on the front of the dispatcher * queue corresponding to its current priority. * * Called with the thread in transition, onproc or stopped state * and locked (transition implies locked) and at high spl. * Returns with the thread in TS_RUN state and still locked. */ A comment on setfrontdq from Solaris source code. Source: line 1381
14 CMPT 401 © A. Fedorova Ensuring Good Responsiveness in Time- Sharing Scheduler Solaris’s time-sharing scheduler (the default scheduler) assigns priorities so as to ensure good interactive performance Timeslice: the amount of time a thread can run on CPU before it is pre-empted If thread T used up it’s entire timeslice on CPU: –priority(T)↓, timeslice(T)↑ If thread T has given up CPU before using up its timeslice: –priority(T) ↑, timeslice (T) ↓ Why is this done?
15 CMPT 401 © A. Fedorova Time-Sharing Scheduler: Answers Minimizing context switch costs: –CPU-bound threads stay on CPU longer without a context switch –In compensation, they are scheduled less often, due to decreased priority –Reducing the number of context switches improves performance Ensuring good response for interactive applications –Interactive applications usually don’t use up their entire timeslice –Example: process a network message and release the CPU before the timeslice expires –Those applications will have their priority elevated, so they will respond quickly when response is needed (e.g., the next network packet arrives)
16 CMPT 401 © A. Fedorova What Limits Performance of MP/MT Applications? The cost of context switching – depends on the hardware; the OS cannot fix it alone –Save/restore the registers –Flush the CPU pipeline –If switching address spaces May need to flush the TLB (depends on the processor) May need to flush the cache (depends on the processor) The cost of inter-process communication(IPC): requires context switching The cost of inter-thread synchronization – by and large depends on the program structure; OS can fix some of it, but not all
17 CMPT 401 © A. Fedorova Thread Synchronization If lock is not available, threads wait Execution becomes serialized
18 CMPT 401 © A. Fedorova Next… Talk about synchronization Operating system support for efficient synchronization Transactional memory – new programming paradigm for efficient synchronization
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture III: OS Support.
CMPT 431 Dr. Alexandra Fedorova Lecture III: OS Support.
Chapter 4 1 Threads Threads are a subdivision of processes Since there is less information associated with a thread than there is info associated with.
1 Process Description and Control Chapter 2. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
OPERATING SYSTEM SUPPORT 1 From Chapter 6 of Distributed Systems Concepts and Design,4 th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published.
Multiple Processor Systems Bits of Chapters 4, 10, 16 Operating Systems: Internals and Design Principles, 6/E William Stallings.
Processes Management. 3.2 Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Process Management A process is a program.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Operating Systems Chapter 6. Main functions of an operating system 1. User/computer interface: Provides an interface between the user and the computer.
Chapter 3 1 Process Description and Control Chapter 3.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania Fall 2003 Lecture Note 1: Introduction.
Multiple Processor Systems I CS 423 Klara Nahrstedt/Sam King 10/11/20141.
Revision CS3008 Operating Systems. Three Main Areas Process Management Memory Management I/O Management Virtual MemoryFile Systems Device Driver Terminals.
1 Operating Systems Chapter 6. 2 What is an operating system? A program that runs on the hardware and supports Resource Abstraction Resource Sharing Abstracts.
Operating Systems Part I: Introduction. “I think that there is a world market for five computers” - Thomas J. Watson (1945)
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 26: Advanced.
1 Chapter 6 Operating Systems. 2 Learning outcomes Describe the functions of the Operating System and its components. Explain where the operating system.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 3: Processes.
Operating Systems: Processes & CPU Scheduling Pål Halvorsen 15/ INF1060: Introduction to Operating Systems and Data Communication.
Processes. 1/19/ Processes Modern systems can have many operations occurring at the same time. Most applications require one or more processes to.
Design and Implementation Issues Today Design issues for paging systems Implementation issues Segmentation Next I/O.
1 Operating System Architecture and Distributed Systems Most concepts are drawn from Chapter 6 © Pearson Education Dr. Rajkumar Buyya Cloud Computing and.
Linux: The Guts By Sam Evans and John Massey. History Of Linux ❖ 1984: Richard Stallman quits his job at MIT, and starts working on the GNU project. ❖
Multiprocessing and NUMA. What we sort of assumed so far… Northbridge connects CPU and memory to rest of system – Memory controller implemented in Northbridge.
Adapted from the slides prepared by Alan Feuer Some material from Operating System Concepts by Silberschatz et. al. and Modern Operating Systems by Tanenbaum.
Mr. Deven Patel, AITS, Rajkot. 1 Process Description and Control Chapter 3.
The Client/Server Database Environment CS263 Lecture 12.
Advanced Operating Systems Prof. Muhammad Saeed. February 11, 2014Advanced Operating Systems2 The part of the operating system that makes the choice of.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts Chapter 18: Database System Architectures Centralized Systems Client--Server Systems Parallel.
© 2016 SlidePlayer.com Inc. All rights reserved.