operating system - Why all the interrupts must be disabled during semaphore operations? -


i reading operating system concepts galvin. in semaphore section says all interrupts processor must disabled while modifying value of semaphore. why required?

modifications semaphore values must done atomically. on single core system, can done disabling interrupts read/modify/write operation(s) change semaphore cannot interrupted.

on multicore system disabling interrupts not enough, multicore capable processors have atomic instructions modification. example, on intel/amd processors there lock prefix make instruction execute atomically.

so galvin not right.


Comments