[NSWI004] a04 no-interrupt best practices

Petr Tuma petr.tuma at d3s.mff.cuni.cz
Sun Nov 29 17:06:20 CET 2020


Hello Jakub,

I think you are in fact answering yourself by the very act of asking - it is not a good sign if you are not sure what can be going on in your code :-) that said, there are certainly systems that are so complex one cannot be sure, only we kind of hoped your assignments will not grow into that size :-)

 From the OS implementation perspective, disabling interrupts is an operation that should be used sparingly, and for minimum duration possible. In a real system it does not avert most problems because it is processor local.

Petr


On 29/11/2020 15:21, Jakub Pelc wrote:
> Hello,
> 
> I've encountered a few (short) functions where I think switching threads at any point should not break anything, but I'm not 100% sure, so I disabled interrupts in this code. Is this the right approach? What are the best practices with this kind of "defensive" synchronization?
> 
> Best regards,
> Jakub Pelc
> 
> _______________________________________________
> NSWI004 mailing list
> NSWI004 at d3s.mff.cuni.cz
> https://d3s.mff.cuni.cz/mailman/listinfo/nswi004
> 


More information about the NSWI004 mailing list