Lock in virtual sequence

Hi All,

I have started learning the lock/grab concept and tried one example
example:
we have two virtual sequences vseq1 and vseq2 and inside the vseq1 body task I am locking the p_sequencer by calling this.lock(p_sequencer) and unlocking the p_sequencer after seq1 and seq2 in vseq1 completed. But I am observing that seq2 is completing after seq3 execution in vseq2
code link: Edit code - EDA Playground

Question: 1. Is there any difference in locking the normal sequencer and virtual sequencer? please help

The shared code doesn’t compile.
You can take a look at this section in uvm cookbook, there’s also an example there
Locking or Grabbing a Sequencer

Hi All,

I have edited the code now it is running please let and provide the inputs.
Question : is there any difference in locking the p_sequencer and locking the normal sequencer . Please help

Sometimes locking/grabbing a sequencer could be misleading, the idea here is that it works on sequence requests. So when you call lock() or grab() that will be applicable to the following requests that are generated by the sequence i.e. you’re not locking/grabbing the whole sequencer.
I can see in your sequences, you don’t have any generated requests i.e. start_item() ... finish_item()
I updated your example to work as expected, here is an EDA link : updated lock code

I still recommend reading UVM cookbook section I shared earlier

Thank you for the response but in virtual sequence if we use start_item(req) it should be emply uvm_sequence item right ? since in virtual sequence we are not generating any transactions we just used to co-ordintate the sequences . Please throw some inputs what does start_item(req) in virtual sequence do >