yamt commented on issue #14593:
URL: https://github.com/apache/nuttx/issues/14593#issuecomment-2458792385

   > > what do you recommend to use instead?
   > > mutex? semaphore? spin lock?
   > 
   > Based on the program logic, deciding which synchronization strategy to 
use, I believe that if the protected region executes quickly without context 
switching, spinlock is the preferred choice and recursive locks should not be 
used.
   
   i feel a bare spinlock is too primitive for many cases.
   
   > > how do you think about introducing a bit higher-level primitives for the 
kernel? eg. solaris-like adaptive mutex
   > 
   > I don't think adaptive mutex is a good idea.
   > 
   > Using general locks strategy can easily lead to abuse and a decline in 
code quality. We need more precise lock behavior, especially in RTOS, where 
more precise time control and good programming practices are required.
   
   although it doesn't need to be adaptive mutex (it was just an example)
   it would be nice to have a small set of api, which can cover 90% of use 
cases.
   
   > Just like critical sections in NuttX, which are used everywhere and 
significantly degrade performance in smp complex scenarios.
   
   well, a typical implementation of adaptive mutex would be far better than a 
system global critical section
   even for a RTOS.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to