In reply to mseyunni:
You are still not very clear.
You say the “common resource is an associative array” and “Id’s gets pushed into this”. You don’t push things onto an associative array.
You say “from a function which gets queried from sequences”. Did you mean called from a sequence?
You say “and from the uvm write function”. Do you mean the write function also is going to call the same function to “push the id” onto the associative array?
And what component is calling the uvm write function? I assume this is an anlysis_port of some component. Should this go into an analysis_fifo instead?
I still can’t see how using a semaphore is going to help you? Where would you call the put() and get() if you were allowed to call a task from a function?