ashwathgan Posted July 22, 2015 Report Share Posted July 22, 2015 Hi all I have a project where I create SystemC threads and they perform co operatively with wait(event) statement in two places of the algorithm. The algorithm works fine. But, the problem is when I run the algorithm for multiple times (like 1000 times), I could see a lot of time is consumed by the wait() statements. (I used a Visual Studio Community 2013 profiler) Is it a performance bottleneck if it runs for many times?? Sorry, if my question is abstract. I am happy to elaborate further if my question is not clear thanks Quote Link to comment Share on other sites More sharing options...
apfitch Posted July 22, 2015 Report Share Posted July 22, 2015 Yes wait is relatively expensive. In SystemC TLM modelling a lot of effort was put into minimising the number of waits (using the concept of a time "quantum" for Loosely Timed modelling), but of course it makes the code much more complex to write and understand. Sometimes it's possible to work out what order the steps of an algorithm should take, and then simply write a program that executes in a well-defined order without using any threads - but the you could write that in plain C++, regards Alan Quote Link to comment Share on other sites More sharing options...
ashwathgan Posted July 23, 2015 Author Report Share Posted July 23, 2015 Thanks a lot for the reply sir. Is there any important reason for the slowdown caused by "wait()"statement in addition to the context switching?? Quote Link to comment Share on other sites More sharing options...
apfitch Posted July 24, 2015 Report Share Posted July 24, 2015 It's just more complex to implement. Each thread has to have a state that is stored and restored at each resume after the wait. With an SC_METHOD, it's just a C function call and there is no state to remember, Alan Quote Link to comment Share on other sites More sharing options...
ashwathgan Posted July 24, 2015 Author Report Share Posted July 24, 2015 Thanks a lot Alan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.