LLD - Design — Parking Lot System
A developer wrote this pseudocode for two threads incrementing a shared counter:
Thread 1: lock.acquire() counter += 1 lock.release() Thread 2: lock.acquire() counter += 1 lock.release()But the counter sometimes ends up incorrect. What is the likely mistake?
