Jump to content
Sign in to follow this  
ashwathgan

wait() - performance Bottleneck

Recommended Posts

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

 

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×