It would be interesting to have more CPU support for critical sections. You could have an option to prevent interrupts on a fence instruction during short critical sections. Interrupts would be prevented for a maximum number of instructions set by an operating system controlled register, so user threads couldn't lock up a CPU. Running out the instruction count would cause an exception interrupt. The limit on number of instructions would be small; maybe 10 or 20.
Side issue: what about page faults in critical sections? Should critical sections be allowed to cross page boundaries?
Side issue: what about page faults in critical sections? Should critical sections be allowed to cross page boundaries?