Re: Question about pthread_process_shared attribute



chsalvia@xxxxxxxxx wrote On 10/15/07 08:07,:
For interprocess synchronization mutexes, it seems some
implementations of posix threads support a PTHREAD_PROCESS_SHARED
flag, which can be used so that a mutex can work between processes,
rather than only between threads.

I have two questions about this:

1: In order for inter-process synchronization to work, does the
pthread_mutex_t object need to be placed in shared memory?

Suppose the mutex resides in Process P's private
memory, not shared with other processes. Now explain
how Process Q locks and unlocks a mutex that it can't
get access to, that it can't even see.

"It was on display in the bottom of a locked filing
cabinet stuck in a disused lavatory with a sign on
the door saying `Beware of the Leopard'." -- HHGttG

--
Eric.Sosman@xxxxxxx
.



Relevant Pages

  • Re: How to implement synchronous rpc between 2 processes on the same machine.
    ... DOORS(it is a properietry and quite efficient IPC by SUN) ... there to just review this design and provide your much needed inputs. ... Multi-process shared memory impls need to think about misbehaving process.. ... non-blocking timed mutex in there. ...
    (comp.programming.threads)
  • Re: temporary disable thread switching using pthreads
    ... which prevents the scheduler from scheduling ... protect this flag. ... If a resource is protected by a mutex, ...
    (comp.programming.threads)
  • Re: event driven paradigm
    ... This last paragraph sounds like you are confusing threads and processes. ... If you have a multi-process model, then the sockets or pipes with ... In contrast to your assumption of my "shared memory" ... creating a mutex per thread and signal the mutex to wake up each thread ...
    (comp.programming.threads)
  • Re: PTHREAD_PROCESS_SHARED on GNU/Linux
    ... a stock Linux kernel won't release the lock on behalf of the ... mutex, so you'd probably have to stop everything and re-initialize the ... shared memory if any process dies unexpectedly. ... If a process dies unexpectedly while holding a mutex, ...
    (comp.programming.threads)
  • Re: Shared-memory between threads and synchronization
    ... In my project i am having different data structures ... process and shared memory should be accessed between different ... co-ordinate activities just through a mutex. ... If the scheduled thread doesnt need the mutexed resource, ...
    (comp.os.linux.development.system)