Token and Leaky Bucket Implementation and Explanation or rather rate limiting is a technique used to control the rate of traffic on a network. These are implemented using Congestive-Avoidance Algorithms (CAA), namely Token and Leaky Bucket algorithm.
Let us divide Parking Lot – System Design HLD into two main points, one is entry and other is exit. In entry we should provide tickets to end user by querying the DB and save / update the details accordingly. And in exit the payment is processed and vehicle is marked for exit and parking db is updated.
A Race Conditions In Distributed Or Multithreaded System generally occurs when there are multiple threads or clients trying to access the same resource at one point of time resulting in an inconsistent, unavailable and faulty behaviour.