1. Nayan Naware
  2. UVM
  3. Thursday, 20 September 2018
How does two fork-join will behave in a body() task of a sequence ??

Will they be working sequentially or in parallel?
Responses (2)
Accepted Answer Pending Moderation
In the example shown below, the first fork-join spawns two threads, waits for them to finish and then spawns another two threads from second fork-join. In this case FJ1 and FJ2 happen in a sequential manner. However behavior will change if you change the first fork-join to a fork-join_none. In that case Threads 1 and 2 will run in the background and in the meanwhile the second fork-join will get executed. This will fork Thread3 and Thread4 and ultimately you get 4 threads running in the background.


virtual task body();
fork : FJ1
// Thread1
// Thread2
join

fork : FJ2
// Thread3
// Thread4
join
endtask


In the example below, the first fork-join spaws Thread1 and a second fork join which instead forks 2 more processes in parallel. In this case all threads are operating in parallel.


virtual task body();
fork
// Thread1
fork
//Thread2
//Thread3
join
join
endtask
  1. more than a month ago
  2. UVM
  3. # 1
Accepted Answer Pending Moderation
Thanks Admin for Quick response. Appreciated !!! :)
  1. more than a month ago
  2. UVM
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

You consent to our cookies if you continue to use our website. To know more about cookies, see our privacy policy. I accept cookies from this site.

Agree