Future directions

Hal Murray hmurray at megapathdsl.net
Tue Sep 17 09:25:35 UTC 2019


> This is exactly what futexes are for.

Is there a standard recipe for using them in shared memory when the processes 
using them can start/stop/crash at any time?

I see 2 problem areas.  One is initializing the futex.  The other is 
recovering from a crash while the futex was busy.  (lock locked, or whatever)

-----------

The man page for shmget says a new segment is full of 0s.  If we assume the 
writer will create the segment, it can use a flag in the segment to mark that 
whatever a futex needs has been initialized.

I assume the same logic works for a mutex and semaphore so we can do it with 
POSIX code.

I haven't worked out the details, but it looks like pthread_mutex_lock and 
friends return an error if the thread/process owning the mutex crashes.

Using the futex/mutex requires that the reader be able to write the segment.

Thanks for the poke.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list