[comp.sys.mac.programmer] INITs

adail@pnet06.cts.com (Alan Dail) (07/07/88)

I amcurrently writing an INIT that installs abackground reotine by patching
System Task.  THis routine could potentially need a large amount of RAM.  Is
there any way to make the System Heap grow to help ensure that this memory
will be available when needed?  Also, I still would like to know if SystemTask
is allowed to allocate/move memory.

Thanks

Alan Dail

UUCP: {crash uunet}!pnet06!adail
ARPA: crash!pnet06!adail@nosc.mil
INET: adail@pnet06.cts.com

han@Apple.COM (Byron Han, Licensed To Dream) (07/10/88)

In article <278@hodge.UUCP> adail@pnet06.cts.com (Alan Dail) writes:
>I amcurrently writing an INIT that installs abackground reotine by patching
>System Task.  This routine could potentially need a large amount of RAM.  Is
>there any way to make the System Heap grow to help ensure that this memory
>will be available when needed?  Also, I still would like to know if SystemTask
>is allowed to allocate/move memory.
>
Regarding growing the system heap at INIT time... read V-352

backround tasks should probably be installed as a VBL at boot time.  you are
not guaranteed to have SystemTask called on a regular basis.

The system heap can typically not be grown past boot time.

SystemTask will give time to desk accessories which may move memory so I do
not see any reason why SystemTask cannot allocate/move memory.


------------------------------------------------------------------------------
Byron Han,  Licensed to Dream.                 One Person, One Macintosh.
Apple Computer, Inc.                     -------------------------------------
20525 Mariani Ave, MS27Y                 domain: han@apple.COM
Cupertino, CA 95014                      UUCP:{sun,voder,nsc,decwrl}!apple!han
--------------------------------------   GENIE: BYRONHAN
ATTnet: 408-973-6450   Applelink: HAN1   CompuServe: 72167,1664
------------------------------------------------------------------------------

palevich@Apple.COM (Jack Palevich) (07/11/88)

I just wanted to add something to Byron's posting:

If you want to grow the System Heap by a fixed ammount whevever your INIT is
installed, then you can include a sysz resource in your INIT file.  The
sysz resource has a longword of data which is the number of bytes your INIT
needs added to the size of the system heap.

Under MultiFinder the system heap grows dynamicly.  Without MultiFinder the
best you can do is change the value of the sysz resource and reboot.  This
can be useful when you are, for example, keeping a desktop picture in RAM:
When the user chooses a new picture, which has a different size, you can
allocate a different ammount of memory.

Jack Palevich
Apple Computer, Inc.

adail@pnet06.cts.com (Alan Dail) (07/12/88)

>backround tasks should probably be installed as a VBL at boot time.  you are
>not guaranteed to have SystemTask called on a regular basis.
But VBL tasks arn't allowed to move memory are they?

Alan Dail

UUCP: {crash uunet}!pnet06!adail
ARPA: crash!pnet06!adail@nosc.mil
INET: adail@pnet06.cts.com

mkg@lzsc.ATT.COM (Marsh Gosnell) (07/13/88)

In article <13728@apple.Apple.COM>, palevich@Apple.COM (Jack Palevich) writes:
> If you want to grow the System Heap by a fixed ammount whevever your INIT is
> installed, then you can include a sysz resource in your INIT file.  The
> sysz resource has a longword of data which is the number of bytes your INIT
> needs added to the size of the system heap.

One thing that isn't obvious is that you shouldn't ask for more than you're
going to use right then and there.  When an INIT is loaded it's sysz space
request is checked against the free space in the system heap and the heap size
is adjusted accordingly.

What this means is that you can't use sysz to simply reserve space for
yourself.  If you request a big chunk and don't use it, the next INIT loaded
will reuse the space.  The only way to keep your allocation is to make sure
you're loaded last.
  Marsh Gosnell

jmunkki@santra.HUT.FI (Juri Munkki) (07/14/88)

In article <13630@apple.Apple.COM> han@apple.apple.com.UUCP (Byron Han, Licensed To Dream) writes:
>In article <278@hodge.UUCP> adail@pnet06.cts.com (Alan Dail) writes:
>>I amcurrently writing an INIT that installs abackground reotine by patching
>>System Task.  This routine could potentially need a large amount of RAM.  Is
>
>backround tasks should probably be installed as a VBL at boot time.  you are
>not guaranteed to have SystemTask called on a regular basis.
>
I patch GetNextEvent and Button for background processing in my Monitor Network
software.  Button is the only trap that can use the memory manager AND that is
called regularly when the user is choosing from a menu or dragging an icon.



Juri Munkki
jmunkki@santra.hut.fi
jmunkki@fingate.bitnet

P.S.	Some time ago, someone requested a "screen slaver" program. Monitor
	Network is such a program. There's a free demo version (allows only
	3 slave macs and one master) that I could post to comp.binaries.mac,
	if there is enough interest.

mas@ulysses.att.com (Michael A. Schoen) (07/09/90)

I have a question for you programmers out there.  In the docs
for a shareware init that I got said that in this new version it
was a separate file, using Apple's new INIT31 Resource (or something
like that).   The impression I got was that in the olden days, INITs
had to be directly installed in the System file.   This was less
convenient for turning INITs off, but it seemed to me that for INITs
that one would not want turned off, having it in the system file would
be more efficient.  So, my question is, is it possible to take an
INIT and somehow copy it into my System file to make it more
efficient??  Please respond by email as I do not regularly read this
group.  Thank you.

 

Michael A. Schoen
AT&T Bell Laboratories (provided for identification only)
mas@ulysses.att.com

billkatt@mondo.engin.umich.edu (billkatt) (07/10/90)

In article <13360@ulysses.att.com> mas@ulysses.att.com (Michael A. Schoen) writes:
>I have a question for you programmers out there.  In the docs
>for a shareware init that I got said that in this new version it
>was a separate file, using Apple's new INIT31 Resource (or something
>like that).   The impression I got was that in the olden days, INITs
>had to be directly installed in the System file.   This was less
>convenient for turning INITs off, but it seemed to me that for INITs
>that one would not want turned off, having it in the system file would
>be more efficient.  So, my question is, is it possible to take an
>INIT and somehow copy it into my System file to make it more
>efficient??  Please respond by email as I do not regularly read this
>group.  Thank you.
>
You could probably do it, but it wouldn't make your INIT more effecient.
MacOS doesn't 'context-switch' when switching from code in the system to
code not in it.  So in this way, the UNIX creedo of 'in the kernel' doesn't
apply to the Mac.  The only time the Mac context switches is when switching
from executing one app to another.

=============================================================================
Steve Bollinger                                                    ____/|
909 Church St. Apt C                                               \ o.O|
Ann Arbor, Mi. 48104                                                =(_)=
(313)-662-4073 -home (313)-763-3070 -work                             U     
billkatt@mondo.engin.umich.edu                              -ACK ACK ACK ACK!
                                                              "thhhhppppttt!"