Question Description
Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared
according to
the GATE exam syllabus. Information about Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam.
Find important definitions, questions, meanings, examples, exercises and tests below for Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE.
Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of
Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an
ample number of questions to practice Fetch_And_Add(X,i) is an atomic Read-Modify-Write instruction that reads the value ofmemory location X, increments it by the value i, and returns the old value of X. It is used in thepseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variableinitialized to 0. The value of 0 corresponds to lock being available, while any non-zero valuecorresponds to the lock being not available.AcquireLock(L){while (Fetch_And_Add(L,1))L = 1;}ReleaseLock(L){L = 0;}This implementationa)fails as L can overflowb)fails as L can take on a non-zero value when the lock is actually availablec)works correctly but may starve some processesd)works correctly without starvationCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice GATE tests.