문제

As I understand that, if there is some data in interrupt handler which is shared with other process, it should be protected using spin lock, also we need to disable the local interrupt. But what if the data is shared between multiple interrupt handler, how can I protect it ?

도움이 되었습니까?

해결책

Whenever there is a critical section (CS) that can be run in interrupt context, you use a spinlock to protect it, it does not matter if the CS is shared between interrupt handler and a process or between interrupt handlers.

The reson why you do not use semaphore or mutex is obvious, because you can't sleep in interrupt context.

다른 팁

Interrupt handlers are nonpreemptible and non-reentrant, hence there is no scope of concurrent access to data.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top