A global data structure and some hardware registers are being accessed for read
ID: 3590941 • Letter: A
Question
A global data structure and some hardware registers are being accessed for read and write operations inside an interrupt service routine. The same global data structure and hardware registers may also be accessed by a single protocol task. Select all that applies for each of the following questions.
4. A software engineer concerned about a potential data corruption, uses mutual exclusion semaphores (mutex) to protect the shared resources inside both protocol task and the interrupt service routine. Do you agree with his design choice?
A) Yes, it is safe to use a mutual exclusive semaphore since we only have a single task accessing the shared resources.
B) No, because use of mutex is not needed since there is no chance of data corruption
C) No. Use of mutex inside ISR is a bad idea since may result in a deadlock.
D) Yes, since both ISR and protocol task have read/write access to these resources, they must be protected by means of mutual exclusive semaphore
Explanation / Answer
Answer is as follows:
YES, I am agree with software engineer for using the mutex to protect the shared resources.
there are very less or approximate 0.01 % chances of deadlock inside ISR so there are no problems.
by providing security to data we can eliminate the chances of data corruption.
So, we can use Mutex since both ISR and protocol task that have read and write access to resources.
They are protected by means of Mutex
So the answer is D
if there is any query please ask in comments...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.