home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
118.lha
/
Rez.3
/
REZ.doc
< prev
next >
Wrap
Text File
|
1986-11-20
|
10KB
|
233 lines
**************************************************************************
***************************************************************************
***** *****
***** REZ is Copyright (C) 1988 by Jim Goodnow II and the binary *****
***** is freely redistributable except that it may not be included *****
***** as part of any commercial software package without my express *****
***** written permission. *****
***** *****
***************************************************************************
***************************************************************************
REZ - a general purpose resident program command.
---
Version 0.3
Copyright 1988
by Jim Goodnow II
BackGround
----------
Normally when programs are run on the Amiga, a copy of the program is
read into memory from the appropriate file system. This is known as
loading the program. Then the CODE and DATA segments are adjusted to
reflect the actual location of the program in memory. This is known
as relocating the program. Finally, the relocated program is allowed
to execute.
This process is repeated each and every time a program is run, no matter
how many times it is run. In addition, if the same program is started
multiple times, like running several of the Boxes demos simultaneously,
a copy of the program is made for each one run.
However, there is another way of loading and running programs that is
much more efficient. It is called making programs resident. When a
program is made resident, it is loaded into memory just once. Some or
all of the relocation is performed at the initial load. Then, when
the program is needed, it is used directly from memory, and when the
program finishes, the program is left in memory for the next execution.
This explanation has been slightly oversimplified, and a more detailed
explanation can be found in the technical section at the end of this
document.
OverView
--------
The operation of REZ is very simple. A list is maintained in memory of
the names of those programs which are desired to be resident. When any
of the programs are first loaded into memory REZ automatically notices
that the program being loaded is to be resident and does the special
REZ load on it. Anytime after the first time, the resident version of
the program will be used.
What this means is that you can tell REZ that you want a whole slew of
programs to be in the resident list, but only those programs that you
actually run will actually get loaded into memory. The first time you
run each one it will load about as fast as it would without REZ, but
every time after it will be almost instantaneous.
So, the simplest way to use REZ is to just execute (maybe in your
s:startup-sequence file):
REZ dir ls copy cd cc as ln make z
You can specify as many filenames as you want to since REZ maintains
a linked list of the names.
You can see the status of the resident name list by typing REZ with no
arguments. This will produce a display that looks like:
Name Active Status Total Pure Share Chk Type
cc 0 Loaded 7 No Yes OK Aztec C 3.4/3.6
as 0 Loaded 10 No Yes OK Aztec C 3.4/3.6
ln 0 Loaded 2 No Yes OK Aztec C 3.4/3.6
z 1 In Use 7 No Yes OK Aztec C 3.4/3.6
delete 0 Loaded 1 Yes Yes* > 0 BCPL
copy 0 Not Loaded 0 ? ? ?
cd 0 Not Loaded 0 ? ? ?
The first column displays the name of the program. The next two columns are
related. The first shows the number of programs actively sharing the Code
part of this program. The second one shows the status of the program which
is either not loaded, loaded but not executing, or actually in use. The
next column labelled Total shows the number of times this program has been
executed since being made resident.
The next column indicates whether a program has any absolute references
to Data from Code. If it does not, then it is considered Pure. This is
important and is reflected in the next column called Share. Each program
must have it's own individual Data area. If the Code contains absolute
references to the Data area, it is not possible to use that Code with
multiple Data areas. There are other restrictions as well, but normally
if a program is Pure, it will also be Shareable.
Which brings us to the Share column. If a program is not Pure, then
it can't be shared except for some special cases. REZ automatically
detects these special cases and takes advantage of them and sets a
Yes in this column. More detailed information can be found in the
technical information section.
The other requirement for being Shareable is that the Code segment
can not be modified. When a program is made resident, REZ computes
a checksum for each Code segment in the program. When the list of
resident programs is displayed, REZ recomputes the checksum and
normally an OK is displayed.
However, if a segment has been modified, then the number of the segment
will be displayed followin a '>'. In addition, if the program is Shareable,
REZ will automatically disable sharing which is indicated by an asterisk
following the "Yes" in the Share column. (See the "-c" option for automatic
checking.)
The final column makes an attempt to guess which language was used
to produce the program and is not guaranteed to be accurate, it just
seemed like useful information.
******************** DISCLAIMER ****************************
Despite rumors to the contrary, REZ does not slow down, add
bugs or in any way treat programs not produced with Aztec C
in any special manner. ;-)
************************************************************
Options
-------
REZ has a number of options which can be referenced by using the "-?"
option which will produce the following display:
REZ Version 0.1 2-10-88 by Jim Goodnow II
<no args> display the list
-a name add name to list (default)
-c toggle auto checksum
-f name parse lines from file
-k unload all programs
-l name load name into memory
-n name add name as non-sharing
-r name remove name from list
-u name unload name from memory
-? display this message
REZ without any arguments shows the status display discussed in the
overview. Otherwise, the remaining arguments can be mixed together
and affect files until a different argument is detected. For example,
the line:
REZ f1 f2 -r x1 x2
will add the files "f1" and "f2" since -a is the default, and will
remove files "x1" and "x2". We will now discuss each option in detail.
The "-a" add option simply adds the name(s) to the in-memory list
if not already on the list. Names should not contain '/' or ':'
characters as they are not necessary and may prevent REZ from
detecting the program load.
The "-n" add with no share option is the same as the "-a" option
but it prevents the program from being marked as shareable.
The "-l" load option forces the program(s) named to be loaded but not
executed. This usually requires that the program be in the current
directory since REZ will not search the PATH. When a program is run,
it is automatically loaded, so this option is not normally needed.
The "-u" unload option forces the program(s) named to have the memory
associated with them freed up. However, the name will remain in the
resident list. If the program is currently executing, the unload will
be delayed until the last active copy is finished.
The "-r" remove option removes the named program(s) from the resident
list. If the program is loaded, it is unloaded first. If the program
is in use, unloading and removal are delayed until all active copies
have finished.
The "-k" kill option does a remove on all the programs currently in
the resident list.
The "-c" checksum option is a toggle which defaults to OFF. When
enabled, it forces REZ to perform a checksum on the Code segments
of each program when it finishes executing. This is important the
first few times you make some new programs resident if you plan
to run multiple copies of the programs simultaneously. It will
disable sharing if it discovers that the Code segment has been
corrupted.
The "-f" file option parses lines from the named file for options
and names as described above. Files may not be nested, however
multiple "-f" options may be given.
Limitations
-----------
There are only two limitations to REZ that I know of. First, programs
that use the AmigaDOS overlay facility are detected by REZ and are
not loaded. I now how to handle it, but it may wait till a later
version.
Second, programs that are started by LoadSeg(), but don't use
UnLoadSeg() to free their segments may cause trouble. This is
because REZ doesn't know that the memory has been freed and
will use the same memory for the next LoadSeg(). The most common
examples of this are programs which detach from the CLI. Since
these programs tend to be run once this is not a real problem.
DB is another example that can be more problematic.
Implementation
--------------
REZ is implemented by replacing the internal LoadSeg() and
UnLoadSeg() vectors of AmigaDOS. The replaced vectors point
to a Exec type library which contains a loader and routines
for managing the resident list. The REZ program performs most
of its functions by making calls to the REZ.LIBRARY.
Technical Information
---------------------
This information will be supplied with the official release of
program.