Xref: utzoo comp.sys.m6809:860 comp.os.os9:86
Path: utzoo!utgpu!attcan!uunet!steinmetz!sunbelt!eaker
From: eaker@sunbelt.steinmetz (Charles E Eaker)
Newsgroups: comp.sys.m6809,comp.os.os9
Subject: Re: os9 level 2 woes!
Message-ID: <11895@steinmetz.ge.com>
Date: 18 Aug 88 15:41:38 GMT
References: <8808172042.AA01032@decwrl.dec.com>
Sender: news@steinmetz.ge.com
Reply-To: eaker@sunbelt.UUCP (Charles E Eaker)
Organization: General Electric CRD, Schenectady, NY
Lines: 52

In article <8808172042.AA01032@decwrl.dec.com> burke_vern@mtblue.dec.com (WHY BE NORMAL?) writes:
>	I recently outfitted myself with a 128K CoCo III,2 floppy drives,
>     and OS9 level 2(version 02.00.01).I've been having some difficulty
>     getting some extra memory space.I noticed that when the shell is
>     linked at startup,19 extra command modules are also loaded into
>     RAM.I wanted to get rid of some of these because I don't use them
>     enough to justify the space.At this point, mfree showed 48K.
>     I used the level 1 save command to save just the shell module,
>     and put it in my cmds directory.Now everything boots alright and
>     the shell works alright,but I ended up losing memory instead
>     of gaining it.I only have 40K now.It seems like OS9 is still
>     assigning the memory that old shell command(shell+19 modules)
>     required.aaaarrrrrgggghhhhh!
>	Is there an easier way to get rid of some of these modules?
>     Where did the memory go?Help!

I doubt that the level 1 save command will work properly with level 2.
I suspect that whatever module file it is creating is using up the
extra 8K when it is loaded into memory.

What I do know for sure is that getting rid of those extra modules will not
save any memory.  Level 2 allocates memory in 8K chunks because that's
the granularity of the memory management hardware.  For *each* process,
it will allocate a minimum of 8K bytes for the process's variables,
stack, etc.  In addition, if the program module is not already in
memory, it will allocate yet another 8K bytes (minimum) and load the module
into it from disk.  These two 8K chunks are then mapped into the 
CPU's address space whenever it is that process's turn to execute.
Since the shell module is less than 8K bytes
in length, the other commands are added to it since they are used
a lot.  Otherwise, each invocation of dir, for example, will result
in 8K bytes being allocated for its variables, stack, direct page
storage etc. (which happens no matter what), *AND* another 8K bytes
for the code module if it is not already in memory.  Since OS9 is
supplied with the shell and dir residing in the same 8K chunk of
memory, that same 8K chunk is mapped into the shell process's
address space and in dir's address space.

This is a very brief description which may leave you still scratching
your head.  Frank Hogg Laboratory sells a book that explains it
reasonably well.  It comes with listings (in assembler) of programs
which will show how things are mapped when the programs are run.

The moral of the story is that you can't do much with os9 in 128K.
Get a 512K upgrade.

                            Chuck Eaker

General Electric                 | eaker@sungod.steinmetz.ge.com            
Corporate Research & Development | eaker@ge-crd.arpa 
P.O. Box 8, K-1 3C12             | eaker@steinmetz.uucp  
Schenectady, NY 12301            |       518-387-5964