Browse Prior Art Database

Non-interrupt Masking Trace Record Allocation

IP.com Disclosure Number: IPCOM000108383D
Original Publication Date: 1992-May-01
Included in the Prior Art Database: 2005-Mar-22
Document File: 5 page(s) / 192K

Publishing Venue

IBM

Related People

Doing, R: AUTHOR [+2]

Abstract

A fast method for sequentially allocating records from a shared memory area without masking interrupts is disclosed. This method is particularly useful in complex real-time systems for allocation of records in a common event trace buffer.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 33% of the total text.

Non-interrupt Masking Trace Record Allocation

       A fast method for sequentially allocating records from a
shared memory area without masking interrupts is disclosed. This
method is particularly useful in complex real-time systems for
allocation of records in a common event trace buffer.

      The algorithm supports sequential allocation of trace records
from a common memory-resident trace log by multiple tasks and
interrupt handlers without masking interrupts. All allocation
requests are handled through a common re-entrant routine.  The
algorithm allows multiple tasks to call the routine "simultaneously"
but ensures that each record is allocated to only one task.  It also
provides for reallocation of trace records when the trace buffer
fills; that is, circular (or wrapping) logs are supported.

      Following are the main components of the trace facility and a
description of the terms to be used.  The trace log (or buffer) is a
contiguous block of memory.  The algorithm requires that the size of
the trace buffer be a power of two.  The trace buffer is divided into
fixed length trace records.  One bit in each record must be reserved
for use by the allocation algorithm.  The components will be
described in detail below.  Also refer to the figure.

      Trace Buffer:  A unit of memory of size 2**n which is
accessible to all tasks.  The buffer is divided into equal size trace
records.

      Trace Buffer Pointer:  A pointer to the beginning of the trace
buffer.

      Trace Record Pointer:  When ANDed with Pointer Mask, this is an
offset into the trace buffer pointing to the next available trace
record.  The size of this pointer must be at least one bit larger
than the number of bits required to access all of the trace buffer (n
+ 1).  The most significant bit of the required bits is used to
determine when the buffer has wrapped.  It will be called the Wrap
Cycle Bit.  Each time the bit toggles, the end of the buffer has been
reached.

      Local Trace Record Pointer:  A copy of the global Trace Record
Pointer which is stored in the caller's local (e.g., stack) data
area.

      Pointer Mask:  A bit mask for Trace Record Pointer with the
least significant n bits "on" and the remaining bits "off", where the
total size of the buffer is 2**n.  When ANDed with Trace Record
Pointer, it gives the offset of the next available trace record.

      Trace Record Claim Bit:  One bit of each trace record is
reserved for the Claim Bit.  The state of this bit determines whether
the trace record has been allocated to another task.  The bit is
changed from 0 to 1 as the record is allocated the first time through
buffer (wrap cycle bit = 0).  When the buffer has wrapped (wrap cycle
bit = 1) the claim bit of each record is then changed from 1 to
0 as each is allocated.

      The following pseudo code defines the trace record allocation
algorithm.
done_flag = 0
Local Trace Current Pointer = G...