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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...