I have doubts about threads spawning between begin end and fork-join`
module top;
initial
begin // parent process
fork
#5 $display("A"); //child process 1
#7 $display("B"); //child process 2
join_any
fork
#7 $display("C"); //child process 3
join_none
disable fork;
end
endmodule
here child process 2 and 3 got killed as I expected
module top;
initial
begin // parent process
fork
#5 $display("A"); //child process 1
#7 $display("B"); //child process 2
join_any
fork
fork
#7 $display("C"); //child process 3
join_none
disable fork;
join
end
endmodule
Output :
A
B
C
I am expecting only child process 3 will be killed but it is not killing any of the thread why?
module top;
initial
begin // parent process 1
fork
#5 $display("A"); //child of process 1
#7 $display("B"); //child of process 1
join_any
begin// child process 3
fork
#7 $display("C"); //child of process 3
join_none
disable fork;
end
end
endmodule
Output: A
I just want to clarify begin end inside begin end will create new process or begin end inside begin end wont create a new process. If begin end will also a process then only child of process 3 has to kill but here child of process 1 and child of process 3 threads are killing please clarify my doubts