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.
- Poisson arrival model using Knuth’s algorithm (references mentioned at the end)
- Queue implementation via singly linked list
- Dynamic tracking of wait times with
mallocandrealloc - Statistical report generation at the end of simulation
- Basic C concepts like loops, conditionals, pointers, etc.
- Structs, rand() function & dynamic memory allocation using malloc and realloc
- File modularization (
.c/.hfiles) - Singly linked-list implementation in C
- Probability and Poisson process
- Basic statistical analysis in C
- Random variate generation from the Poisson Distribution with given lambda
├── main.c # Simulation driver
├── queue.c/.h # Queue implementation
├── stats.c/.h # Statistical analysis functions
├── LICENSE
└── README.md
### 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)gcc main.c queue.c stats.c -o bank -lm
./bankOutput:
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 minutesThis 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.
- Knuth's algorithm - Wikipedia notes
- Knuth's algorithm (other ref) - An article by John D. Cook
- Memory allocation in C - Amazing tutorial by w3schools
- Linked List Basics - Stanford edu explained linked list from the very beginning
- Linked List video tutorial - Jenny mam explained it so beautifully