Planning to take coaching on Unacademy
http://bit.ly/gate_unacademy
or
https://unacademy.com/
here is a code for 10% off PLUS1BPK1
Telegram Notification Group link:-
https://t.me/joinchat/X5egW_cvdt9kMGY1
Telegram discussion Group link:-
https://t.me/joinchat/VCyGUmVq8RNkMzhl
Downloads resources from here
https://education4fun.com/gate-cse/
MCQ (Single Correct Answer)
GATE CSE 2012
Fetch_And_Add (X, i) is an atomic Read-Modify-Write instruction that reads the value of memory location X, increments it by the value i, and returns the old value of X. It is used in the pseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variable initialized to 0. The value of 0 corresponds to lock being available, while any non-zero value corresponds to the lock being not available.
This implementation
A) fails as L can overflow
B) fails as L can take on a non-zero value when the lock is actually available
C) works correctly but may starve some processes
D) works correctly without starvation