On Mon, Aug 1, 2016 at 1:45 PM, CJ YAMIGOS <cjyami...@gmail.com> wrote:
> 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.
Neither Helgrind nor DRD are able to detect data races between shared
memory pages.
This is hard, because the tool needs to track the happens-before
relation between threads belonging to different processes.
Because Valgrind itself is single-threaded (i.e. it serializes the
threads of the inspected program), synchronizing the states of two
Valgrind processes that have just a common shared memory page is going
to be quite painful.

> 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
>



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

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

Reply via email to