Jump to content
Ronex

Blocking call in SystemC METHOD kind process

Recommended Posts

Can I use blocking system call of kernel, In systemC METHOD process, More specifically suppose I wanted to use mutex lock call on unix system.

 

pthread_mutex_lock is a blocking call, and I am using it for some kind of synchronixation between kernel thread and systemC process(SC_METHOD).

 

What should be a proper approach ?

Share this post


Link to post
Share on other sites

You cannot use blocking calls in SC_METHOD process. If you really need to use it, use SC_THREAD process instead. SC_THREAD has all the expressive powers that SC_METHOD has.

 

This is only partially true. You can use blocking calls in an SC_METHOD, however, then your simulation won't advance. Sometimes, this is exactly what you would like to achieve with a blocking call, e.g., to synchronize your simulation with other operating system processes.

Share this post


Link to post
Share on other sites

This is only partially true. You can use blocking calls in an SC_METHOD, however, then your simulation won't advance. Sometimes, this is exactly what you would like to achieve with a blocking call, e.g., to synchronize your simulation with other operating system processes.

 

I agree on the stuff that in case of SC_METHOD we can't use any kind of blocking calls of systemC which affects simulation time, But We can use kernel blocking call which at all not related with systemC simulation time and here In my use case I am here uses kernel blocking call to remove systemc process from the execution and allow another kernel thread to execute by the cpu. I wants to confirm whether the approach is right or not ?

 

 

You cannot use blocking calls in SC_METHOD process. If you really need to use it, use SC_THREAD process instead. SC_THREAD has all the expressive powers that SC_METHOD has.

 

Can you please elaborate why I can't use this ? And share necessary details.

 

Ruffly I would say, "Of Course as it's matter of kernel scheduler which might also remove systemC process(even if systemc execution  is inbetween SC_METHOD process ) if time slot for its execution is spend. And here it's similar to that except by using blocking we kind of instruct the kernel that even if time slot is not spend you allow other thread to execute and block me until I met some specific condition." whatever it get understand here.

 

 

I have Check with a dummy small example which works fine and didn't get any error like normally the one we are getting when we use systemC blocking calls in SC_METHOD.

 

Let me know whether It should be used or not ? Or better to go with SC_THREAD. ( That doesn't makes any sense to me why SC_METHOD shouldn't use ? )

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

×