Hi everyone,

I started recently using Valgrind (Helgrind and DRD), and I mainly want to
detect data races in my program composed of two processes that communicate
via a POSIX shared memory object. I found quite a lot of examples showing
how Valgrind can detect data races in multithreaded applications (where all
threads belong to the same process). However, this is not the case I am
interested in.

Basically, my program is composed of two processes, namely Server and
Client. The Server is responsible of creating a named shared memory object
with "shm_open", sets the size with "ftruncate" and maps the shared memory
object to Server's virtual address space with "mmap". On the other hand,
the Client opens/gets this shared memory object with "shm_open" and then
maps it to Client's virtual address space with "mmap". Both Server and
Client processes have Read & Write access to this shared memory object.
There is a nice example in:
https://www.softprayog.in/programming/interprocess-communication-using-posix-shared-memory-in-linux;
the main difference between this example and my program is I am not using
any semaphore (i.e., any kind of protection mechanism neither) at all.

When running my program with Valgrind (v 3.7.0) in Linux, I am getting no
warnings about potential data races in my program. In fact, when both
Server and Client processes are running in parallel (i.e., each in a
different processor core) and there is not a mechanism protecting the
access to the shared memory object (e.g., a data structure), I expect
somehow to see some data races warnings.
So, I wonder whether I am missing something here or Valgrind just does not
support data race detection in Inter-Process Communications (like the one I
have in my program). Many thanks in advance for your helps!

Best,

Carlos H.
------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to