sem_t in 64bit linux is 32 bytes, but with futex implementation, 8bytes is enough(glibc sem_post), is it true? if it is true, why make it wasting bytes?
Actually I want to use a custom semaphore implementation which use only 8bytes, thus using one semaphore to one date entry is possible. But I am not pretty sure the other bytes in glibc's implementation is just padding.
Just for my instrest, I am not going to use custom semaphore in work.
AFAIK glibc
needs to be portable across different Linux kernels and differing thread modules. Therefore, it reserves 32 bytes of space (4 machine words) for the structure, in the event that other systems need the extra room for bookkeeping.
If you want to do your own thing with futexes, go right ahead; as you say, you'll only need 8 bytes to do it with a futex.