Git Product home page Git Product logo

weak_queue's Introduction

MIT License LinkedIn

Weak Michael & Scott Non-Blocking Queue

Implementation of the Michael & Scott Non-Blocking Queue for a Weak Memory Model to compare the performance gains, and check the correctness.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact

About The Project

We have implemented the following data structures:

  • MS Queue for Strong Memory Model (x86)
  • MS Queue for Weak Memory Model (POWER9, Apple Silicon, ARM, etc)

We have model checked using CDSChecker:

  • MS Queue for Strong Memory Model (x86) w/o freeing memory
  • MS Queue for Weak Memory Model (POWER9, Apple Silicon, ARM, etc) w/o freeing memory

(back to top)

Getting Started

Prerequisites

  • C++ 11
  • CMake
  • CPU with weak memory ordering (ex: POWER9, Apple Silicon, ARM...)
  • R with ggplot2, tidyr, dplyr and readr packages (Optional: to run the benchmark)

Compatibility

The project was successfully compiled and tested on

  • Intel CPU (i9-12900K) with Ubuntu 22.04
  • Apple Silicon (Apple M1 Pro) with macOS Monterey 12.6
  • POWER9 with Red Hat Entreprise 8.8

Apple Silicon

On Apple Silicon, linking against the atomics library leads to an error. If you are compiling the code for an Apple Silicon CPU, you should remove the linkage to atomics in the Makefiles and CmakeLists to successfully compile.

Benchmarking

To run the benchmark, you can execute the bench.sh script. It will generate a bench.pdf plot and print the average speedup.

Testing

Strong Michael & Scott Queue

The implementation for the strong MS queue is located at src/ms_queue_strong. To run the tests:

  1. Go to the directory: cd src/ms_queue_strong
  2. Build the project: cmake .; make
  3. Run the tests: ./test_seq; ./test_par

Weak Michael & Scott Queue

The implementation for the weak MS queue is located at src/ms_queue_weak. To run the tests:

  1. Go to the directory: cd src/ms_queue_weak
  2. Build the project: cmake .; make
  3. Run the tests: ./test_seq; ./test_par

Model Checking

We have tested our strong and weak implementations of the MS queue using the Model Checker CDSChecker.

Because CDSChecker does not support atomic operations over datatype larger than 64 bits, we have simplified the algorithm:

  • Queue items are 32-bit unsigned integers,
  • No deallocation of memory (to prevent ABA issues when removing the Pointer structure).

CDSChecker

To run CDSChecker over the strong and weak algorithms, follow those instructions:

Strong Michael & Scott Queue

  1. Go to the directory: cd CDSChecker/ms-queue/ms-queue-strong-no-free
  2. Compile the binary: make
  3. Run CDSChecker: ./../../run.sh test_2threads -y -m 2

Weak Michael & Scott Queue

  1. Go to the directory: cd CDSChecker/ms-queue/ms-queue-weak-no-free
  2. Compile the binary: make
  3. Run CDSChecker: ./../../run.sh test_2threads -y -m 2

(back to top)

Contact

Alexis Le Glaunec - [email protected]

(back to top)

weak_queue's People

Contributors

alexis51151 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.