Giter VIP home page Giter VIP logo

lock-manager's Introduction

Transaction-Aware Lock Management

Implement a Lock Manager, as discussed in the lecture. Your implementation should allow to concurrently lock and unlock items and block the execution thread until the lock could be acquired. However, you should detect and handle deadlocks using the wait-for graph technique discussed in the lecture. To block the thread, you can use a std::shared_mutex, and to abort a transaction, just throw an exception.

Your WaitsForGraph should be able to add new waits-for dependencies, but abort the transaction as soon as the graph becomes cyclic. When a transaction finishes, you should also remove all of its waits-for dependants. Keep in mind that the graph will need separate synchronization to the Lock Manager.

The LockManager should use a fixed-size hashtable with a lock for each bucket and chain. To manage the lifetime of the lock objects themselves, we recommend to use a std::shared_ptr with a custom deleter that deletes the lock in the LockManager. The Lock structure is already set to have its lifetime managed by a std::shared_ptr<Lock>. You can read more about this here.

Testing

You can test your implementation using the tests in test/lock_manager_test.cc. They are designed to separately test the WaitsForGraph and the LockManager logic. To run them, compile the project and then execute the tester binary.

Passing the tests is a requirement but does not automatically mean that you will get full points.

Additionally, your code will be checked for code quality. You can run the checks for that by using the lint CMake target (e.g. by running make lint). When your code does not pass those checks, we may deduct (a small amount of) points.

lock-manager's People

Contributors

alexanderzellner avatar pfent 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.