Producer and consumer interaction

let’s say,
producer produces 5 packets and takes 5 time interval for each packet produced.
consumer consumes 5 packets and takes random time interal betweeen 2 to 6.

assume we have a packet class , a producer class and a consumer class.

inside producer class an array of packet object is declared with size 5 and the method produce to produce the packets.
inside consumer class it is consumed by the method consume, I assume consume meanas some methods or properties inside the packet object is utilized.

what my question is I hear a lot producer consumer questions and I am uncertain about the implementation. what is that “CONSUME” means actually?

it will be better if I can recieve a program.
Wht should I prefer event properties or mailbox or semaphore… I could write this without them…

In reply to Thobiyas:

Producer/Consumer is a very high-level description of basic testbench architecture and transaction level modeling (TLM). A producer is a component of the testbench that creates transactions and sends them to a consumer component. A producer/consumer pair could be stimulus generation to the input of your design. Another pair could be the monitor to scoreboard or coverage collector.

The UVM cookbook is full of examples of this.