Semaphores vs Event

An event can block a process until it is triggered. Semaphores can block a process until the process gets the keys. Why do we have two different concepts which do the same job?

In reply to Krishna9:
An event can block a process until it is triggered TRUE

Semaphores can block a process until the process gets the keys.

Those two do not do the same job because Semaphores are used for multiple processes trying to access a few resources. FOr example, if 2 processes need to access a bus for a the transmission of a packet, it is important that the bus resource be exclusive to only one process. It is possible to use other techniques for locking out other processes when the resource is used by one process, but that is in effect a semaphore, though maybe with a different implementation. SystemVerilog adopted the semaphore as a feature.

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr


  1. SVA Alternative for Complex Assertions
    Verification Horizons - March 2018 Issue | Verification Academy
  2. SVA: Package for dynamic and range delays and repeats | Verification Academy
  3. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy

In reply to Krishna9:

You need to wait for an event before it gets triggered. You a put a semaphore long before anyone tried to get() it. Semaphores also have key arbitration to manage multiple cooperating processes. I would avoid using events.