Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Shared mutex and procnto fault: (3 Items)
   
Shared mutex and procnto fault  
I try to make benchmark for shared memory with semaphore, mutex and rwlock.
I init mutex with shared options in created shared segment, create one more shared segment with data, close it all, then
 fork, open it all in both processes and send/receive data (procnto with the -s option). After work with shared memory 
child process die, parent destroy mutex and shared mem.

And in this case i have a procnto fault(dump attached). App can work succesfully couple of times (count performance and 
show result) or not, but after that all times procnto crush (not in mutex using time defintely). 

But if i make a super parent app, which create segment, init mutex, close it, run 1st app (which make fork), waiting for
 end it and delete mutex - all works fine. So, shared mutex in my case works only with third process which control mutex
 life.

How it can works and how i can fix it? Im newbie in QNX and POSIX.
Fault dump and source in attachment.
Attachment: Image Снимок.PNG 23.62 KB Text shm_mtx.c 4.61 KB
Re: Shared mutex and procnto fault  
Thanks for reporting.
I'm looking into it. In the mean time, can you try commenting out lines 120-126 and 163-168 in your test? These end up 
creating duplicate mappings for the shared mutex object in the parent and the child processes, respectively. The 
original mapping from line 53 is shared, and thus exists for both the parent and the child. I suspect that the fact that
 each of the parent and child having two separate mappings to the same mutex may be causing the assertion failure that 
you see.

--Elad
Re: Shared mutex and procnto fault  
Thanks to you, Elad!
It works to me. I dont know why i so long miss that.
Gl to you.