Jump to content

Blocking call in SystemC METHOD kind process


Ronex

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 ?

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 2 weeks later...

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 ? )

Link to comment
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.

×
×
  • Create New...