0
\$\begingroup\$

Lets say I have task which is called an unknown amount of times by an external condition that I (the task designer) do not know, this task then must create a thread and execute a different task is parallel (for example, to receive data for a read request that was dispatched). There could be multiple calls to Dispatch_Tx so multiple threads would need to be created (Receive_Data cannot block Dispatch_Tx from finishing). (traffic may be out-of-order, and many interleaved requests must be processed simultaneously) s. The fork...join syntax shows that threads created inside of it are indeed concurrent, however, are multiple fork...join's themselves mutually concurrent?

interface ...
.
.
.
task automatic Dispatch_TX(input clk);
 .
 .
 .
 fork 
 Receive_Data();
 join_none
endtask
.
.
.
endinterface

So in the above example, would there be multiple threads for the Receive_Data() task.

This is written in the LRM:

Table 9-1—fork-join control options: " join_none: The parent process continues to execute concurrently with all the processes spawned by the fork. The spawned processes do not start executing until the parent thread executes a blocking statement or terminates."

I may be wrongfully equating process == thread, but this seems to suggest a fork_join is only concurrent with the parent thread.

asked Jul 20, 2021 at 20:56
\$\endgroup\$
3
  • 1
    \$\begingroup\$ If Receive_Data() is non-blocking, that is it cannot consume time, then putting a fork around it makes no sense. If the calls to Dispatch_TX are from different forked threads, are you concerned about atomic execution within those threads? \$\endgroup\$ Commented Jul 20, 2021 at 21:32
  • \$\begingroup\$ Receive_Data() is blocking, so I can't get away with using a function(). The calls are made by one single for loop, however the condition for the call to be made relies entirely on the space in a queue -- which is dynamic/unpredictable. My concern is that fork...join may be a "Queued process" i.e. the execution of each is dependent on sequential/temporal ordering. I want to confirm that multiple fork...join_none calls each create a seperate threads to execute Recieve_Data(). From the quick read I did of chapter 9 of the LRM, I wasn't able to confirm this \$\endgroup\$ Commented Jul 20, 2021 at 21:48
  • \$\begingroup\$ I think this is relevant to my question: Table 9-1—fork-join control options: " join_none: "The parent process continues to execute concurrently with all the processes spawned by the fork. The spawned processes do not start executing until the parent thread executes a blocking statement or terminates." -- Seems to suggest that the concurrency is only among the fork_jone_none and the parent thread, but what about other fork_join_nones? \$\endgroup\$ Commented Jul 20, 2021 at 21:57

1 Answer 1

0
\$\begingroup\$

All threads are concurrent by defintion. Does not matter how they created. https://verificationacademy.com/forums/systemverilog/process-vs-thread

answered Jul 21, 2021 at 0:34
\$\endgroup\$
2
  • \$\begingroup\$ bit odd that fork join_none doesn't start right away after join_none is reached. \$\endgroup\$ Commented Jul 21, 2021 at 15:10
  • 2
    \$\begingroup\$ This was done to preserve some predictability in the behavior of the code the follows the join_none. Comes more into play when the fork/join_none is in a loop. \$\endgroup\$ Commented Jul 23, 2021 at 17:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.