Work
Academic Group Project·2026·1st Semester 2025/2026

Distributed Urban Traffic Simulator

Multi-process distributed traffic simulation engine in Java featuring 10 independent JVM nodes communicating via custom TCP Socket protocols, multi-threaded concurrency, adaptive traffic light policies, dynamic routing algorithms, and a real-time 20 FPS Swing graphics dashboard.

Section 01

Simulating urban traffic with distributed multi-process nodes.

Developed for the Distributed Systems course at Politécnico do Porto, this platform simulates complex vehicle flows (Motorcycles, Cars, Trucks) across a multi-intersection urban network where system components run as 10 independent OS processes on separate JVMs.

The solution implements client-server TCP socket communication using a custom binary envelope protocol, lock-free concurrent data structures (ConcurrentLinkedQueue, AtomicLong), dedicated traffic light control threads, and a custom Java Swing desktop dashboard rendering real-time map animations at 20 FPS.

10Independent JVM Processes
4Traffic Light Policies
4Routing Algorithms
20 FPSReal-time Swing Map Animation
Distributed Urban Traffic Simulator

Real-time interactive map animation rendered at 20 FPS in Java Swing with live vehicle position tracking

Section 02

The Problem & Key Challenges

Simulating high-density urban traffic requires coordinating distributed network components without central bottlenecks while accurately tracking vehicle progression, queue formation, and traffic signal cycles.

The system decouples vehicle generation (EntranceProcess), queue & signal processing (IntersectionProcess), destination tracking (ExitProcess), and real-time visualization (Coordinator) across 10 independent processes.

Key Engineering Challenges
  • Coordinating 10 concurrent JVM processes over custom TCP Sockets without message loss or race conditions
  • Designing a custom TCP binary serialization envelope supporting 11 distinct event & metric message types
  • Implementing real-time adaptive traffic light policies dynamically calculating queue density (AdaptiveDensityPolicy) and wait times (AdaptiveWaitTimePolicy)
  • Designing queue-based dynamic vehicle routing algorithms (QueueBasedRoutingPolicy) with live metric cache fallbacks
  • Building a 20 FPS custom interactive map animation & analytics dashboard in pure Java Swing (Graphics2D) without external libraries
Section 03

Architecture & Technical Decisions

Distributed multi-process architecture with 10 independent JVM processes communicating via TCP Sockets using Java object serialization and custom envelope protocols.

System Topology & Component Flow Diagram
Loading architecture topology...
Why This Architecture
  • True process isolation: process crashes do not cascade, mimicking real distributed edge nodes
  • Asynchronous TCP socket communication prevents blocking vehicle flow between intersections
  • Dedicated traffic light control threads ensure precise timing independent of network socket I/O
  • Centralized Coordinator aggregates metrics and renders GUI at 20 FPS without altering simulation logic
Section 04

Tech Stack & Infrastructure

OpenJDKJava
Socket.ioTCP Sockets
Multithreading
Java Swing