m5@lynx.uucp (Mike McNally) (05/04/89)
How is the BSD (version 7?) Bourne shell so small? Did Mr. Bourne make a deal with the Devil, getting unreal code compactness in return for an eternity in a sulfurous pit where the flames never stop burnin' ya? -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go.
chris@mimsy.UUCP (Chris Torek) (05/05/89)
In article <5549@lynx.UUCP> m5@lynx.uucp (Mike McNally) writes: >How is the BSD (version 7?) Bourne shell so small? The V7 shell, like most V7 programs, is small because it does not include any unnecessary `features'. (It also avoids stdio, for various reasons, mostly good; but mainly it is small because it was written small.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
ka@june.cs.washington.edu (Kenneth Almquist) (05/08/89)
m5@lynx.uucp (Mike McNally) asks: > How is the BSD (version 7?) Bourne shell so small? Did Mr. Bourne make > a deal with the Devil, getting unreal code compactness in return for > an eternity in a sulfurous pit where the flames never stop burnin' ya? If so, the Devil cheated (as usual). The Bourne shell was about 21K bytes. The previous version of the shell was only about 7K bytes. The size is partly a matter of careful coding, partly a matter of designing features so that they won't require too much space, and partly a matter of not throwing in lots of (possibly unnecessary) features. Consider function definitions. Function defintions in the System V shell are executable, so that the function definitions are parsed, and then copied when the function definition is executed. The code in ash to perform this copying takes nearly 1K bytes (and this is code that is written without any particular attention to coding style, since it is computer generated). If functions had been added to the shell in the early days of UNIX, the shell language might have been redesigned to eliminate this copy. Kenneth Almquist