Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 4.37 KB

File metadata and controls

99 lines (70 loc) · 4.37 KB

FinalBusDepot

A concurrent programming simulation built in Java in order to determine the optimal number of ramps to install in a Bus Depot, which is cost effective and minimizes the bus wating times. Currently, the bus depot is losing customers as some buses have long waiting times.

Getting Started

Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Contact

About The Project

In this bus depot, the Buses have to enter and exit from the same ramp which can only pass one bus at a time. Each bus takes 30 seconds to cross the ramp. The aim is to determine the maximum waiting times of each bus and the number of buses that can pass during a day, so that we can deduce whether there is a need for an additional ramp to be built. Each bus waits to enter until the ramp is free and then goes inside and waits again until they can proceed to either the Cleaning Bay or Mechanics Bay depending on the service that the bus needs. At that point cleaners/mechanics will service the buses and then they will proceed back to the waiting area until the ramp opens and it can exit. Since these processes occur simultaneously, and some of these entities happen to be sharing one or more resources at the same time, we utilized concurrent concepts which would allow threads of each entity, such as Bus, Cleaners and Mechanics to be created and intelligently link the resources among them, so that each entity gets a fair share of the resources. Concepts such as semaphore, synchronization, locks, and countdown latches are utilized to simulate and mimic this behaviour.

Built With

Java

Assumptions

Just like the real world, the threads are generated at random time intervals. Once a Bus starts enters the Bus Depot, it does not leave until it finished the service it came for.

Default settings

Application does not rely on user inputs. Each thread has a predefined time for sleeping based on the activities happening. Time stamp is used throughout the Bus Depot class, where each class uses the timestamp for each process that occurs.

Executing program

Application only has a console UI (has no graphical interface) so can be run on any terminal.

License

Not Licensed.

Contact

N4ZEN- naza.zuhair@gmail.com

Project Link: https://github.com/N4ZEN/Simulation-Java-Multithreading

(back to top)