From: Martin W. <mai...@ma...> - 2008-11-24 22:27:51
|
Stephen Williams wrote: ... > * work on non-trivial vvp implementation. (Possibly multi-threaded > to support processing islands in parallel.) FYI, I did a few experiments on making vvp multi-threaded recently, using the Linux pthread library. My first thought was to apply multi-threading within vthread_run - in the code I write there are lots of individual vthreads waiting on clock edge events, so there is plenty of potential parallelism. My first experiment created a pool of worker pthreads, with the workers picking off vthreads from a queue created by vthread_run. Unfortunately the cost of the inter-pthread synchronisation proved too high for this to be beneficial. My second experiment spawned a new pthread for each vthread in the list passed to vthread_run. Surprisingly this proved more efficient than using the pool of pre-created pthreads, but the cost was still too high. My next thought was to just create two threads, one responsible for executing vvp instructions, the other for propagating changes through the functor network. So whenever a vvp instruction would have executed a send_* function it instead places the necessary information in a queue serviced by the second thread. Unfortunately my current implementation only runs for a few seconds before errors creep in, so I've not yet determined whether there's any mileage in this idea. Martin |