|
From: Julian S. <js...@ac...> - 2008-10-16 01:04:35
|
> My opinion is that the extraction of information about locking > primitives from binary executables is a really powerful technique and > would be a very interesting addition to Valgrind. The big question > here is whether this is possible. This is at least a challenging > research topic. Yes. I agree. > One issue that puzzles me is the following: it is possible to > implement a semaphore using one mutex and one condition variable, and > it is possible to implement a mutex using one semaphore. libpthread > implements semaphores, mutexes and condition variables via futexes. So > how is it possible by only analyzing futex calls and control flow > whether the (library) programmer has implemented a mutex or a > semaphore ? Probably irrelevant, but .. would it maybe help to model mutexes, semaphores, in terms of simple message passing between threads? eg, an unlock causes a token to be placed in a mailbox associated with the mutex. A lock request causes the requesting thread to remove the token from the mailbox associated with the mutex. If the mailbox is empty then the thread blocks. Anyway, I wonder if all such primitives can be modelled like this and/or whether that is helpful for this problem. Maybe not. J |