xiaoxiang781216 commented on PR #16194:
URL: https://github.com/apache/nuttx/pull/16194#issuecomment-2854659321

   > > @patacongo could you give some comment about this problem?
   > 
   > If this feature is removed, you will re-introduce priority inheritance 
issues and damage realtime performance. That is why that code is there in the 
first place.
   > 
   
   Only the multiple holders is removed, the single holder still track and 
adjust the priority as needed. Here is the reason why the multiple holders 
track is wrong and should be removed:
   
   Counting semaphore is normally waited(event) in one thread, but 
posted(event) in another thread(or even interrupt context), the holder doesn't 
make any sense and totally wrong in this case. The holder concept only make 
sense when the sem_wait and sem_post is called in the same thread(binary 
semaphore case).
   
   > POSIX does not specify the implementation of a realtime system and, hence, 
does not address these implementation issues.
   > 
   > POSIX permits implementations and features not addressed by POSIX. POSIX 
only addresses minimum funtions and only for application interfaces. It is 
completely permissible to support additional functionality. POSIX places no 
requirements on the internal implementation of an OS; only on the external, 
application interface provided by the OS.
   > 
   
   No, POSIX does define the priority inheritance and priority ceiling in the 
spec:
   
https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutexattr_setprotocol.html
   both are implemented in NuttX now for pthread_mutex/mutex(binary semaphore).
   POSIX never define the priority inheritance and priority ceiling for 
counting semaphore.
   
   > Do not remove this functionality it is critical for the correct operation 
of the OS and would cause the loss of realtime performance.
   
   Let's summary that the suggestion:
   
   1. Keep the binary semaphore priority inheritance and priority ceiling 
feature by tracking one holder
   2. Remove the code which track multiple holder for counting semaphore since 
it never work as expect and impact the real time
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to