# Cookbook ooo comparator example - why no semaphore or other IPC mechanism needed?

**URL:** <https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210>\
**Category:** UVM\
**Tags:** Cookbook-Scoreboards, UVM\
**Created:** [November 10, 2015, 10:52am UTC](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210 "2015-11-10T10:52:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico75](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@Nico75](https://verificationacademy.com/forums/u/Nico75)\
**Post date:** [November 10, 2015, 10:52am UTC](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/1 "2015-11-10T10:52:35Z")

</div>

If I understand correctly, the ooo comparator accesses ‘shared variables’ received\_data and rcv\_count from 2 processes.  
I would have expected some mechanism like a semaphore to avoid concurrent access to these variables to be present?

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [November 11, 2015, 1:05am UTC](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/2 "2015-11-11T01:05:28Z")

</div>

_In reply to [NiLu](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210):_  
Yes, ideally there should be a semaphore to guard against simultaneous access/modification. In practice, code rarely gets interrupted in the middle of a method except at a blocking statement. But that’s no excuse.

---

<div class="post-metadata">

**Author:** ![UVM\_learner6](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/a8b319/32.png) [@UVM\_learner6](https://verificationacademy.com/forums/u/UVM_learner6)\
**Post date:** [October 12, 2019, 5:15pm UTC](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/3 "2019-10-12T17:15:57Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/2):_

Hi Dave,

Is the need for a semaphore true, for “Comparing Transactions Assuming In-Order Arrival” where we have the write\_before and write\_after functions trying to access the function proc\_m\_data?

Thanks

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 12, 2019, 6:16pm UTC](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/4 "2019-10-12T18:16:32Z")

</div>

_In reply to [UVM\_beginner](https://verificationacademy.com/forums/t/cookbook-ooo-comparator-example-why-no-semaphore-or-other-ipc-mechanism-needed/31210/3):_

No. You do not need an semaphore.
