Coder Social home page Coder Social logo

concurrent-programming-intensive-munich's Introduction

Intensive Course on Concurrent Programming

Day 1

Coarse-grained bank

In src/day1/CoarseGrainedBank.kt, make the sequential bank implementation thread-safe. Please follow the coarse-grained locking scheme to make synchronization efficient. For that, you need to use a single lock to protect all bank operations.

To test your solution, please run:

  • ./gradlew test --tests CoarseGrainedBankTest on Linux or MacOS
  • gradlew test --tests CoarseGrainedBankTest on Windows

Fine-grained bank

In src/day1/FineGrainedBank.kt, make the sequential bank implementation thread-safe. Please follow the fine-grained locking scheme to make synchronization efficient. For that, you need to use per-account locks, thus, ensuring natural parallelism when accessing different accounts. The totalAmount() function should acquire all the locks to get a consistent snapshot, while transfer(..) should acquire the corresponding account locks.

To test your solution, please run:

  • ./gradlew test --tests FineGrainedBankTest on Linux or MacOS
  • gradlew test --tests FineGrainedBankTest on Windows

Treiber stack

In src/day1/TreiberStack.kt, implement the classic Treiber stack algorithm.

To test your solution, please run:

  • ./gradlew test --tests TreiberStackTest on Linux or MacOS
  • gradlew test --tests TreiberStackTest on Windows

Treiber stack with elimination

In src/day1/TreiberStackWithElimination.kt, implement the classic Treiber stack algorithm with the elimination technique.

To test your solution, please run:

  • ./gradlew test --tests TreiberStackWithEliminationTest on Linux or MacOS
  • gradlew test --tests TreiberStackWithEliminationTest on Windows

Michael-Scott queue

In src/day1/MSQueue.kt, implement the Michael-Scott queue algorithm. You might also be interested in the original paper.

To test your solution, please run:

  • ./gradlew test --tests MSQueueTest on Linux or MacOS
  • gradlew test --tests MSQueueTest on Windows

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.