C11 Re: [PATCH 3/6] termios: Use C11 mutex for input/output

Chris Johns chrisj at rtems.org
Tue Dec 20 22:37:34 UTC 2016


On 21/12/2016 08:20, Gedare Bloom wrote:
> I haven't fully understood the distinction. I get that C11 are
> individually (and collectively) smaller. I don't entirely get what is
> their time-space tradeoff or when they are less desirable.

There are a few advantages to self-contained resources like mutexes for 
an API like C11 and POSIX.

1. All major POSIX implementations work this way. The libstdc++ code 
base assumes it, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78677. 
The standard does say POSIX create calls can return an error however it 
seems to be assumed this does not happen. A change in RTEMS brings us 
closer to the major implementations in this regard.

2. Performance. Sebastian's work with LibBSD, which is documented in the 
recent v3 SMP report highlighted the cost in the object look up in 
various hot parts of the kernel. This alone is a significant piece of data.

3. Deterministic resourcing. If you can link an application and it fits 
in memory the resource is allocated. There is no need to account and 
adjust a configuration parameter in another area of the system. This 
combines well with function section linking where we only have the 
referenced code in the target executable which means only the referenced 
resources are included.

4. Self-contained objects help dynamic loaded resource configuration. 
You do not know what can or could be loaded dynamically and how 
resources may be used or shared. A central base image configuration 
leads to possible conflicts in resource allocation. The unlimited patch 
back in the mid-90's was one solution to this problem, self-contains 
objects is another.

> I would
> like to see a table that compares/contrasts these in a simple way to
> evaluate. I will try to look closely at these different approaches in
> a few weeks.

I hope the list above helps.

Chris


More information about the devel mailing list