Re: What are the __retarget_lock functions?
Sebastian Huber <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On 10/09/2018 10:53, Freddie Chopin wrote: > On Sun, 2018-09-09 at 10:59 +0200, Thomas Kindler wrote: >> There are some things I'm not yet happy with: >> >> 1. Each lock takes about 80 bytes > This is easily solvable (; Just stop using FreeRTOS (; > > OK, but seriously. This is a consequence of FreeRTOS design, where > "everything is a queue". Your mutex is in fact a queue with length > zero, so it has dozens of useless member variables, which finally add > up to ~80 bytes. In my opinion (which is of course biased and > subjective), this design decision is extremely stupid. > > In other RTOSes (including distortos - the one I'm writing), the mutex > is usually ~20-24 bytes long, so it's ~3-4x smaller, while having a lot > more features (like selectable protocol or selectable type). > The 80 bytes for a mutex object are quite a lot. Even on RTEMS, which supports SMP systems and complex locking protocols, a recursive mutex needs just 24 bytes (32-bit target): https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob_plain;f=newlib/libc/sys/rtems/include/sys/lock.h;hb=HEAD On a uniprocessor RTOS two or three pointers and an integer should be enough to implement a recursive mutex with support for priority inheritance. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : [email protected] PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.