Manhattan associates Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
Critical section is the area of the code/instruction that should be executed atomically. Like writing to a shared port, shared file or a shared memory. Some languages provide a buildin features to overcome from it like semaphore and mutex class in java.
The easy way is to locking the shared resources by threads/processes:
eg:
acquireLock()
critical Section
releaselock()
critical section is a piece of code that accesses a shared resource (data structure or device) that must not be concurrently accessed by more than one thread of execution. A critical section will usually terminate in fixed time, and a thread, task or process will have to wait a fixed time to enter it (aka bounded waiting). Some synchronization mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore.
- Sam March 02, 2012