Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!ames!oliveb!sun!david From: david@sun.uucp (David DiGiacomo) Newsgroups: comp.sys.intel,comp.lang.c Subject: Re: segments and Unix Message-ID: <9400@sun.uucp> Date: Tue, 18-Nov-86 18:52:50 EST Article-I.D.: sun.9400 Posted: Tue Nov 18 18:52:50 1986 Date-Received: Tue, 18-Nov-86 23:46:15 EST References: <13802@amdcad.UUCP> Reply-To: david@sun.uUCp (David DiGiacomo) Organization: Sun Microsystems, Inc. Lines: 28 Xref: mnetor comp.sys.intel:25 comp.lang.c:89 In article <13802@amdcad.UUCP> phil@amdcad.UUCP (Phil Ngai) writes: >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... > >Would this be worth doing? Of course, it would complicate the OS's >memory management duties. But think about it. No, for four reasons: - It is very expensive to expand pointers to hold a reasonably large (16 bit?) segment number field. - Other things being equal, address translation is slowed considerably by segment bounds checking. - Non-uniform pointers lead to additional software complexity and cause severe problems when porting code from traditional systems. - You can easily accomplish what you want to do in a pure paged system. Just decide that you are going to use an arbitrary number of pointer bits for the "segment" number and load your page tables accordingly. The only difference is that segment granularity is one page, but that shouldn't matter for the debugging application you mention.