Fast Communication and User Level Parallelism

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

Operating Systems: Internals and Design Principles
Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
User-Level Interprocess Communication for Shared Memory Multiprocessors Bershad, B. N., Anderson, T. E., Lazowska, E.D., and Levy, H. M. Presented by Akbar.
CS 5204 – Operating Systems 1 Scheduler Activations.
Fast Communication Firefly RPC Lightweight RPC  CS 614  Tuesday March 13, 2001  Jeff Hoy.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
SCHEDULER ACTIVATIONS Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska, Henry.
CS533 Concepts of Operating Systems Class 8 Shared Memory Implementations of Remote Procedure Call.
User Level Interprocess Communication for Shared Memory Multiprocessor by Bershad, B.N. Anderson, A.E., Lazowska, E.D., and Levy, H.M.
CS533 Concepts of Operating Systems Class 4 Remote Procedure Call.
Scheduler Activations Effective Kernel Support for the User-Level Management of Parallelism.
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, Henry M. Levy ACM Transactions Vol. 8, No. 1, February 1990,
3.5 Interprocess Communication
1 Chapter 4 Threads Threads: Resource ownership and execution.
Threads, SMP, and Microkernels
Threads. Processes and Threads  Two characteristics of “processes” as considered so far: Unit of resource allocation Unit of dispatch  Characteristics.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
CS533 Concepts of Operating Systems Class 4 Remote Procedure Call.
Threads Chapter 4. Modern Process & Thread –Process is an infrastructure in which execution takes place  (address space + resources) –Thread is a program.
Scheduler Activations Jeff Chase. Threads in a Process Threads are useful at user-level – Parallelism, hide I/O latency, interactivity Option A (early.
1 Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska and Henry M. Levy Presented by: Karthika Kothapally.
CS533 Concepts of Operating Systems Class 9 Lightweight Remote Procedure Call (LRPC) Rizal Arryadi.
CS510 Concurrent Systems Jonathan Walpole. Lightweight Remote Procedure Call (LRPC)
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Threads, SMP, and Microkernels Chapter 4. 2 Outline n Threads n Symmetric Multiprocessing (SMP) n Microkernel n Linux Threads.
Operating System 4 THREADS, SMP AND MICROKERNELS
Threads, Thread management & Resource Management.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Scheduler Activations: Effective Kernel Support for the User- Level Management of Parallelism. Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
CSE 60641: Operating Systems Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism. Thomas E. Anderson, Brian N.
Threads G.Anuradha (Reference : William Stallings)
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership: process includes a virtual address space to hold the process image (fig 3.16)
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Operating System 4 THREADS, SMP AND MICROKERNELS.
Department of Computer Science and Software Engineering
Operating Systems: Internals and Design Principles
Module 2.0: Threads.
Brian Bershad, Thomas Anderson, Edward Lazowska, and Henry Levy Presented by: Byron Marohn Published: 1991.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
CS 6560: Operating Systems Design
CS533 Concepts of Operating Systems
Chapter 4 Threads.
B. N. Bershad, T. E. Anderson, E. D. Lazowska and H. M
Threads, SMP, and Microkernels
Threads Chapter 4.
By Brian N. Bershad, Thomas E. Anderson, Edward D
Lecture 4- Threads, SMP, and Microkernels
Operating System 4 THREADS, SMP AND MICROKERNELS
Threads Chapter 4.
Multithreaded Programming
Presented by Neha Agrawal
Prof. Leonardo Mostarda University of Camerino
Presented by: SHILPI AGARWAL
Thomas E. Anderson, Brian N. Bershad,
CSE 542: Operating Systems
Threads.
CS Introduction to Operating Systems
Presentation transcript:

Fast Communication and User Level Parallelism Howard Marron

Introduction We have studied systems that have attempted to build transparent layers below the application that created properties like replication and group communication. We will look at some areas where more control has been given to the user on parallelism

Threads Allows smaller granularity to programs for better parallelism and performance. Will have lower overhead than processes Same program will run on one machine as a multiprocessor with little or no modification Threads in same process can easily communicate since they share the same address space

Implementation Do we want threads and if so where should we implement them? Latency in μsec on a Firefly system

Advantages and problems of ULT Thread switching does not involve the kernel: Scheduling can be application specific: choose the best algorithm. ULTs can run on any OS. Only needs a thread library Disadvantages Most system calls are blocking and the kernel blocks processes. So all threads within the process will be blocked The kernel can only assign processes to processors. Two threads within the same process cannot run simultaneously on two processors

Advantages and inconveniences of KLT The kernel knows what the processing environment is and will assign threads accordingly. Blocking is done on a thread level Kernel routines can be multithreaded Disadvantages Thread switching within the same process involves the kernel. We have 2 mode switches per thread switch. This results in a significant slow down in thread switches within same process

ULT with Scheduler Activations Implement user level threads with the help of the kernel. Gain the flexibility and performance of ULT Have functionality of KLT without the overhead

ULT over KLT Kernel operates without knowledge of user programming User threads are never notified of what the kernel schedules since it is transparent to user Kernel schedules threads without respect to user thread priorities and memory locations.

The Model User level Thread pool Kernel runs an instance of the Scheduler Scheduler Kernel runs an instance of the scheduler on each processor. P1 P2

Kernel Support of ULT Kernel has control of processor allocation ULT has control of what threads to run on allocated processors Kernel notifies ULT scheduler of any changes to environment ULT scheduler can notify Kernel of current processor needs

Scheduler Activations Add processor – run a thread here Processor preempted – returns state of preempted processor, can run another thread Scheduler has blocked – can run thread here Scheduler has unblocked – return thread to ready list

How the kernel and scheduler work together

Hints to Kernel Add more processors This processor is idle

Critical Sections Idea 1 On a CS conflict give control back to thread holding lock Thread will give control back after done with CS. Found that was too slow to find if thread was in CS Hard to make thread give up control after CS is done

Critical Sections (Cont.) Idea 2 Make copies of critical sections available to scheduler. Compare PC of thread with CS to check if holding a lock Can run the copy of CS and will return sooner than before since the release of the lock is known to the scheduler.

Results

Results 2

Threads Summary Best solution to threads problem will lay somewhere between ULT and KLT Both must cooperate for best performance Want to have most of control in user level to manage threads since kernel is far away from threads

Remote Procedure Calls A technique for constructing distributed systems Allows user to have no knowledge of transport system Called procedure can be located anywhere Strong client/server model of computing

Problems with RPC Adds huge amount of overhead More protection in every call All calls trap to OS Have to wait for response from other system All calls treated the same – worst case

Ways to improve 95%< all RPCs are to local domain Optimize most taken path Reduce number of system boundaries that RPC crosses

Anatomy of a remote RPC SERVER CLIENT Kernel User User Protection checks Interpret and Dispatch callRPC() Message transfer Schedule Run service Protection checks Reply Message transfer Wake up thread reschedule

Lightweight RPC (LRPC) Create new routines for cross domain calls Use RPC similar calls for cross system calls Blur the line of client/server in new calls Reduce number of variable copies to messages and stacks by maintaining stacks that are dedicated to individual calls Eliminates needs to schedule threads on RPC receipt at server, because processor can be instructed to just switch the calling and called threads

Anatomy of a local LRPC CLIENT Kernel User Protection checks callRPC() There is no need to schedule Threads here, the scheduler Can be told to just switch The two threads Copy to Stack Run service Reply Copy to Stack Resume

Multiprocessors Can cache whole processor contexts on idle processors Instead of context switching local processor for cross domain calls, run procedure on cached processor Saves on TLB misses and other exchanges like virtual memory

Results

LRPC Conclusions RPCs can be improved for general case Common case should be emphasized not the most general case Can reduce many unnecessary tasks when optimizing for cross domain tasks.