Giter Site home page Giter Site logo

nikoletos-k / bus-station-simulation Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26 KB

🚌 🚦 Standalone programs that run at the same time and simulate the operation of a Bus Station

License: MIT License

Makefile 4.16% C 95.49% Shell 0.35%
fork exec c shared-memory-communication semaphores multiprocessing process-communication

bus-station-simulation's Introduction

Bus-Station-Simulation

Standalone programs that run at the same time and simulate the operation of a Bus Station. Project tsk is to get familiar with multiprocess programs, shared memory, signals and semaphores. This project was part of the subject Operational Systems in my bachelor.

Files included

  1. create_configFile.c : Program that creates the configuration file
    Run with ./create_configFile , with the following options-flags:
    • -c bay_maxCapacity (upper bound-random)
    • -p max_number_of_passengers (upper bound-random)
    • -t max_parking_time (upper bound-random)
    • -b number_of_buses that will be created
    • -m time in seconds that manuver will last
    • -d seconds for comptroller to print current situation of station
    • -st .. for statistics
    • -wt time that program mystation will need in order to end ,in case of multiple ttys
  2. utils.c : useful functions for bus.c,stationmanager.c,comtroller.c
  3. utils.h: include file
  4. bus.c

Program execution

Compile: make
Execution cmds:

  • Bus: ./bus -t type -n incpassengers -c capacity -p parkperiod -m mantime -s shmid
  • Station manager: ./station-manager -s shmid
  • Comptroller: ./comptroller -d time -t stattimes -s shmid
  • System: ./mystation -l configfile

Implemented 3 of types processes where each has a different role. The three types of processes are:

  1. Buses wishing to enter the station, disembark passengers, stay for someone finite period of time and finally after receiving passengers to leave. The buses travel to different parts of the country which are:
    • Attica, Central & Central Greece (ASK),
    • Peloponnese (PEL), and
    • Northern Greece (VOR).
  2. Station manager.
  3. Station operation monitor (comptroller).

Project functionality

The above types of processes are standalone programs that can run at the same time to implement collaboratively what is happening in the area of a bus station.

Every bus that arrives at a random time wants to enter the station, to park on the islet instructed to disembark passengers, to wait for a period of time, to board the public who has bought tickets, and leave.

Before entering the station, every bus should consult with the station-manager in order to get the relevant ok but also to be informed about the islet who will eventually be able to park.
After the station-manager makes sure it does not there is too much traffic in the station area, it gives ok to one of the many buses waiting off station to proceed. This vehicle enters, parks, and stays in the specific location has been given for as long as it takes to complete the unloading / loading process passengers.
The role of the station – manager is to supervise the safe operation of the infrastructure and to record in a log (reference ledger) all the activity that takes place at the station.

Depending on the arrival time and the travel area of the bus, for each vehicle, the reference ledger lists the relevant information such as time of arrival, number plate, bus type, final parking location (or island), number of passengers disembarking and status of the vehicle that has arrived (ie vehicle present at the station). When a bus has to depart and after a number of passengers have boarded, it follows the Expected sequence of events: comes to an agreement and waits to get ok from the station– manager.

When the latter issues a departure order (after clarifying that there is no other outgoing / incoming traffic), the ledger shall indicate the time of the said departure of the vehicle, number passenger status, and changed status (ie vehicle has left a station). The comptroller is an independent program that regularly provides the status to Station (ie which and how many buses are present).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.