comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: Parallel & RT GC (was Re: Real-Time GC (was Re: Widespread C++...?)
Date: 19 Jan 1995 19:59:51 GMT
Date: 1995-01-19T19:59:51+00:00	[thread overview]
Message-ID: <3fmgbn$rns@watnews1.watson.ibm.com> (raw)
In-Reply-To: EACHUS.95Jan17112913@spectre.mitre.org

In article <EACHUS.95Jan17112913@spectre.mitre.org>,
eachus@spectre.mitre.org (Robert I. Eachus) writes: 

|>     There is another major reason for putting the custom hardware in
|> the memory system.  There is a fairly large class of problems which
|> require time proportional to n^k lg2 n on any von Neuman architecture,
|> but can be solved in time n^(k-1) lg2 on hardware which supports
|> clearing large sections of memory to zero in constant time.  (Note
|> that if k is one, you can get orders of magnitude improvement.)

This doesn't make sense, because there is a well known programming trick
(used more in analysis-of-algorithms than in real programs because of the
large constant factor) for marking a large section of memory as
uninitialized in constant time.  (The effect of initializing a large
section of memory to zero is achieved by checking on each read whether
the location read from has been initialized, and using the value zero if
it has not been.)

The trick works as follows: View the section of memory as an array of N
initializable units numbered 0 to N-1.  Allocate two arrays of integers,
Stack and Stack_Index, indexed from 0 to N-1.  Initially, both arrays
contain garbage.  There is a stack pointer, Top, pointing to the
highest-indexed element of Stack that does NOT contain garbage (so that
initially it equals -1).  When initializable unit I is initialized, Top
is incremented, the new value of Top is placed in Stack_Index(I), and I
is placed in Stack(Top).  Then the index of every initialized unit is
found exactly once in Stack(0 .. Top), and if unit I has been
initialized, Stack_Index(I) contains the index within Stack(0 .. Top)
containing I.  The test for whether initializable unit I is initialized
is: 

   if Stack_Index(I) in 0 .. Top then
      if Stack(Stack_Index(I)) = I then
         return True;
         -- Stack_Index(I) contains a valid index into the stack, and the
         --   corresponding index in the stack indicates that unit I has
         --   been initialized.
      else
         return False;
         -- The garbage in Stack_Index(I) happened to point into the
         --   initialized part of Stack, but the value in Stack reveals
         --   that unit I was not the initializable unit for which this
         --   component of Stack was initialized.
      end if;
   else
      return False;
      -- Garbage in Stack_Index(I) is not even a valid stack index.
   end if;

or, more succinctly,

   return Stack_Index(I) in 0 .. Top and then Stack(Stack_Index(I))=I;

--
Norman H. Cohen    ncohen@watson.ibm.com



  parent reply	other threads:[~1995-01-19 19:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <787227087snz@wslint.demon.co.uk>
     [not found] ` <3da1nd$fss@gateway.wiltel.com>
     [not found]   ` <3e1rqn$ouh@news.parc.xerox.com>
     [not found]     ` <3e22hi$pqf@baygull.rtd.com>
     [not found]       ` <3e26mc$n9u@Starbase.NeoSoft.COM>
1994-12-31  1:09         ` What's Real-Time? (was Re: Widespread C++ Competency Gap?) Henry Baker
1994-12-31  2:12           ` Don Yuniskis
1994-12-31 17:08           ` Przemek Klosowski
1995-01-01  9:35             ` Robert J Carter
1995-01-02 17:10               ` Przemek Klosowski
1995-01-03 23:20               ` Robert I. Eachus
1995-01-04 22:05           ` Fred McCall
     [not found] ` <3ckb8g$841@gateway.wiltel.com>
     [not found]   ` <1994Dec21.151952.8902@merlin.h>
     [not found]   ` <1994Dec21.151952.8902@merlin.h <19941230.201628.350635.NETNEWS@UICVM.UIC.EDU>
     [not found]     ` <3e9f60$8du@jive.cs.utexas.edu>
     [not found]       ` <3epfsi$64d@gamma.ois.com>
     [not found]         ` <3eua1r$4ea@gnat.cs.nyu.edu>
1995-01-11  1:44           ` Parallel & RT GC (was Re: Real-Time GC (was Re: Widespread C++...?) Henry Baker
1995-01-13 13:30           ` R. William Beckwith
1995-01-13 14:59             ` Kelvin Nilsen
1995-01-17  2:45               ` R. William Beckwith
1995-01-19 15:57                 ` Kurt Bischoff
1995-01-17 16:29               ` Robert I. Eachus
1995-01-18 15:27                 ` Henry Baker
1995-01-19 19:59                 ` Norman H. Cohen [this message]
1995-01-20  2:20                   ` Henry Baker
1995-01-20 14:49                   ` Robert I. Eachus
1995-01-22  2:56                 ` David Hanley
1995-01-23 17:06                   ` Robert I. Eachus
1995-01-13 21:04             ` Henry Baker
1995-01-17 10:37               ` Mark Reinhold
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox