Deadlockempire.github.io - The Deadlock Empire: Slay dragons, learn concurrency!

The Deadlock Empire

A game that teaches locking and concurrency. It runs on https://deadlockempire.github.io.

Contributing

We gladly welcome all contributions. Especially, we <3 pull requests, bug reports and ideas for features or new challenges. We would also be happy to hear about your experience with The Deadlock Empire: which parts you enjoyed, which were too difficult, what confused you, or anything else - shoot us an e-mail at [email protected].

For complete information on how to contribute to The Deadlock Empire, please see the CONTRIBUTORS file.

Acknowledgements

We stand on the shoulders of giants.

We thank the numerous organizers, sponsors, judges and hackers of HackCambridge 2016 for the opportunity to develop this idea and for their support.

We use jQuery for manipulating the DOM and for animations. The design is implemented using vanilla Bootstrap. The tutorial challenge uses Intro.js to familiarize the player with the controls. Keyboard shortcuts are implemented using Mousetrap.

The game uses the Amatic SC font published by Vernon Adams published on Google Fonts.

The logo is a combination of the dragon from the Welsh flag and a lock icon, both from Wikimedia Commons.

Credits

Made by Petr Hudeček and Michal Pokorný on HackCambridge 2016.

License

This software uses the Bootstrap framework. Bootstrap is copyright Twitter, Inc. and available under the MIT License.

The Bootstrap framework ships with a no-cost version of the GLYPHICONS icon/font set. The copyright of GLYPHICONS is retained by its creators.

All other software in this repository is licensed under the GNU General Public License Version 2. Please see the license file (COPYING) for complete information.

All contributors retain copyright to their contributions to this project.

Comments
  • Add GPLv2 file

    Add GPLv2 file

    This PR is a start on properly applying the GPLv2 license to the project code. Simply stating "GPLv2" at the bottom of the readme isn't enough to apply the license.

    More remains to be done to apply the license correctly:

    1. Add a copyright & license statement to the top of all project files (which are not already licensed by their own copyright holders)
    2. Update the README with any additional licensed files which are used in the project (how about those images? what are their copyright/licensing?)

    I will not be doing these 2 steps as I do not have the information necessary to complete them. It'll be up to the project founders to wrangle those.

    Please see https://www.gnu.org/licenses/gpl-howto.html for complete information on applying a GPL license to a project.

  • T1-Interface broken: never exits mutex

    T1-Interface broken: never exits mutex

    Just what it says. Try running through Thread 0 a few times, Mutex will never unlock.

    Also, on the right, the main if(){} enters mutex2 twice, but never exits.

  • Add CONTRIBUTORS.md

    Add CONTRIBUTORS.md

    If GitHub finds a CONTRIBUTORS file it will display a notice on PR forms to direct people to it before they submit their pull request. This helps prevent people from doing things like, say, sending a PR on master instead of devel. :-)

  • Level 1: at 1920x1080 display is not correct for one of the tooltips

    Level 1: at 1920x1080 display is not correct for one of the tooltips

  • Some typo's and href fixes

    Some typo's and href fixes

    • System.Collections.Generic.Queue hyperlinks don't work as they contain the inner type
    • non-MSDN hyperlinks open in the same window as they miss target='_blank'
    • "Peterson Algorithm" -> "Peterson's Algorithm" and hyperlink

    These were from my investigation to see if I can make a Delphi version for the http://entwickler-konferenz.de early next week. It's going to be a challenge as this is my first real JavaScript/html code in a very long time (:

    I'll keep the Delphi work in a separate branch, but will create a pull request for the other things.

  • Suggestion: let code be visible during victory

    Suggestion: let code be visible during victory

    Hi. I was playing a level and I had a plan and I accidentally won early. The victory text explains what happened, but I wanted to look at the code, too. So I clicked 'back to code'. Now the victory text is gone. (Forever?)

    Just don't use modal popups. Append the victory text after the challenge text, above the code. Or below the code.

    Just a suggestion! (Personally, I think the only uses for 'modal' dialogs are "an error has occurred and the application will now close" and "please log in". You know, situations where it can't possibly make sense to let the user poke around elsewhere. Otherwise, let the user poke around--don't lock their interface with a modal!)

  • fix incorrect sentence in the tutorial

    fix incorrect sentence in the tutorial

    Just a minor mistake in the tutorial's text that I felt obliged to fix. This "game" is fantastic. I'm new to concurrent programming. This is a great introduction.

  • Bug: ManualResetEventSlim.Wait method working incorrectly

    Bug: ManualResetEventSlim.Wait method working incorrectly

    Currently in the game the ManualResetEventSlim.Wait method blocks when the ManualResetEventSlim is set/signaled. It should block when it is reset/nonsignaled.

    Also the description of the Manual Reset Event challenge contains the incorrect behavior: "The Wait() method blocks if the "reset event" is "signaled" (it starts out nonsignaled).".

    The tooltip for the Wait method actually contains the correct behavior: "Atomic. Blocks until the ManualResetEventSlim's state is set to 'signaled'.".

    Method description from msdn: "Blocks the current thread until the current ManualResetEventSlim is set." and "The caller of this method blocks indefinitely until the current instance is set. The caller will return immediately if the event is currently in a set state."

  • Low-pri: Arbitrary code

    Low-pri: Arbitrary code

    Not really in original scope and very high-effort, but adding just to keep track of this.

    Some people requested editing the code. Arbitrary C# is probably unfeasible, but a limited subset might be doable.

  • Some typo's and href updates; fixes #50

    Some typo's and href updates; fixes #50

    See #50

    The pull-request fixes these:

    • System.Collections.Generic.Queue hyperlinks don't work as they contain the inner type
    • non-MSDN hyperlinks open in the same window as they miss target='_blank'
    • "Peterson Algorithm" -> "Peterson's Algorithm" and hyperlink

    Sorry for the tab->space conversion in one of the files. No offence, but most files were already space indented anyway and my dev-toolchain is completely space based so that was easier for me.

  • Monitor.exit() has hint about winning, Dequeue() not

    Monitor.exit() has hint about winning, Dequeue() not

    In level "Condition Variables", there is a tool tip about winning the level for Monitor.exit() (which does not help, does it?) but not for queue.Dequeue() (which might help). I'll open a PR.

  • infinite loop in Boss fight

    infinite loop in Boss fight

    infinite I made darkness and evil both 1 in first of loop, and entered lock twice (by releasing it in thread 1) in thread 0, then can never enter if in thread 1.

  • is this code in `ui.js` reachable?

    is this code in `ui.js` reachable?

    I think the ToString(...) function in variables.js already covers the below cases in ui.js so they can go:

                if (type.name.indexOf("Semaphore") != -1) {
                    valueRepr = 'SemaphoreSlim [count: ' + variable.value + ']';
                }
                else if (type.name.indexOf("Queue") != -1) {
                    valueRepr = 'Queue [element count: ' + variable.value + ']';
                }
    
  • Interlocked needs to be explained and an msdn reference

    Interlocked needs to be explained and an msdn reference

    http://deadlockempire.github.io/index.html?#H4-Barrier is the first level introducing Interlocked and Interlocked.Increment, but the class nor method are ever explained.

    So it needs explanation and a link to https://msdn.microsoft.com/en-us/library/system.threading.interlocked and/or https://msdn.microsoft.com/en-us/library/system.threading.interlocked.increment

  • Level

    Level "A more complex thread" - user should also win if `Thread 1` waits for `Thread 0` never releasing the `mutex` from `TryEnter(mutex)`

    Level "A more complex thread"

    The user should also win if Thread 1 waits for Thread 0 never releasing the mutex from TryEnter(mutex).

    In that case, Thread 1 stalls and Thread 0 loops forever.

    Related to #34 and #35

    From my notes (in reStructuredText format):

    +------------+--------------------------+
    | Part       | A More Complex Thread
    +============+==========================+
    | Objective  | 1. follow guidance steps
    |            | 2. break the code
    +------------+--------------------------+
    | Hint       | - have the threads deadlock each other
    +------------+----------------------------------------------------+
    | Steps      | Follow the guidance, then step threads:
    |            |   1. Thread 1: step until the second ``Monitor.Exit(mutex);`` (now ``flag`` has value ``true``)
    |            |   2. Thread 0: step until the second ``Monitor.Exit(mutex2);``
    |            |   3. Thread 1: step until the first ``Monitor.Enter(mutex2);``
    |            |   4. Thread 0: step until the first ``Monitor.Enter(mutex);``
    |            |   5. Thread 1: step until the first ``Monitor.Enter(mutex);``
    |            |   6. Thread 0: step until the first ``Monitor.Enter(mutex2);``
    +------------+----------------------------------------------------+
    | Learned    | - Concurrency issues sometime take multiple logic-flows to occur
    |            | - The order of locking matters again
    +------------+----------------------------------------------------+
    | Note       | There is second issue that won't win the level, but nonetheless:
    |            |   1. Thread 0: step until the first ``Monitor.Enter(mutex3);``
    |            |   2. Thread 1: step until the first ``Monitor.Enter(mutex);``
    |            | Since Thread 0 never exits ``mutex``, Thread 1 effectively hangs and Thread 0 loops.
    +------------+----------------------------------------------------+
    
Async++ concurrency framework for C++11

Async++ Async++ is a lightweight concurrency framework for C++11. The concept was inspired by the Microsoft PPL library and the N3428 C++ standard pro

Dec 30, 2022
Jan 4, 2023
The C++ Standard Library for Parallelism and Concurrency

Documentation: latest, development (master) HPX HPX is a C++ Standard Library for Concurrency and Parallelism. It implements all of the corresponding

Jan 3, 2023
The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware

Grand Central Dispatch Grand Central Dispatch (GCD or libdispatch) provides comprehensive support for concurrent code execution on multicore hardware.

Jan 3, 2023
Go-style concurrency in C

LIBMILL Libmill is a library that introduces Go-style concurrency to C. Documentation For the documentation check the project website: http://libmill.

Dec 31, 2022
A header-only C++ library for task concurrency
A header-only C++ library for task concurrency

transwarp Doxygen documentation transwarp is a header-only C++ library for task concurrency. It allows you to easily create a graph of tasks where eve

Dec 19, 2022
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all

concurrencpp, the C++ concurrency library concurrencpp is a tasking library for C++ allowing developers to write highly concurrent applications easily

Jan 3, 2023
HPX is a C++ Standard Library for Concurrency and Parallelism

HPX is a C++ Standard Library for Concurrency and Parallelism. It implements all of the corresponding facilities as defined by the C++ Standard. Additionally, in HPX we implement functionalities proposed as part of the ongoing C++ standardization process. We also extend the C++ Standard APIs to the distributed case.

Dec 30, 2022
Complementary Concurrency Programs for course "Linux Kernel Internals"

Complementary Programs for course "Linux Kernel Internals" Project Listing tpool: A lightweight thread pool. tinync: A tiny nc implementation using co

Dec 20, 2022
Yet Another Concurrency Library

YACLib YACLib (Yet Another Concurrency Library) is a C++ library for concurrent tasks execution. Documentation Install guide About dependencies Target

Dec 28, 2022
Task System presented in "Better Code: Concurrency - Sean Parent"
Task System presented in

task_system task_system provides a task scheduler for modern C++. The scheduler manages an array of concurrent queues A task, when scheduled, is enque

Dec 7, 2022
Laughably simple Actor concurrency framework for C++20

Light Actor Framework Concurrency is a breeze. Also a nightmare, if you ever used synchronization techniques. Mostly a nightmare, though. This tiny li

Dec 27, 2022
Libgo - Go-style concurrency in C++11
Libgo - Go-style concurrency in C++11

libgo libgo -- a coroutine library and a parallel Programming Library Libgo is a stackful coroutine library for collaborative scheduling written in C+

Dec 26, 2022
The RaftLib C++ library, streaming/dataflow concurrency via C++ iostream-like operators

RaftLib is a C++ Library for enabling stream/data-flow parallel computation. Using simple right shift operators (just like the C++ streams that you wo

Dec 24, 2022
CppThreadPool - The original intention of this project is to learn the new C++20 standard in use.

CppThreadPool Introduction The original intention of this project is to learn the new C++20 standard in use. Therefore, make sure your compiler suppor

Sep 27, 2022
THIS REPOSITORY HAS MOVED TO github.com/nvidia/cub, WHICH IS AUTOMATICALLY MIRRORED HERE.
THIS REPOSITORY HAS MOVED TO github.com/nvidia/cub, WHICH IS AUTOMATICALLY MIRRORED HERE.

About CUB CUB provides state-of-the-art, reusable software components for every layer of the CUDA programming model: Device-wide primitives Sort, pref

Dec 4, 2022
✔️The smallest header-only GUI library(4 KLOC) for all platforms
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

Jan 8, 2023
Cpp-concurrency - cpp implementation of golang style concurrency

cpp-concurrency C++ implementation of golang style concurrency Usage Use existing single header concurrency.hpp or run script to merge multiple header

Aug 11, 2022
Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system, which is traditionally commonly introduced in lectures on operating systems
Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system, which is traditionally commonly introduced in lectures on operating systems

42-philosophers Dining philosophers problem is a problem created by Edsger Wybe Dijkstra in 1965 to explain the deadlock state of an operating system,

Dec 26, 2022
Drake + Engine = DrakEngine. Here be dragons.

DrakEngine Drake + Engine = DrakEngine. Here be dragons. How to build Use premake5 with premake5.lua in the project root folder. Works with cmake and

Apr 17, 2022