Using a modulus seems much more logical. 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 :>* :>. -- Binyamin Dissen <[email protected]> http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies.
