How to strat multiple threads parallely

Hi , Can you please help for this
In the run phase i need to start parallel threads , can i create transaction with same name in all the parallel threads, if multiple threads got triggered then will it be overrided? if it is overrided can you please help me to solve this issue

 task run_phase(uvm_phase phase);
    forever begin 
      fork
        begin 
          if(intr_vif.controller_int_0_timeout) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_timeout = intr_vif.controller_int_0_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin
          if(intr_vif.ch1_controller_int_0_timeout) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_timeout = intr_vif.ch1_controller_int_0_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.controller_int_0_ecc) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_ecc = intr_vif.controller_int_0_ecc;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_ecc),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin
          if(intr_vif.ch1_controller_int_0_ecc) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_ecc = intr_vif.ch1_controller_int_0_ecc;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_ecc),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin          
          if(intr_vif.controller_int_0_lowpower) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_lowpower = intr_vif.controller_int_0_lowpower;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_lowpower),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_lowpower) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_lowpower = intr_vif.ch1_controller_int_0_lowpower;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_lowpower),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin                                       
          if(intr_vif.controller_int_0_rfifo_timeout) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_rfifo_timeout = intr_vif.controller_int_0_rfifo_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_rfifo_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end                                   
        begin
          if(intr_vif.ch1_controller_int_0_rfifo_timeout) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_rfifo_timeout = intr_vif.ch1_controller_int_0_rfifo_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_rfifo_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin
          if(intr_vif.controller_int_0_training) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_training = intr_vif.controller_int_0_training;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_training),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_training) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_training = intr_vif.ch1_controller_int_0_training;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_training),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin         
          if(intr_vif.controller_int_0_userif) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_userif = intr_vif.controller_int_0_userif;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_userif),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_userif) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_userif = intr_vif.ch1_controller_int_0_userif;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_userif),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_misc || ch1_controller_int_0_bist || ch1_controller_int_0_crc) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_misc = intr_vif.ch1_controller_int_0_misc;
            intr_txn.ch1_controller_int_0_bist = intr_vif.ch1_controller_int_0_bist;
            intr_txn.ch1_controller_int_0_crc = intr_vif.ch1_controller_int_0_crc;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin   
          if(intr_vif.controller_int_0_misc || controller_int_0_bist || controller_int_0_crc) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_misc = intr_vif.controller_int_0_misc;
            intr_txn.controller_int_0_bist = intr_vif.controller_int_0_bist;
            intr_txn.controller_int_0_crc = intr_vif.controller_int_0_crc;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_dfi || ch1_controller_int_0_dimm || ch1_controller_int_0_freq || ch1_controller_int_0_init) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_init = intr_vif.ch1_controller_int_0_init;
            intr_txn.ch1_controller_int_0_dfi = intr_vif.ch1_controller_int_0_dfi;
            intr_txn.ch1_controller_int_0_dimm = intr_vif.ch1_controller_int_0_dimm;
            intr_txn.ch1_controller_int_0_freq = intr_vif.ch1_controller_int_0_freq;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
                                                
        begin
          if(intr_vif.controller_int_0_dfi || controller_int_0_dimm || controller_int_0_freq || controller_int_0_init) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_init = intr_vif.controller_int_0_init;
            intr_txn.controller_int_0_dfi = intr_vif.controller_int_0_dfi;
            intr_txn.controller_int_0_dimm = intr_vif.controller_int_0_dimm;
            intr_txn.controller_int_0_freq = intr_vif.controller_int_0_freq;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin                                     
          if(intr_vif.controller_int_0_mode || controller_int_0_parity) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.controller_int_0_parity = intr_vif.controller_int_0_parity;
            intr_txn.controller_int_0_mode = intr_vif.controller_int_0_mode;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin 
          if(intr_vif.ch1_controller_int_0_mode || ch1_controller_int_0_parity) begin
            intr_txn = interrupt_transaction::type_id::create("intr_txn");
            intr_txn.ch1_controller_int_0_parity = intr_vif.ch1_controller_int_0_parity;
            intr_txn.ch1_controller_int_0_mode = intr_vif.ch1_controller_int_0_mode;

            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn),UVM_LOW)
            ap.write(intr_txn);
          end
        end
      join    
######################################################################################################3
    end

                                                  
                       

  endtask : run_phase

In reply to srikanth.verification:

You can create individual sequences and run it part of a virtual sequence all forked so it can run in parallel.

In reply to shaky005:

One problem with your code is you need to declare intr_txn locally in each begin/end block, otherwise the handle will get overwritten.

In reply to dave_59:

In reply to shaky005:
One problem with your code is you need to declare intr_txn locally in each begin/end block, otherwise the handle will get overwritten.

Hi Dave,
I am not sure if I missed what you want to convey, however I thought that he has already done what you have mentioned to do, isn’t it?

task run_phase(uvm_phase phase);
    forever begin 
      fork
        begin 
          if(intr_vif.controller_int_0_timeout) begin
**intr_txn = interrupt_transaction::type_id::create("intr_txn");
**            intr_txn.controller_int_0_timeout = intr_vif.controller_int_0_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.controller_int_0_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end
        begin
          if(intr_vif.ch1_controller_int_0_timeout) begin
**intr_txn = interrupt_transaction::type_id::create("intr_txn");
**            intr_txn.ch1_controller_int_0_timeout = intr_vif.ch1_controller_int_0_timeout;
            intr_txn.trans_num += 1;
            `uvm_info("DATA FROM MON", $sformatf("DATA received from Interrupt MONITOR is : [%p] \n", intr_txn.ch1_controller_int_0_timeout),UVM_LOW)
            ap.write(intr_txn);
          end
        end
...

Or you are saying it has to be different names?

Thank you,
Mega

In reply to megamind:

They either have to be different names, or the same name local to each thread. Although the declaration of intr_txn is not shown, I assume its outside of the fork/join block, meaning it can only store one handle.

In reply to dave_59:

yes correct, thank you dave