[haiku-gsoc] Re: [HCD]: xsi semaphore - kernel side

On 2008-06-15 at 23:26:45 [+0200], Salvatore Benedetto <emitrax@xxxxxxxxx> 
wrote:
> 
> time for me to use this mailing list.
> 
> I'm looking at the current implementation of haiku semaphore and I see that
> during boot a few pages, it depends on the number of semaphore, is allocated
> in order to store semaphore slots. I guess for performances reason.
> 
> Now I'm wondering if I should do the same for the xsi semaphore, even though
> only ported application (currently none) will used it, or create them run 
> time
> when I needed? The latter would avoid waisting a few MB of probably
> unneeded memory
> when xsi semaphore are not used.

Please just use a hash table (key_t -> semaphore object).

Regarding key_t, I believe it should be defined to a 64 bit integer type. 
ftok() should probably return ((<node ID> << 8) | (id & 0xff)). This is far 
from perfect, since we cannot guarantee that the IDs are unique this way, but 
I think it's the best we can do, since key_t needs to be an integer type and 
we've got 71 bits of information to encode.

CU, Ingo

Other related posts: