Interview Question

Interview Houston, TX

If you have two devices that can interrupt your program and

  you want to give priority and atomicity to one of the processes over the other, but you cannot use a semaphore or mutex, how would you do it?

Interview Answer

3 Answers


Use an interrupt mask.

Interview Candidate on May 24, 2012

How would an interrupt mask help? What if the threads are dependent on each other? What if they use the same resource?

Viewer on Dec 10, 2012

The answer is that the process who needs to be atomic and is more-important will disable interrupts. The remaining process is therefore prevented from operation until the primary process completes its task, then it re-enables interrupts just after the atomic section.

OP on Dec 12, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.