Exams › GATE › Technical › Computer Science and Information Tech - CS
1 questions with worked solutions.
Answer: fails as L can take on a non-zero value when the lock is actually available
The implementation fails because the Fetch_And_Add operation increments L even when it is already non-zero, which means that the lock can appear to be held (non-zero) even when it is actually available (zero). This can lead to situations where a process believes the lock is not available when it is, causing incorrect behavior.