Welcome, Guest. Please login or register.

Author Topic: No need for Semaphore when data size is <= 32 bit ?  (Read 3809 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: No need for Semaphore when data size is <= 32 bit ?
« on: May 01, 2006, 01:40:26 AM »
You wouldn't.

Hint: How to read the value and modify it in arbitrary way and have that in single, atomic operation? Just reading or writing the value doesn't give anything useful, or at least I can't think of any use for that.

Even if you would only read or modify it, even the modify might not be atomic operation (it isn't with PPC).

If the code is m68k only, and if the code only does atomic read or update operation, then it would work. But like I said, such conditions aren't met often.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: No need for Semaphore when data size is <= 32 bit ?
« Reply #1 on: May 01, 2006, 02:51:34 PM »
It should also be pointed out that Forbid/Permit arbitration should be used when there is no long, blocking operation done using the locked object. If there is some such operation (such as scanning a list for example), semaphore should be used.