What is a hardware semaphore?

How can this be used from software if it is a hardware semaphore? Is it that there is a software API that is actually implemented in HW?

I ask how I use the firmware to interact with some equipment. There will be a lot of information exchange between the hardware and the firmware. I talked about the hardware semaphore and just wanted to know more about it. Some literature on this subject would be helpful.

+3
source share
3 answers

You are basically right. There is a SW API that requires some special equipment to work properly. Implementations of semaphores in software, of which there are several, are based on some kind of HW instruction, which is guaranteed to be atomic.

Implementation of a semaphore requires atomicity in HW. Typically, HW instructions are not atomic.

To develop several, you need to implement a semaphore by reading and writing a piece of shared memory visible to more than one processor. Reading and writing the shared part of the memory is not an atomic operation as a whole: for example, if you read and then write, there may be other instructions that are planned between reading and writing.

+4
source

, , . .

+1

In a computer system having at least two processors, each processor has associated memory, and processors connected to each other via an interface module via a bus open up hardware semaphores for controlling access to shared resources. Each semaphore has one bit of width and can be written to obtain the desired state. When reading a semaphore, if the contents are one, then one is returned. If the content is zero, zero is returned, but the semaphore will automatically reset to one.

0
source

All Articles