The Shared Resource Concept

Assume that the OS sets aside an area of memory to be used by tasks executing on multiple processors (or even by different tasks executed by the same processor) as a shared memory buffer. It is intended to be used as follows:

  1. Before using the buffer (i.e., reading from or writing to it), a task must first test a memory-based flag to ensure that the buffer isn't currently owned by another task. If the buffer is currently unavailable, the task wishing to gain ownership should periodically check back to see when it becomes available.

  2. When the flag indicates that the buffer is available, the task sets the flag, indicating that it has exclusive ownership of the buffer. The buffer is then unavailable if any other task should attempt to gain ownership of it.

  3. Having gained exclusive ownership of the buffer, the task can now read and write the buffer.

  4. If the buffer is in an area of memory designated as WT, WC, WP, or UC memory (refer to “Store μops” on page 1072), writes are absorbed into the processor's Store Buffers. These buffers are not snooped when other agents access memory. In this case, when the task is done using the buffer, it should ensure that all of its updates (i.e., memory writes) have been flushed all the way to memory.

  5. After ensuring that the buffer has received all updates, the task should release ownership of the buffer so it can be used by other tasks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.198.59