The mailboxes, events, and semaphore mechanisms in SystemVerilog are designed to achieve communication in the process, and the three mechanism functions are similar until the three mechanisms are learned. It is now found that in fact three mechanisms include three aspects of communication between processes.
The main function of the mailbox is to allow different processes to pass data and cross class method calls, the advantage of using the mailbox mechanism is that you do not need to introduce a complex hierarchy of references, you can invoke the methods of other objects in one object to process the data, and if the code of the class of the invoked method changes, you do not need to modify the code as a whole.
The function of the event is to realize the synchronization of communication between processes, that is, to cause the blocking and execution of the process through the events, to achieve the handshake between processes, and to avoid errors in the timing of process processing.
The main purpose of semaphore is to make certain resources can only be accessed by a specified number of processes at the same time, avoid two parallel processes to modify some data at the same time, resulting in unknown errors.