A solution is maybe a table (etc) where every record is registered with address and length and for every new record traverse that table for the first empty (deleted) record area that fits the new record. And then reuse it. Here there are many possible optimizations depending on the needs and pecularities. E g saving some attributes needed for future deletions etc. Or using several tables for different sizes.
Thomas Den mån 30 dec. 2024 14:27Binyamin Dissen < [email protected]> skrev: > Yes. > > The only accesses are the inserts and the periodic scans/deletes. No ad hoc > updates or deletes. > > On Mon, 30 Dec 2024 13:34:02 +0100 Thomas Berg > <[email protected]> wrote: > > :>Is the main issue to avoid loss of storage space? That is, access time is > :>not that important? > :> > :>Thomas > :> > :>Den mån 30 dec. 2024 08:28Binyamin Dissen < > :>[email protected]> skrev: > :> > :>> The issue with playing with pointers is that the storage would be lost. > :>> Blocks > :>> have quite variant lengths. > :>> > :>> I guess I could create X areas and release an area when all items in > the > :>> area > :>> have been deleted (perhaps transfer items if the remaining count is > low). > :>> > :>> On Mon, 30 Dec 2024 06:44:33 +0000 "Farley, Peter" > :>> <[email protected]> wrote: > :>> > :>> :>Sounds to me like a deque with functions q.popleft() to remove at the > :>> left side, q.append() to add at the right side. Scan process would be > a > :>> series of popleft calls with append for the ones being left for a later > :>> time. > :>> :> > :>> :>E.G. (pseudocode): > :>> :> > :>> :>Scan(q) { > :>> :> Curlen = len(q) > :>> :> For qx = 1 to Curlen { > :>> :> Qitem = q.popleft() > :>> :> If Qitem is NOT to be removed { > :>> :> q.append(Qitem) > :>> :> } > :>> :> Else { Process removed Qitem } > :>> :> } > :>> :>} > :>> :> > :>> :>If the “Qitems” are relatively large in size and all at different > :>> addresses then the deque structure (which can be a dynamically sized > array) > :>> can just store pointers to the actual items, resulting in not a lot of > data > :>> movement at all. > :>> :> > :>> :>FWIW, I have done something like this in COBOL, though not for an > :>> employer. > :>> :> > :>> :>HTH > :>> :> > :>> :>Peter > :>> :> > :>> :>From: IBM Mainframe Discussion List <[email protected]> On > :>> Behalf Of Binyamin Dissen > :>> :>Sent: Sunday, December 29, 2024 3:51 PM > :>> :>To: [email protected] > :>> :>Subject: Ideas of managing a data structure > :>> :> > :>> :> > :>> :>The data structure consists of various items of different lengths. > The > :>> items > :>> :> > :>> :>are added serially and periodically the area is scanned where most > items > :>> are > :>> :> > :>> :>removed. The remaining items are likely to be removed in a later scan > :>> (with > :>> :> > :>> :>new items). > :>> :> > :>> :> > :>> :> > :>> :>My thought was to have two data areas, and during the scan insert the > :>> :> > :>> :>undeleted items into the alternate area. It will be a bit of data > moves > :>> but is > :>> :> > :>> :>simple. > :>> :> > :>> :> > :>> :> > :>> :>Does Knuth talk about such a data structure? > :>> > :>> -- > :>> Binyamin Dissen <[email protected]> > :>> http://www.dissensoftware.com > :>> > :>> Director, Dissen Software, Bar & Grill - Israel > :>> > :>> ---------------------------------------------------------------------- > :>> For IBM-MAIN subscribe / signoff / archive access instructions, > :>> send email to [email protected] with the message: INFO IBM-MAIN > :>> > :> > :>---------------------------------------------------------------------- > :>For IBM-MAIN subscribe / signoff / archive access instructions, > :>send email to [email protected] with the message: INFO IBM-MAIN > > -- > Binyamin Dissen <[email protected]> > http://www.dissensoftware.com > > Director, Dissen Software, Bar & Grill - Israel > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
