Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation


🚦 Traffic Intersection Simulation System

A multi-threaded traffic intersection simulation implemented in C++ to demonstrate fundamental Operating Systems concepts such as process management, synchronization, inter-process communication, and priority scheduling.


📌 Overview

This project simulates a traffic control system with two intersections (F10 and F11). Vehicles of different types are generated concurrently and must safely pass through intersections while respecting traffic light phases, parking limits, and emergency vehicle priority.


✨ Features

  • Two independent intersections (F10 & F11)
  • Multiple vehicle types including emergency vehicles
  • Priority-based scheduling for ambulances and fire trucks
  • Traffic light phases (North–South / East–West)
  • Parking system with limited capacity
  • Thread-safe shared resource management
  • Real-time terminal output and final statistics

🧠 OS Concepts Demonstrated

  • Multithreading using POSIX threads (pthread)
  • Synchronization with mutexes, semaphores, and condition variables
  • Process creation using fork()
  • Inter-process communication using pipes
  • Priority scheduling and resource management

🚀 Compilation & Execution

g++ -pthread traffic-intersection-simulation.cpp -o traffic_sim
./traffic_sim

Press Ctrl+C to terminate the simulation safely.


⚙️ Configuration

Simulation parameters such as vehicle count, parking capacity, and traffic light duration can be modified at the top of traffic-intersection-simulation.cpp.


📁 Project Files

  • traffic-intersection-simulation.cpp – main source file
  • README.md
  • LICENSE

About

A multi-threaded C++ traffic intersection simulation demonstrating process management, synchronization, IPC, and priority scheduling.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages