Implement a thread-safe ride sharing system that assigns each passenger one driver.
Unlock detailed company stats for this questionUpgrade
Multiple passengers can request rides and available drivers take them on their journeys. Each passenger must be assigned exactly one driver, and no driver can take more than one passenger at a time. If all drivers are busy, passengers wait and are assigned to the first available driver. Drivers are reassigned immediately after they complete a ride. No two passengers are assigned the same driver simultaneously, and multiple passengers and drivers must interact concurrently without conflicts, with thread safety and no race conditions. Use ExecutorService, manual timeouts to simulate the system, and BlockingQueues and concurrent data structures. Part design, part algorithm.
Community answers
No answers contributed by the community yet.
Related questions
Design a system that assigns drivers to orders.Related courses

Course

Course
Course
