Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poissonSIM- A Bank Queue Simulator

C License

Wanna simulate a banking queue using a Poisson PMF? You're in the right place !!!

poissonSIM is a C program that simulates a bank’s customer queue over an 8-hour working day (480 minutes) using probability-based customer arrivals modeled by the Poisson distribution.
It’s written in C and demonstrates the use of linked lists, dynamic memory allocation, and basic data analysis.

The simulation tracks each customer’s arrival and service times to calculate:

  • Average (mean) wait time
  • Median and mode wait times
  • Standard deviation
  • Longest wait time observed

The program helps estimate whether an additional teller is needed based on simulated queue performance.


Features

  • Poisson arrival model using Knuth’s algorithm (references mentioned at the end)
  • Queue implementation via singly linked list
  • Dynamic tracking of wait times with malloc and realloc
  • Statistical report generation at the end of simulation

Concepts Used

C:

  • Basic C concepts like loops, conditionals, pointers, etc.
  • Structs, rand() function & dynamic memory allocation using malloc and realloc
  • File modularization (.c / .h files)
  • Singly linked-list implementation in C

Math:

  • Probability and Poisson process
  • Basic statistical analysis in C
  • Random variate generation from the Poisson Distribution with given lambda

File Structure

├── main.c # Simulation driver
├── queue.c/.h # Queue implementation
├── stats.c/.h # Statistical analysis functions
├── LICENSE
└── README.md


How to compile and run the program?

### compile:
gcc main.c queue.c stats.c -o <your output file name> -lm
### run:
./<your output file name>
### when prompted, enter the average customer arrival rate(lambda)

Example:

gcc main.c queue.c stats.c -o bank -lm
./bank

Output:

Average Wait Time: 3.42 minutes
Median Wait Time: 2.95 minutes
Mode Wait Time: 1.60 minutes
Standard Deviation: 1.25
Longest Wait Time: 8.50 minutes

Purpose

This project demonstrates how stochastic processes and data structures can be combined to simulate real-world queuing systems like those in banks, hospitals, or call centers.


References

About

Bank queue simulation using Poisson distribution

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages