Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: sfluhrer@ix.netcom.com(Scott Fluhrer)
Subject: Re: [++] Tight coding
Date: 1998/03/02	[thread overview]
Message-ID: <6dd6p9$eag@sjx-ixn8.ix.netcom.com> (raw)
In-Reply-To: slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au


In <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au>
peter@eepjm.newcastle.edu.au (Peter Moylan) writes: 
>
>
>One of my major gripes about C is the strong influence it's
>had on operating systems design.
>
>We have memory segmentation.  We've had it for years.  What
>we don't have are operating systems that make proper use
>of the segmentation hardware.
You mean Windows 3.1 and OS/2 version 1.x don't count?
>
>It's true that the earliest attempts to introduce segmentation
>were killed off by considerations of hardware cost and speed.
>But those problems were solved some years ago, when the
>80286 first appeared.
Huh???  Have you actually tried writing a heavily segmented program for
the 80286?  The program is *much* larger and slower that a flat model
program.  That's the reason there was much rejoicing when the 386 came
out, and you could make a decent sized program without worrying about
the %^&$#^&*%@ segment/selector registers

The reasons why segementation on the 80x86 series is so lousy:

- You had a total of 2 segment registers you could use to access data
  not on the stack (with the 386 and later, you got 4).  This makes it 
  difficult for compilers to access multiple objects at once (and, to
  access data in a segment, you have to stuff it in one of your two
  precious segment registers)

- When you reload a segment register in protected mode, the processor
  would pause for an amazingly long time while it reloaded the contents
  of the LDT/GDT.

Also, on the 286 (and the 386 and beyond), you were limited to a total
of 16382 segments at any one time (this includes any segments needed by
the OS, interrupt handlers, everything).  If you tried to segment
everything, a large program would easily hit this limit.

>                       Once you can get the segmentation
>hardware onto the processor chip, and have some space left over
>for decent-sized caches, you've got the technology to bring
>segmentation to the masses at an affordable cost.
>
>The catch is that you have all those C programmers demanding
>a "linear address space".  Why would anyone need a linear
>address space?  Answer: it's needed if you want to do dirty
>tricks with pointer arithmetic.  Never mind that those dirty
>tricks fell out of favour years ago.  The C standard says
>that they're legal, so any C compiler that doesn't support
>them is not standard-compliant.
Please state where in the C standard where any pointer arithmetic is
legal, except within a single array (which would be in a single segment
anyways).

>
>For the more modern programming languages, a segmented
>address space is superior.  There's a natural mapping between
>module boundaries and segment boundaries.  Unfortunately,
>our compilers tend not to take advantage of this, because of
>the bias in the operating systems support towards linear
>addressing.
Or rather, the total lack of any modern architecture with any sort of
adequate segment support -- that is, have a reasonable large maximum on
the total number of segments, and not have a huge performance hit when
you use them

>
>Indeed, the segmentation hardware is not taking off the way
>one would have expected.  Even Intel, which must have invested
>a fortune in developing their segmentation hardware, has
>dropped the idea.  They keep it in their 80x86 line for
>backwards compatibility, but they're not putting segmentation
>hardware into their other processors.  Presumably they
>decided that the demand just wasn't there.
Or, maybe, they actually *studied* the idea, and came to the conclusing
that it was a bad one...

-- 
poncho




  parent reply	other threads:[~1998-03-02  5:00 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-23  5:00 Wildfire and NT Robert Harley
1998-02-24  5:00 ` brianh
1998-02-24  5:00   ` Sean Burke
1998-02-25  5:00     ` Maynard Handley
1998-02-25  5:00     ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen
1998-02-28  5:00       ` Piercarlo Grandi
1998-03-01  5:00       ` [++] Tight coding Bill Moyer
1998-03-01  5:00         ` Ruud Bruijnesteijn
1998-03-01  5:00           ` scott
1998-03-02  5:00             ` Kaz Kylheku
1998-03-02  5:00             ` Terry Moore
1998-03-02  5:00               ` Kaz Kylheku
1998-03-02  5:00               ` Pete Becker
1998-03-03  5:00                 ` Ruud Bruijnesteijn
1998-03-03  5:00                   ` Pete Becker
1998-03-04  5:00                     ` Terry Moore
1998-03-03  5:00                       ` Pete Becker
1998-03-04  5:00                       ` Ruud Bruijnesteijn
1998-03-02  5:00             ` Martin Tom Brown
1998-03-01  5:00         ` Larry Kilgallen
1998-03-01  5:00           ` [++] Tight coding (comp.sys.dec-only thread) Bill Moyer
1998-03-02  5:00         ` [++] Tight coding Peter Moylan
1998-03-02  5:00           ` Martin Harvey
1998-03-02  5:00           ` Kaz Kylheku
1998-03-02  5:00           ` Lawrence Kirby
1998-03-02  5:00             ` Peter Moylan
1998-03-02  5:00               ` Kaz Kylheku
1998-03-02  5:00               ` Ketil Z Malde
1998-03-04  5:00                 ` Lyn A Headley
1998-03-03  5:00               ` Lawrence Kirby
1998-03-02  5:00           ` Scott Fluhrer [this message]
1998-03-03  5:00           ` Larry Kilgallen
1998-02-25  5:00     ` Wildfire and NT Mike Albaugh
1998-02-25  5:00     ` brianh
1998-02-24  5:00   ` Bill Moyer
1998-02-25  5:00     ` Larry Kilgallen
1998-02-25  5:00       ` brianh
1998-02-25  5:00         ` Epiphanies (was: Wildfire and NT) Carlie Coats
1998-02-25  5:00     ` Wildfire and NT John Hascall
1998-02-25  5:00       ` Rob Rodgers
1998-02-24  5:00   ` David Hinds
1998-02-25  5:00     ` Del Cecchi
1998-02-25  5:00     ` brianh
1998-02-25  5:00   ` Bernd Paysan
1998-02-25  5:00     ` brianh
1998-02-26  5:00       ` Doug
1998-02-26  5:00         ` Jeffrey S. Dutky
1998-02-26  5:00       ` Bernd Paysan
1998-02-27  5:00         ` brianh
1998-03-01  5:00           ` Ketil Z Malde
1998-02-27  5:00   ` Paul Kahler
1998-03-02  5:00     ` Joel Gallun
1998-03-02  5:00       ` Przemek Klosowski
read-only archive

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