Multiprocessing systems are programmed cleanly using Critical sections. When a process desires to access some shared data it first gets mutual exclusive access to critical sections for reliable outcome as processes may possibly manipulate the data. This work investigates how critical section problem can be solved easily and efficiently for multiprocessing and distributed systems. This report presents an algorithm that can solve the problem in single processing, multiprocessing and distributed systems efficiently with minimal changes. For distributed systems we introduce message passing service while keeping rest of the mechanism same works faster than many other algorithms for distributed systems. The algorithm compares its efficiency with bakery’s algorithm and performs much better with the liberty of introduction of multiple critical sections for dissimilar shared data. Due to this multiple processes can execute in different critical sections concurrently.