Skip to content

LastLombax/SOPE1617

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SOPE1617

Description

Queue management for saunas, with a multi-threaded system, using two different programs

Usage

Generator Program

Invocation: ./generator <max. usage>

The program prints all requests since its creation. It also keeps the rejected requests and prints them in the end. In the end, some statistics are presented.

There is also an implementation of the SIGINT signal to be detected by the sauna program to end both programs.

In the file ger.pid, where pid is the process ID, there are several information regarding the program's execution. Each line is in the format, inst – pid – tid – p: g – dur – tip, for each request.

Sauna Program

Invocation: ./sauna

The program prints, initially, the initial queue and, for each change, it prints the new queue, like entrances, rejections, exits, if the queue is empty, etc. In the end, some statistics are presented.

In the file bal.pid, where pid is the process ID, there are several information regarding the program's execution. Each line is in the format, inst – pid – tid – p: g – dur – tip, for each request.

Race Conditions

During the development of the sauna.c file, there was some competition regarding access to the shared elements, like sauna seats and number of people inside the sauna.

  • To fix the first competition, it was created an array of semaphores.
  • To fix the second competition, the number of people that are in the sauna are reduced in the end of each thread. To fix possible race conditions, a mutex was created that locks before the decrement of number of people and unlocks after the said decrement.

Authors

Name Number Profile
João Santos 201504013 jotadaxter
José Azevedo 201506448 zemafaz
Vitor Magalhães 201503447 LastLombax

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published