Paul,
If I understand your question correctly, then this is not possible except in 1 
specific situation. 
You have a circular queue where each entry is 256 bytes that represents some 
area in 64 bit storage and the queue is used by multiple tasks.
Problem 1:  CS only serializes the index (consistency) but does not ensure the 
256 bytes are serialized during the transition. Your queue only has 2 states 
(QUEUED or FREE) and transitions immediately upon change. 
Problem 2: Queue must be in a single task and free must be in a single task. 
E.g. you can't guarantee the sequence element 5 and 6 are freed.
You will most likely need to use another method. If you use chaining where 
sequence is important, then you might find the PLO instruction helpful 
otherwise you will need a single task to re-sequence the queue.
Jon.
On Mon, 29 Jul 2019 14:45:19 GMT "[email protected]" <[email protected]> wrote:

:>Hi,
:>.
:>I have a program which obtains a Memory Chunk, which is carved into a queue 
of  256
:>byte fixed length entries.  I could have used a Data space.
:>.
:>In 31 Bit storage is the control information for the 64Bit Memory Chunk queue.
:>The 31 Bit storage control structure has the beginning address of the Memory
:>Chunk, the Ending Address Of the Memory Chunk, the number of fixed length 
entries
:>an Ordinal Number (INDEX) and some state data. 
:>.
:>The ordinal Number is used to index into the Memory Chunk of fixed length 
entries
:>(queue) and is incremented using Compare and Swap (CS). 
:>The program never searches the queue to find an available slot - it always 
appends to the next  entry by incrementing the ordinal number using compare and 
swap..  
:>.
:>The memory chunk is used as a circular queue, meaning, when we reach the end 
of
:>the queue (memory chunk), we resume by re-using the first entry at the top of 
the queue
:>(wrap around).
:>We all-ways add new/next entries by incrementing the ordinal number and 
indexing
:>into our Memory Chunk.
:>.
:>Here's My concern -
:>When we reach the end of the queue - the program needs to reset ther Ordinal 
Index back to 0.
:>(so we can continue to add the next entry at the beginning of the queue)..
:>Is it better to test/reset this Index number before or after adding the last 
entry in the queue ?Should there be a second Compare and Swap ?
:>.
:>.
:>Paul  

Reply via email to