Hello valgrind developers, I've been studying the source code of valgrind to figure out how it deals with processes and threads. And I'd like to make sure my understanding is correct.
From the system call wrappers, I conclude that a fork() (or rather clone) is passed down to the kernel, so that you end up with two processes, both covered by valgrind, but running independently from there on. For threads, there is an internal scheduler, sort of simulating the kernel's scheduler. Having more control over the threads and when to execute or interrupt them. I would like to simulate the scheduler, or even influence it, to be able to reproducibly test execution of concurrent code. Because as commodity hardware gets more and more CPU cores, multi-threaded code will get more and more common. And to be able to test different conditions between threads of execution, I would like to control the scheduler to be able to reproducibly get into a certain state. While that seems doable and just a question of how to control the scheduler, I'm somewhat suspicious about processes. I would like to do the very same for programs that fork, and control interaction of the separate processes. How hard would it be to allow valcore to not pass down the clone call to the kernel, but instead simulate concurrency with its own scheduler? Or maybe still pass on the clone call on to the kernel, but coordinate the scheduling between the valcore processes? And yet another line of thought: being able to control the scheduling between threads and processes, wouldn't it be feasible to even simulate more CPU cores than I really have available, by simply switching after every single instruction? I realize that this would slow down execution a lot. However, it would probably allow to simulate what could happen on a 64-way system on a laptop - at least WRT the CPUs. I hope I made clear what I have in mind. Please feel free to comment, critic, applaud, bash or do all together. Regards Markus ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers