Skip to content

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.

Notifications You must be signed in to change notification settings

shriroopjoshi/mutual-exclusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published