Discussion
A global variable shared between a handler and a task should be declared
Answer: C
Correct answer: volatile, and accessed atomically or under protection
Two distinct problems must both be addressed. volatile stops the compiler caching the value in a register, so each access reads memory. It does nothing about atomicity, so a multi-byte variable can still be read half-updated - which needs a critical section or an atomic type. Neither measure substitutes for the other.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development