1 Read-Copy Update Paul E. McKenney Linux Technology Center IBM Beaverton Jonathan Appavoo Department.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

CS510 Concurrent Systems Jonathan Walpole. What is RCU, Fundamentally? Paul McKenney and Jonathan Walpole.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Read-Copy Update P. E. McKenney, J. Appavoo, A. Kleen, O. Krieger, R. Russell, D. Saram, M. Soni Ottawa Linux Symposium 2001 Presented by Bogdan Simion.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
1 When to Switch Processes 3 triggers –System call, Interrupt and Trap System call –when a user program invokes a system call. e.g., a system call that.
1 Supporting Hot-Swappable Components for System Software Kevin Hui, Jonathan Appavoo, Robert Wisniewski, Marc Auslander, David Edelsohn, Ben Gamsa Orran.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Chapter 2: Computer-System Structures
Thanks to Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2 Computer-System Structures n Computer System Operation n I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Chapter 3 Process Description and Control
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
Time Management.  Time management is concerned with OS facilities and services which measure real time, and is essential to the operation of timesharing.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Department of Computer Science and Software Engineering
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
The read-copy-update mechanism for supporting real-time applications on shared-memory multiprocessor systems with Linux Guniguntala et al.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CS510 Concurrent Systems Jonathan Walpole. RCU Usage in Linux.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
Tornado: Maximizing Locality and Concurrency in a Shared Memory Multiprocessor Operating System Ben Gamsa, Orran Krieger, Jonathan Appavoo, Michael Stumm.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Advanced Operating Systems (CS 202) Memory Consistency and lock-free synchronization (RCU) Jan, 27, 2016.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Processes and threads.
OPERATING SYSTEMS CS3502 Fall 2017
Protection of System Resources
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer-System Architecture
Module 2: Computer-System Structures
Operating Systems.
Process Description and Control
Module 2: Computer-System Structures
Thomas E. Anderson, Brian N. Bershad,
Why Threads Are A Bad Idea (for most purposes)
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
Module 2: Computer-System Structures
CSE 542: 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:

1 Read-Copy Update Paul E. McKenney Linux Technology Center IBM Beaverton Jonathan Appavoo Department of Electrical and Computer Engineering University of Toronto Andi Kleen SuSE Labs Orran Krieger IBM T. J. Watson Research Center Rusty Russell RustCorp Dipankar Sarma Linux Technology Center IBM India Software Lab Maneesh Soni Linux Technology Center IBM India Software Lab Liao,Hsiao-Win

2 Outline  Introduce  Toy Example  Simple Infrastructure to Support RCU  Application

3 Outline  Introduce  Toy Example  Simple Infrastructure to Support RCU  Application

4 Traditional OS locking designs  very complex  poor concurrency  Fail to take advantage of event- driven nature of operating systems

5 Race Between Teardown and Use of Service code executed, Interrupts taken memory error- correction events

6 Read-Copy Update Handling Race quiescent state When

7 Read-copy update works best when  divide an update into two phases  proceed on stale data for common- case operations (e.g. continuing to handle operations by a module being unloaded)  destructive updates are very infrequent.

8 Implementations of Quiescent State  DYNIX/ptx 2.1 (1993) and Rusty Russell's first wait_for_rcu() patch [Russell01a] simply execute onto each CPU in turn.  DYNIX/ptx 4.0 (1994) and Dipankar Sarma's RCU patch for Linux use context switch, execution in the idle loop, execution in user mode, system call entry, trap from user mode, and CPU offline (this last for DYNIX/ptx only) as the quiescent states.

9 Implementations of Quiescent State  Rusty Russell's second wait_for_rcu() patch [Russell01b] uses voluntary context switch as the sole quiescent state  Tornado's and K42's "generation" facility tracks beginnings and ends of operations

10

11 Outline  Introduce  Toy Example  Simple Infrastructure to Support RCU  Application

12 Reference-count v.s Read-copy  search() and delete() read-copy functions avoid all cacheline bouncing for reading tasks read-copy functions can return references to deleted elements read-copy functions cannot hold a reference to elements across a voluntary context switch

13 Typical RCU update sequence  Remove pointers to a data structure.  Wait for all previous reader to complete their RCU read-side critical sections.  at this point, there cannot be any readers who hold reference to the data structure, so it now may safely be reclaimed.

14 Read-Copy Deletion (delete B)

15 the first phase of the update 18

16 Read-Copy Deletion first 18

17 Read-Copy Search The Task See Table data

18 Read-Copy Deletion Second 18

19 Read-Copy Deletion When

20 Read-Copy Deletion

21 Assumptions  Read intensive the update fraction f < 1/ |CPU|  Grace period reading tasks can see stale data  requires that the modification be compatible with lock-free access linked-list insertion, deletion, and replacement are compatible

22 Outline  Introduce  Toy Example  Simple Infrastructure to Support RCU  Application

23 Simple Implementation  Wait_for_rcu() waits for a grace period to expire  Kfree_rcu() waits for a grace period before freeing a specified block of memory.

24 Read-Copy Update Grace Period non-preemptible kernel execution Quiescentstate execution

25 Simple Grace-Period Detection

26 Rusty Russell's wait_for_rcu() I

27 Rusty Russell's wait_for_rcu() II

28 Shortcomings  Not work in a preemptible kernel unless preemption is suppressed in all read-side critical sections  Not be called from an interrupt handler  Not be called while holding a spinlock or with interrupts disabled  Relatively slow

29 Addressing  The K42 and Tornado implementations of RCU are such that read-side critical sections can block as well as being preempted — solve 1  Call_rcu() --solve 2 、 3  Kfree_rcu() --solve 2 、 3  High-Performance Design for RCU – solve 2 、 3 、 4

30 K42 and Tornado implementations of RCU  maintain two generation counters current generation non-current generation  Operations (next page)

31 Operation A Operation begins  increment the current counter  store a pointer to that counter in the task the operation ends  Decrement generation counter Periodically, non-current generation is checked to see if it is zero Reverse current and non-current generations A token is handed from one CPU to next The token returns to a given CPU  All operations across the entire system have terminated.

32 Non-Blocking Grace-Period Detection Queues callbacks onto a list invoke all the pending callbacks after forcing a grace period

33 High-Performance Design  defer frees of kmem_cache_alloc() memory  detects and identifies overly long lock-hold durations  “ Batching" grace-period-measurement requests  Maintaining per-CPU request lists  Providing a less-costly algorithm for measuring grace-period duration.

34 Simple Deferred Free  a simple implementation of a deferred-free function named kfree_rcu()  low performance kfree_rcu() → wait for rcu()

35 Outline  Introduce  Toy Example  Simple Infrastructure to Support RCU  Application

36 Application  Distributed lock manager  TCP/IP  Storage-area network (SAN)  Application regions manager (which is a workload-management subsystem)  Process management  LAN drivers

37 Thanks for your listening