Jump to content

How to disable fork join or fork join_any after executed particular thread or process


Recommended Posts

How to disable join fork after executed particular thread or process

Requirement: Need to disable fork join after executing join_2 thread or process

Please help me in this 

module fork_join;
 
  initial begin
    
    $display("**********BEFORE FORK..JOIN**********");
    
    fork
      begin:join_1
        #1 $display($time,"\tThread A");
        #2  $display($time,"\tThread B");
      end
      begin: join_2
        #2 $display($time,"\tThread C");
        #3  $display($time,"\tThread D");
      end
      
      begin:join_3
        #5 $display($time,"\tThread E");
        #6  $display($time,"\tThread F");
      end
    join
    
    #7  $display($time,"\tThread G");
 
    $display("**********AFTER FORK..JOIN**********");
    
    $finish;
  end
  
endmodule

 

Link to comment
Share on other sites

Read up on fork-join, fork-join_any, and fork-join_none. You can disable any labeled block or task. You can also kill processes if you know the process id.

Your "After fork" won't execute until ALL three processes within the join complete. You likely want fork-join_any or fork-join_none.

Also, you only have three threads/processes (the three labeled blocks). Your $displays inside those threads will execute sequentially.

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...