Code Monkey home page Code Monkey logo

ios-deadlock-tester's Introduction

IOS project 2. Deadlock tester

A simple bash script that tries to find deadlock by running proj2 executable 160 times. First suite of tests are simple, with no noise functions runnig. Second suite of tests run noise functions and increas the chance of deadlock. After finding a deadlock, script will stop and kill all proj2 processes. When automatic deadlock detection is disables, it needs to be killed by pressing ctrl-c or killall deadlock.sh command.

Usage

  1. Make script executable by:
chmod +x deadlock.sh
  1. Run in a directory with compiled project executable named proj2:
./deadlock.sh 3 2 100 100 100
  1. Example (in your Makefile):
deadlock: all
    @./deadlock.sh 5 3 0 0 0
    @./deadlock.sh 1 3 10 10 0
    @./deadlock.sh 3 2 100 100 100
    @./deadlock.sh 33 22 100 100 1000
    @./deadlock.sh 100 100 100 100 1000
  1. Disable automatic deadlock detection (optional argument -d):
$ ./deadlock.sh 100 100 100 100 0 -d
Info: automatic deadlock detection disabled
Test 1: (no noise)
[################################################################################] 9189 ms
Test 2: (random noise)
[############################

Output

when no deadlock is detected:

Test 1: (no noise)
[################################################################################] 210 ms
Test 2: (random noise)
[################################################################################] 1426 ms
You are awesome! No deadlock detected!

when deadlock ocurs:

Test 1: (no noise)
[################################################################################] 9285 ms
Test 2: (random noise)
[#############
Deadlock detected! Output file was not changed in 1 second. Killing program.
Terminated
[1]    253046 terminated  ./deadlock.sh 100 100 100 100 0

wrong input:

Usage: ./deadlock.sh NZ NU TZ TU T (-d)
  NZ: Number of customers
  NU: Number of officials
  TZ: Maximum time in miliseconds, that customers waits after creation and before they
      enters the post office (eventually leaves, when post office is closed)
  TU: Maximum time of official break in miliseconds
   F: Maximum time in miliseconds in which post office is open for new customers
  -d: Disable automatic deadlock detection (optional)

ios-deadlock-tester's People

Contributors

matushubinsky avatar safarradim avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

safarradim

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.