In computer programming a critical section is a piece of code that can only be execution (computers) by one computer process or thread at a time. It will usually terminate in fixed time and a process will only have to wait a fixed time to enter it. Some synchronisation mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore (programming).
By carefully controlling which variables are modified inside and outside the critical section (usually, by accessing important state only from within), concurrent access to that state is prevented.