Get() and try_get() Function usage

module tb();
  initial 
 
    begin
      
      semaphore sem=new(2);
      bit [8:0] a, b, c;
      a = $urandom_range(1,30);
      b = $urandom_range(1,50);
      c = $urandom_range(1,10);
     fork
      
        begin
           #a
          sem.get(1);
          $display("%0t Display AA",$time);    
        end
         
      begin
           #b
          sem.get(1);
        $display("%0t Display AB",$time);     
      end
          
      begin
            #c
           sem.get(1);
        $display("%0t Display AC",$time);            
      end
       
     join
     
      sem.put(2); 
 
    end
endmodule
// Output:
//4 Display AC
//9 Display AA
//

My Doubt here is that, Though I have added get() that block the process, still the control comes out of the fork. My expectation was that the control should n’t be coming out of the fork itself.

In reply to Arun_Rajha:

Please use code tags making your code easier to read. I have added them for you.

Your code works for me. If you put a $display after the join, it never get displayed.