A Cool Generic Concurrency Primitive in Rust

A Cool Generic Concurrency Primitive in Rust

A Cool Generic Concurrency Primitive in Rust. In this stream, we explore an idea I came up with a few weeks ago to make a generic version of just the concurrency primitive that can then be re-used for other datastructures as well.

A few years ago, I built a concurrent hash map designed specifically to support highly concurrent reads: https://github.com/jonhoo/rust-evmap. It is part of what gives Noria, my PhD thesis work, such great read performance. The concurrency primitive that enables evmap to be so fast isn't really specific to maps though, and it's bothered me for a while that the particular datastructure I used it for in Noria was the only available way to use it.

In this stream, we explore an idea I came up with a few weeks ago to make a generic version of just the concurrency primitive that can then be re-used for other datastructures as well. You can see the outline of the plan here: https://github.com/jonhoo/rust-evmap/issues/45#issuecomment-723706112. This entailed slicing out just the concurrency stuff from evmap, and making it into its own reusable crate, and then reworking evmap to use that library. We got more or less all the way there, and you can see the final result in this PR: https://github.com/jonhoo/rust-evmap/pull/73.

  • 0:00:00 Introduction
  • 0:10:15 How evmap works
  • 0:42:56 The change
  • 0:53:58 Reorganizing the code
  • 0:58:46 Stripping out the concurrency primitive
  • 3:01:01 Biobreak
  • 3:03:42 Make evmap use LeftRight
  • 4:52:38 Fixing up evmap unit tests
  • 5:15:15 Associated types vs. generic traits
  • 5:18:36 Fixing up more evmap unit tests
  • 5:21:47 Fixing up the full test suite
  • 5:37:15 Making ReadHandle take &self
  • 6:02:18 Outro

You can see the unsafe code guidelines comment I made about transmuting a type that contains T to ManuallyDrop T here: https://github.com/rust-lang/unsafe-code-guidelines/issues/35#issuecomment-731656729.

rust programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, ... by Oleg Sklyarov, Fullstack Developer at Skyeng company

Tracking a Developer’s Journey From Documentation Visit

Measuring website activity provides only half the story. See how to best track the developer's journey and what funnel stages makes sense for API-first products

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

Setting up a Rust Development Environment

In this post we'll be discussing one way to set up your machine for Rust development.