|
From: Ivo R. <iv...@iv...> - 2016-02-06 10:33:44
|
2016-02-06 5:07 GMT+01:00 William Good <app...@li...>: > The table needs to be thread safe because different threads will be using > it at run time. I cannot use a pthread_mutex in my tool, correct? How can > I make a lock for the table? > Hi Bill, Valgrind runs properly multi-threaded applications, but effectively only uses one vCPU at a time to run them. In other words, Valgrind does not use multiple CPUs when running a multi-threaded application. So far no Valgrind analysis tool (except 'none') is designed such that it is multi-thread safe. They all leverage the fact there is always single thread running. See Philippe's presentation about multi-thread Valgrind prototype from FOSDEM 2015: https://archive.fosdem.org/2015/schedule/event/valgrind_multi_prototype/ It goes to a great length in what and where is not multi-thread safe and how come Valgrind is able to run multi-thread applications properly. An ideal situation would be if Valgrind core provides efficient synchronization mechanisms which all analysis tools can consume. Maybe Philippe could comment if there is anything usable from his prototype. I. |