Re: C is too old? opinions?
- From: "Rob Thorpe" <robert.thorpe@xxxxxxxxxxxx>
- Date: 13 Jul 2006 16:45:16 -0700
jimmaureenrogers@xxxxxxxxxxxxxxxx wrote:
Phlip wrote:
goose wrote:
Now I'm really curious; how does the garbage collector run in
deterministic time? Is it possibly a case of running the gc after every X
operations knowing that no more than Y memory has to be released and that
doing that will require no more than Z time?
Making a garbage collector deterministic would defeat the point of a
garbage collector - trading programming time for run time.
If the programmer must specify "please collect this and this object, now,
before the next real-time strobe", they might as well use pointers and
'free()'...
Along the same line of reasoning, how can you prove that a program is
deterministic in both time and memory using dynamic memory
allocation?
That problem was handled in the SPARK programming language by
prohibiting dynamic memory allocation in real time systems.
http://en.wikipedia.org/wiki/SPARK_programming_language
Dynamic memory allocation has many of the same problems as GC for
real-time.
Lets say malloc and free work by keeping a single linked list of free
space.
That means that in the worst case one of malloc or free must walk the
whole list to find space. The list could be very long, making the
worst case bad and dependent on the size of memory.
To make it better you could use a malloc with several buckets for
different sizes of allocation, this is like a chaining hash map. Each
bucket has a free list for that size of allocation. Then the worst
case is the length of one of these bucket lists. But this has problems
too. Imagine if all the allocations are in the smallest bucket, the
problem then reduces to the "single linked list" method of malloc/free.
I once met someone who had designed a real-time malloc/free, it wasn't
simple. It was for a specific platform with limited memory and it knew
the amount of memory available and much of the code depended on that.
Many of the most interesting real time systems are also safety-
critcal systems. Examples include avionics, high speed train
control systems, and medical diagnostic systems. Each of those
areas require a process to certify that the software does what
it should when it should, and not something else. In short, the
software must be proveably correct.
Very few programming languages efficiently support the level
of proof required for safety-critical real-time systems.
I'd say "very few implementations efficiently support the level of
proof required". Many more languages could if implementors could be
bothered to make implementations that did. But it isn't worthwhile.
.
- Follow-Ups:
- Re: C is too old? opinions?
- From: Logan Shaw
- Re: C is too old? opinions?
- References:
- Re: C is too old? opinions?
- From: Rob Thorpe
- Re: C is too old? opinions?
- From: goose
- Re: C is too old? opinions?
- From: Phlip
- Re: C is too old? opinions?
- From: jimmaureenrogers@xxxxxxxxxxxxxxxx
- Re: C is too old? opinions?
- Prev by Date: Re: C is too old? opinions?
- Next by Date: Re: C is too old? opinions?
- Previous by thread: Re: C is too old? opinions?
- Next by thread: Re: C is too old? opinions?
- Index(es):
Relevant Pages
|