shriroopjoshi / mutual-exclusion

This repo contains implementation of Peterson's tournament algorithm and Lamport's bakery algorithm for mutual exclusion. It a part of programming project for Multicore Programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mutual-exclusion

This project contains implementation of mutual exclusion algorithms - Lamport's bakery algorithm and Peterson's tournament algorithm. Multiple threads request for lock for execution of critical section. Algorithm to use for mutual exclusion is given input at runtime. Each thread requests lock once, executes critical section and exits. It records the time required to enter and exit critical section, and stores it in a CSV file. This implementation is in C++11.

System requirement

  1. GCC (or any other compiler using C++11)
  2. make utility

How to build

Navigate to the root directory of the project and make the project.


$ cd mutex
$ make clear
$ make

How to execute

Execute the binary file with options. You need to specify the algorithm to use, number of threads to start. You can also specify the path of the output file.


$ ./mutex   []

To execute for bakery algorithm with 500 threads:


$ ./mutex bakery 500 ../bakery.csv

About

This repo contains implementation of Peterson's tournament algorithm and Lamport's bakery algorithm for mutual exclusion. It a part of programming project for Multicore Programming.


Languages

Language:C++ 91.7%Language:Shell 5.7%Language:Makefile 2.6%