segments and Unix

Phil Ngai phil at amdcad.UUCP
Wed Nov 19 05:44:48 AEST 1986


I'd like to propose something here. Have you ever spent a few days
tracking down a bug caused by writing beyond the bounds of an array
and trashing a vital data structure which only gets noticed many
cycles later? Strings, of course, are arrays.

Suppose every data structure were in its own segment. And of course,
that every segment were big enough to hold any data structure you
needed so that you didn't need to manage multiple segments for one
data structure. Then when a bug trys to access beyond the end of an
array, the bad reference is trapped at the time of dereference instead
of invisibly (at the time) trashing an innocent data structure that
happened to be in the right (wrong) place.

Would this be worth doing? Of course, it would complicate the OS's
memory management duties. But think about it.
-- 
 The distance from the North end of Vietnam to the South end is about
 the same as the distance from New York to Florida.

 Phil Ngai +1 408 749 5720
 UUCP: {ucbvax,decwrl,hplabs,allegra}!amdcad!phil
 ARPA: amdcad!phil at decwrl.dec.com



More information about the Comp.lang.c mailing list