Skip to content

JanekDev/museum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The museum - a concurrent programming project

This was a project for the Operating systems with concurrency programming course.

Introduction

The museum has 2 halls - A and B with limited capacity and CA > CB. Some of the visitors want to go to the A hall and leave, others want to visit both exhibitions. This environment was used to formulate two problems:

  1. Maximize the number of visitors who visit the museum at the same time.
  2. Allow people from hall B to leave the museum as fast as possible.

Solution

Problem 1

My take on the first problem was to allow the visitors to fill hall B while always leaving one spot free in hall A. This solution prevents deadlock that could occur when the visitors are trying to fill the full hall B while maximizing the number of visitors who visit the museum simultaneously. The implementation of this solution is based on the following idea:

  1. Counting semaphores sem.A and sem.B initialized with respectively CA-1 and CB are used to control the number of visitors who can enter the specific hall.
  2. A mutex mutex.B is used to allow only one visitor to leave hall B at a time.

Problem 2

For the second problem, the solution is to reserve empty spots in hall A to allow the visitors to leave hall B as fast as possible. I implemented this solution by using two semaphores sem.A and sem.B initialized with respectively CA and CB.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published