SlideShare a Scribd company logo
1 of 26
Download to read offline
Userspace RCU Library:

 What Linear Multiprocessor
 Scalability Means for Your
        Application

   Linux Plumbers Conference 2009

          Mathieu Desnoyers
   École Polytechnique de Montréal
> Mathieu Desnoyers
●   Author/maintainer of :
    –   LTTV (Linux Trace Toolkit Viewer)
         ●   2003-...
    –   LTTng (Linux Trace Toolkit Next Generation)
         ●   2005-...
    –   Immediate Values
         ●   2007...
    –   Tracepoints
         ●   2008-...
    –   Userspace RCU Library
2
         ●   2009-...
> Contributions by
●   Paul E. McKenney
    –   IBM Linux Technology Center
●   Alan Stern
    –   Rowland Institute, Harvard University
●   Jonathan Walpole
    –   Computer Science Department, Portland
        State University
●   Michel Dagenais
    –   Computer and Software Engineering Dpt.,
3       École Polytechnique de Montréal
> Summary
●   RCU Overview
●   Kernel vs Userspace RCU
●   Userspace RCU Library
●   Benchmarks
●   RCU-Friendly Applications




4
> Linux Kernel RCU Usage




5
> RCU Overview
●   Relativistic programming
    –   Updates seen in different orders by CPUs
    –   Tolerates conflicts
●   Linear scalability
●   Wait-free read-side
●   Efficient updates
    –   Only a single pointer exchange needs
        exclusive access

6
> Schematic of RCU Update
          and Read-Side C.S.




7
> RCU Linked-List Deletion




8
> Kernel vs Userspace RCU
●   Quiescent state
    –   Kernel threads
         ●   Wait for kernel pre-existing RCU read-side C.S. to
             complete
    –   User threads
         ●   Wait for process pre-existing RCU read-side C.S. to
             complete




9
> Userspace RCU Library
●    QSBR
     –   liburcu-qsbr.so
●    Generic RCU
     –   liburcu-mb.so
●    Signal-based RCU
     –   liburcu.so
●    call_rcu()
     –   liburcu-defer.so

10
> QSBR
●    Detection of quiescent state:
     –   Each reader thread calls
         rcu_quiescent_state() periodically.
●    Require application modification
●    Read-side with very low overhead




11
> Generic RCU
●    Detection of quiescent state:
     –   rcu_read_lock()/rcu_read_unlock() mark the
         beginning/end of the critical sections
     –   Counts nesting level
●    Suitable for library use
●    Higher read-side overhead than QSBR
     due to added memory barriers



12
> Signal-based RCU
●    Same quiescent state detection as
     Generic RCU
●    Suitable for library use, but reserves a
     signal
●    Read-side close to QSBR performance
     –   Remove memory barriers from
         rcu_read_lock()/rcu_read_unlock().
     –   Replaced by memory barriers in signal
         handler, executed at each update-side
         memory barrier.
13
> call_rcu()
●    Eliminates the need to call
     synchronize_rcu() after each removal
●    Queues RCU callbacks for deferred
     batched execution
●    Wait-free unless per-thread queue is full
●    “Worker thread” executes callbacks
     periodically
●    Energy-efficient, uses sys_futex()

14
> Example: RCU Read-Side

     struct mystruct *rcudata = &somedata;

     /* register thread with rcu_register_thread()/rcu_unregister_thread() */
     void fct(void)
     {
          struct mystruct *ptr;

         rcu_read_lock();
         ptr = rcu_dereference(rcudata);
         /* use ptr */
         rcu_read_unlock();
     }




15
> Example: exchange pointer

     struct mystruct *rcudata = &somedata;

     void replace_data(struct mystruct data)
     {
         struct mystruct *new, *old;

         new = malloc(sizeof(*new));
         memcpy(new, &data, sizeof(*new));
         old = rcu_xchg_pointer(&rcudata, new);
         call_rcu(free, old);
     }




16
> Example:
compare-and-exchange pointer
     struct mystruct *rcudata = &somedata;

     /* register thread with rcu_register_thread()/rcu_unregister_thread() */
     void modify_data(int increment_a, int increment_b)
     {
          struct mystruct *new, *old;

         new = malloc(sizeof(*new));
         rcu_read_lock();     /* Ensure pointer is not re-used */
         do {
              old = rcu_dereference(rcudata);
              memcpy(new, old, sizeof(*new));
              new->field_a += increment_a;
              new->field_b += increment_b;
         } while (rcu_cmpxchg_pointer(&rcudata, old, new) != old);
         rcu_read_unlock();
         call_rcu(free, old);
     }
17
> Benchmarks
●    Read-side Scalability
●    Read-side C.S. length impact
●    Update Overhead




18
> Read-Side Scalability




64-cores POWER5+

19
> Read-Side C.S. Length Impact




64-cores POWER5+, logarithmic scale (x, y)

20
> Update Overhead




64-cores POWER5+, logarithmic scale (x, y)

21
> RCU-Friendly Applications
●    Multithreaded applications with read-
     often shared data
     –   Cache
          ●   Name servers
          ●   Proxy
          ●   Web servers with static pages
     –   Configuration
          ●   Low synchronization overhead
          ●   Dynamically modified without restart


22
> RCU-Friendly Applications
●    Libraries supporting multithreaded
     applications
     –   Tracing library, e.g. lib UST (LTTng port for
         userspace tracing)
          ●   http://git.dorsal.polymtl.ca/?p=ust.git




23
> RCU-Friendly Applications
●    Libraries supporting multithreaded
     applications (cont.)
     –   Typing/data structure support
          ●   Typing system
               –   Creation of a class is a rare event
               –   Reading class structure happens at object
                   creation/destruction (_very_ often)
               –   Applies to gobject
                     ● Used by: gtk/gdk/glib/gstreamer...


          ●   Efficient hash tables
          ●   Glib “quarks”

24
> RCU-Friendly Applications
●    Routing tables in userspace
●    Userspace network stacks
●    Userspace signal-handling
     –   Signal-safe read-side
     –   Could implement an inter-thread signal
         multiplexer
●    Your own ?


25
> Info / Download / Contact
●    Mathieu Desnoyers
     –   Computer and Software Engineering Dpt.,
         École Polytechnique de Montréal
●    Web site:
     –   http://www.lttng.org/urcu
●    Git tree
     –   git://lttng.org/userspace-rcu.git
●    Email
     –   mathieu.desnoyers@polymtl.ca
26

More Related Content

What's hot

Autentia OS - 20180210 - Docker y las películas de chinos
Autentia OS - 20180210 - Docker y las películas de chinosAutentia OS - 20180210 - Docker y las películas de chinos
Autentia OS - 20180210 - Docker y las películas de chinosAlejandro Pérez García
 
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo SeidelOSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo SeidelNETWAYS
 
Caffe + H2O - By Cyprien noel
Caffe + H2O - By Cyprien noelCaffe + H2O - By Cyprien noel
Caffe + H2O - By Cyprien noelSri Ambati
 
Integrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI TargetIntegrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI Targetijsrd.com
 
Linux NUMA & Databases: Perils and Opportunities
Linux NUMA & Databases: Perils and OpportunitiesLinux NUMA & Databases: Perils and Opportunities
Linux NUMA & Databases: Perils and OpportunitiesRaghavendra Prabhu
 
The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421Linaro
 
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie Morgan
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie MorganEmbedded Recipes 2018 - Shared memory / telemetry - Yves-Marie Morgan
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie MorganAnne Nicolas
 
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...OpenNebula Project
 
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMsJava one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMsSpeedment, Inc.
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking MechanismsKernel TLV
 
FOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerFOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerAndrey Vagin
 
September 7, 2019 Cloud Native and Containerisation (Joint Meetup with Docke...
September 7, 2019  Cloud Native and Containerisation (Joint Meetup with Docke...September 7, 2019  Cloud Native and Containerisation (Joint Meetup with Docke...
September 7, 2019 Cloud Native and Containerisation (Joint Meetup with Docke...sangam biradar
 
Gjergj Sheldija: Albania
Gjergj Sheldija: AlbaniaGjergj Sheldija: Albania
Gjergj Sheldija: AlbaniaAccessITplus
 
PASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM AbstractionsPASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM Abstractionsmicchie
 
Hungarian ClusterGrid and its applications
Hungarian ClusterGrid and its applicationsHungarian ClusterGrid and its applications
Hungarian ClusterGrid and its applicationsFerenc Szalai
 
Gluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster.org
 

What's hot (19)

Autentia OS - 20180210 - Docker y las películas de chinos
Autentia OS - 20180210 - Docker y las películas de chinosAutentia OS - 20180210 - Docker y las películas de chinos
Autentia OS - 20180210 - Docker y las películas de chinos
 
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo SeidelOSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
OSDC 2013 | Distributed Storage with GlusterFS by Dr. Udo Seidel
 
Caffe + H2O - By Cyprien noel
Caffe + H2O - By Cyprien noelCaffe + H2O - By Cyprien noel
Caffe + H2O - By Cyprien noel
 
Integrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI TargetIntegrating GlusterFS with iSCSI Target
Integrating GlusterFS with iSCSI Target
 
Linux NUMA & Databases: Perils and Opportunities
Linux NUMA & Databases: Perils and OpportunitiesLinux NUMA & Databases: Perils and Opportunities
Linux NUMA & Databases: Perils and Opportunities
 
The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421
 
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie Morgan
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie MorganEmbedded Recipes 2018 - Shared memory / telemetry - Yves-Marie Morgan
Embedded Recipes 2018 - Shared memory / telemetry - Yves-Marie Morgan
 
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
OpenNebulaConf2018 - OpenNebula and LXD Containers - Rubén S. Montero - OpenN...
 
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMsJava one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
 
OpenNebula LXD Container Support overview
OpenNebula LXD Container Support overviewOpenNebula LXD Container Support overview
OpenNebula LXD Container Support overview
 
FOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the cornerFOSDEM2015: Live migration for containers is around the corner
FOSDEM2015: Live migration for containers is around the corner
 
September 7, 2019 Cloud Native and Containerisation (Joint Meetup with Docke...
September 7, 2019  Cloud Native and Containerisation (Joint Meetup with Docke...September 7, 2019  Cloud Native and Containerisation (Joint Meetup with Docke...
September 7, 2019 Cloud Native and Containerisation (Joint Meetup with Docke...
 
Mahti quick-start guide
Mahti quick-start guide Mahti quick-start guide
Mahti quick-start guide
 
Gjergj Sheldija: Albania
Gjergj Sheldija: AlbaniaGjergj Sheldija: Albania
Gjergj Sheldija: Albania
 
PASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM AbstractionsPASTE: Network Stacks Must Integrate with NVMM Abstractions
PASTE: Network Stacks Must Integrate with NVMM Abstractions
 
Hungarian ClusterGrid and its applications
Hungarian ClusterGrid and its applicationsHungarian ClusterGrid and its applications
Hungarian ClusterGrid and its applications
 
Enduro/X Middleware
Enduro/X MiddlewareEnduro/X Middleware
Enduro/X Middleware
 
Gluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephant
 

Similar to Userspace RCU library : what linear multiprocessor scalability means for your application

Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster.org
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kevin Lynch
 
Glusterd_thread_synchronization_using_urcu_lca2016
Glusterd_thread_synchronization_using_urcu_lca2016Glusterd_thread_synchronization_using_urcu_lca2016
Glusterd_thread_synchronization_using_urcu_lca2016Atin Mukherjee
 
Rlite software-architecture (1)
Rlite software-architecture (1)Rlite software-architecture (1)
Rlite software-architecture (1)ARCFIRE ICT
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSFernando Luiz Cola
 
Kubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKevin Lynch
 
Linux Synchronization Mechanism: RCU (Read Copy Update)
Linux Synchronization Mechanism: RCU (Read Copy Update)Linux Synchronization Mechanism: RCU (Read Copy Update)
Linux Synchronization Mechanism: RCU (Read Copy Update)Adrian Huang
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsFromDual GmbH
 
Checkpoint and Restore In Userspace
Checkpoint and Restore In UserspaceCheckpoint and Restore In Userspace
Checkpoint and Restore In UserspaceOpenVZ
 
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...OpenVZ
 
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...Andrey Vagin
 
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...WG_ Events
 
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...PROIDEA
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
LTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingLTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingChristian Babeux
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOSICS
 
Playing BBR with a userspace network stack
Playing BBR with a userspace network stackPlaying BBR with a userspace network stack
Playing BBR with a userspace network stackHajime Tazaki
 

Similar to Userspace RCU library : what linear multiprocessor scalability means for your application (20)

Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016
 
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
Kubernetes @ Squarespace (SRE Portland Meetup October 2017)
 
Mastering Real-time Linux
Mastering Real-time LinuxMastering Real-time Linux
Mastering Real-time Linux
 
Glusterd_thread_synchronization_using_urcu_lca2016
Glusterd_thread_synchronization_using_urcu_lca2016Glusterd_thread_synchronization_using_urcu_lca2016
Glusterd_thread_synchronization_using_urcu_lca2016
 
Rlite software-architecture (1)
Rlite software-architecture (1)Rlite software-architecture (1)
Rlite software-architecture (1)
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
 
Kubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the Datacenter
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
Linux Synchronization Mechanism: RCU (Read Copy Update)
Linux Synchronization Mechanism: RCU (Read Copy Update)Linux Synchronization Mechanism: RCU (Read Copy Update)
Linux Synchronization Mechanism: RCU (Read Copy Update)
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Checkpoint and Restore In Userspace
Checkpoint and Restore In UserspaceCheckpoint and Restore In Userspace
Checkpoint and Restore In Userspace
 
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
 
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
Open WG Talk #2 Everything you wanted to know about CRIU (but were afraid to ...
 
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...
Андрей Вагин. Все что вы хотели знать о Criu, но стеснялись спросить...
 
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
 
State of ARM-based HPC
State of ARM-based HPCState of ARM-based HPC
State of ARM-based HPC
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
LTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space TracingLTTng-UST: Efficient System-Wide User-Space Tracing
LTTng-UST: Efficient System-Wide User-Space Tracing
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Playing BBR with a userspace network stack
Playing BBR with a userspace network stackPlaying BBR with a userspace network stack
Playing BBR with a userspace network stack
 

Recently uploaded

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 

Recently uploaded (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 

Userspace RCU library : what linear multiprocessor scalability means for your application

  • 1. Userspace RCU Library: What Linear Multiprocessor Scalability Means for Your Application Linux Plumbers Conference 2009 Mathieu Desnoyers École Polytechnique de Montréal
  • 2. > Mathieu Desnoyers ● Author/maintainer of : – LTTV (Linux Trace Toolkit Viewer) ● 2003-... – LTTng (Linux Trace Toolkit Next Generation) ● 2005-... – Immediate Values ● 2007... – Tracepoints ● 2008-... – Userspace RCU Library 2 ● 2009-...
  • 3. > Contributions by ● Paul E. McKenney – IBM Linux Technology Center ● Alan Stern – Rowland Institute, Harvard University ● Jonathan Walpole – Computer Science Department, Portland State University ● Michel Dagenais – Computer and Software Engineering Dpt., 3 École Polytechnique de Montréal
  • 4. > Summary ● RCU Overview ● Kernel vs Userspace RCU ● Userspace RCU Library ● Benchmarks ● RCU-Friendly Applications 4
  • 5. > Linux Kernel RCU Usage 5
  • 6. > RCU Overview ● Relativistic programming – Updates seen in different orders by CPUs – Tolerates conflicts ● Linear scalability ● Wait-free read-side ● Efficient updates – Only a single pointer exchange needs exclusive access 6
  • 7. > Schematic of RCU Update and Read-Side C.S. 7
  • 8. > RCU Linked-List Deletion 8
  • 9. > Kernel vs Userspace RCU ● Quiescent state – Kernel threads ● Wait for kernel pre-existing RCU read-side C.S. to complete – User threads ● Wait for process pre-existing RCU read-side C.S. to complete 9
  • 10. > Userspace RCU Library ● QSBR – liburcu-qsbr.so ● Generic RCU – liburcu-mb.so ● Signal-based RCU – liburcu.so ● call_rcu() – liburcu-defer.so 10
  • 11. > QSBR ● Detection of quiescent state: – Each reader thread calls rcu_quiescent_state() periodically. ● Require application modification ● Read-side with very low overhead 11
  • 12. > Generic RCU ● Detection of quiescent state: – rcu_read_lock()/rcu_read_unlock() mark the beginning/end of the critical sections – Counts nesting level ● Suitable for library use ● Higher read-side overhead than QSBR due to added memory barriers 12
  • 13. > Signal-based RCU ● Same quiescent state detection as Generic RCU ● Suitable for library use, but reserves a signal ● Read-side close to QSBR performance – Remove memory barriers from rcu_read_lock()/rcu_read_unlock(). – Replaced by memory barriers in signal handler, executed at each update-side memory barrier. 13
  • 14. > call_rcu() ● Eliminates the need to call synchronize_rcu() after each removal ● Queues RCU callbacks for deferred batched execution ● Wait-free unless per-thread queue is full ● “Worker thread” executes callbacks periodically ● Energy-efficient, uses sys_futex() 14
  • 15. > Example: RCU Read-Side struct mystruct *rcudata = &somedata; /* register thread with rcu_register_thread()/rcu_unregister_thread() */ void fct(void) { struct mystruct *ptr; rcu_read_lock(); ptr = rcu_dereference(rcudata); /* use ptr */ rcu_read_unlock(); } 15
  • 16. > Example: exchange pointer struct mystruct *rcudata = &somedata; void replace_data(struct mystruct data) { struct mystruct *new, *old; new = malloc(sizeof(*new)); memcpy(new, &data, sizeof(*new)); old = rcu_xchg_pointer(&rcudata, new); call_rcu(free, old); } 16
  • 17. > Example: compare-and-exchange pointer struct mystruct *rcudata = &somedata; /* register thread with rcu_register_thread()/rcu_unregister_thread() */ void modify_data(int increment_a, int increment_b) { struct mystruct *new, *old; new = malloc(sizeof(*new)); rcu_read_lock(); /* Ensure pointer is not re-used */ do { old = rcu_dereference(rcudata); memcpy(new, old, sizeof(*new)); new->field_a += increment_a; new->field_b += increment_b; } while (rcu_cmpxchg_pointer(&rcudata, old, new) != old); rcu_read_unlock(); call_rcu(free, old); } 17
  • 18. > Benchmarks ● Read-side Scalability ● Read-side C.S. length impact ● Update Overhead 18
  • 20. > Read-Side C.S. Length Impact 64-cores POWER5+, logarithmic scale (x, y) 20
  • 21. > Update Overhead 64-cores POWER5+, logarithmic scale (x, y) 21
  • 22. > RCU-Friendly Applications ● Multithreaded applications with read- often shared data – Cache ● Name servers ● Proxy ● Web servers with static pages – Configuration ● Low synchronization overhead ● Dynamically modified without restart 22
  • 23. > RCU-Friendly Applications ● Libraries supporting multithreaded applications – Tracing library, e.g. lib UST (LTTng port for userspace tracing) ● http://git.dorsal.polymtl.ca/?p=ust.git 23
  • 24. > RCU-Friendly Applications ● Libraries supporting multithreaded applications (cont.) – Typing/data structure support ● Typing system – Creation of a class is a rare event – Reading class structure happens at object creation/destruction (_very_ often) – Applies to gobject ● Used by: gtk/gdk/glib/gstreamer... ● Efficient hash tables ● Glib “quarks” 24
  • 25. > RCU-Friendly Applications ● Routing tables in userspace ● Userspace network stacks ● Userspace signal-handling – Signal-safe read-side – Could implement an inter-thread signal multiplexer ● Your own ? 25
  • 26. > Info / Download / Contact ● Mathieu Desnoyers – Computer and Software Engineering Dpt., École Polytechnique de Montréal ● Web site: – http://www.lttng.org/urcu ● Git tree – git://lttng.org/userspace-rcu.git ● Email – mathieu.desnoyers@polymtl.ca 26