A Practical Analysis of Rust's Concurrency Story

04/27/2019
by   Aditya Saligrama, et al.
0

Correct concurrent programs are difficult to write; when multiple threads mutate shared data, they may lose writes, corrupt data, or produce erratic program behavior. While many of the data-race issues with concurrency can be avoided by the placing of locks throughout the code, these often serialize program execution, and can significantly slow down performance-critical applications. Programmers also make mistakes, and often forget locks in less-executed code paths, which leads to programs that misbehave only in rare situations. Rust is a recent programming language from Mozilla that attempts to solve these intertwined issues by detecting data-races at compile time. Rust's type system encodes a data-structure's ability to be shared between threads in the type system, which in turn allows the compiler to reject programs where threads directly mutate shared state without locks or other protection mechanisms. In this work, we examine how this aspect of Rust's type system impacts the development and refinement of a concurrent data structure, as well as its ability to adapt to situations where correctness is guaranteed by lower-level invariants (e.g., in lock-free algorithms) that are not directly expressible in the type system itself. We detail the implementation of a concurrent lock-free hashmap in order to describe these traits of the Rust language. Our code is publicly available at https://github.com/saligrama/concache and is one of the fastest concurrent hashmaps for the Rust language, which leads to mitigating bottlenecks in concurrent programs.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/02/2022

Reversing an Imperative Concurrent Programming Language

We introduce a method of reversing the execution of imperative concurren...
research
11/08/2020

Generating Concurrent Programs From Sequential Data Structure Knowledge

In this paper we tackle the problem of automatically designing concurren...
research
09/17/2021

Generating Concurrent Programs From Sequential Data Structure Knowledge Using Answer Set Programming

We tackle the problem of automatically designing concurrent data structu...
research
06/06/2017

Specifying Transaction Control to Serialize Concurrent Program Executions

We define a programming language independent transaction controller and ...
research
04/07/2022

Separation of concerning things: a simpler basis for defining and programming with the C/C++ memory model (extended version)

The C/C++ memory model provides an interface and execution model for pro...
research
04/02/2022

A Study of Real-World Data Races in Golang

The concurrent programming literature is rich with tools and techniques ...
research
01/26/2023

Concrat: An Automatic C-to-Rust Lock API Translator for Concurrent Programs

Concurrent programs suffer from data races. To prevent data races, progr...

Please sign up or login with your details

Forgot password? Click here to reset