[comp.sys.mac.misc] Mac & Win: Questions about memory management

strobl@gmdzi.UUCP (Wolfgang Strobl) (07/14/90)

[I am posting this on behalf of Ken, so please reply to him, not me!]
 
Over the past several weeks (since about may 23), there has been a
series of Mac vs. Windows arguments posted on this group.  Many of
these posting have had a very argumentative tone to them while a few
have been quite informative.
 
I would like to see more comparitive peices explaining the differences
between the Mac OS and Windows.  (I am a Windows programmer who works
next to the Macintosh development group at a university where
(almost) every students has a Mac.)  The Mac development people and I
have compared various components of System 6 and 7 with Windows 2 and 3.
 
However, while it would probably be benificial to continue to see how
both major GUI (I hate that term!) developers for micros approach common
problems, it is _not_ conducive to continue to attach each other and
the platforms.
 
I would suggest that mail subject lines begin with something like
"Mac & Win: Use of resources" or "Mac & Win: User interface differences"
rather than "Loss of 20%," "Flame War," or "What it can't do".

And another thing, would those of you who keep comparing the Mac OS to
DOS (you know who you are) stop doing so.  While Windows does rely on
DOS for file management services, graphics, keyboard, and mouse services
are provided in Windows.  The fact that one (Windows) is invoked from
another (DOS) does not mean that one (Windows) cannot be better than the
other (DOS).  In fact, you would expect that the add-on product would
provide a fuller or somehow better set of services or users would not
choose to invoke it.
 
One more thing, while I'm on a roll (role?).  I agree that the press
got carried away telling people that Windows 3.0 was the cure for all
of the earth's ills.  It is much better than DOS, better than Windows
2.0, and in some ways, better than the Mac.  Microsoft has in no way
made Windows the best OS around -- they would, I suspect, suggest OS/2
with Presentation Manager for that role.
 
To get the ball rolling, I have some questions about Mac memory management
at System 6 and 7.
 
In Windows, applications do not (should not) hold pointers to data in the
global heap.  They instead hold handles which can be dereferenced to find
the pointer.  This allows the OS to move blocks to produce a larger contig-
uous space when it needs one.
 
If I understand the Mac model (sys 6 w/MultiFinder), the applications are
given a workspace or contiguous memory and that workspace does not move at
all during the life of the invocation.
 
Is my understanding of the Mac way correct?  What if an app needs more
memory, can it request that its partition be increased in size?  Is there
any way to unfragment memory?  Does system 7 change this?  Would a PMMU
help?
_______________________________________________________________________________
                                                            Kenneth S. Blackney
     Phone: (215) 895-1505                                    Drexel University
  Internet: Ken_Blackney@DUPR.OCS.Drexel.EDU                 Computing Services
    Bitnet: BLACKNEY@DUPR.BITNET                         Philadelphia, PA 19104

philip@pescadero.Stanford.EDU (Philip Machanick) (07/15/90)

In article <3102@gmdzi.UUCP>, strobl@gmdzi.UUCP (Wolfgang Strobl) writes:
> [I am posting this on behalf of Ken, so please reply to him, not me!]
[request for Windows/Mac discussion]
> To get the ball rolling, I have some questions about Mac memory management
> at System 6 and 7.
>  
> In Windows, applications do not (should not) hold pointers to data in the
> global heap.  They instead hold handles which can be dereferenced to find
> the pointer.  This allows the OS to move blocks to produce a larger contig-
> uous space when it needs one.
>  
> If I understand the Mac model (sys 6 w/MultiFinder), the applications are
> given a workspace or contiguous memory and that workspace does not move at
> all during the life of the invocation.
>  
> Is my understanding of the Mac way correct?  What if an app needs more
> memory, can it request that its partition be increased in size?  Is there
> any way to unfragment memory?  Does system 7 change this?  Would a PMMU
> help?

I don't know about System 7 (but have a strong feeling there's no radical
change). Because of its origin as a single application at a time system,
the Mac allocates a fixed partition for each application. This partition
contains the application's heap (called a "zone"). It's possible to create
a additional zones, if you have complex memory mangement requirements.
In addition, there is a system heap, and free space not yet allocated.
It's possible for a program to ask for a chunk out of this free space
(e.g., as temporary space for a buffer).

The heap contains two kinds of data objects: pointer-referenced and
handle-referenced. Handles - as in Windows - allow defragmentation.
However, this is _within_ a specific heap. Global memory can be fragmented;
however this is only a problem if you frequently launch/quit applications.
The only solution if you run out of space to launch a new application (if
there's enough free space total, but not in biggest free block) is to kill
(and maybe relaunch) applications.

In practice, this works reasonably well for users; memory management
is a big headache for programmers, especially beginners who are used
to more forgiving systems.

Adding a PMMU does not radically change the picture, because all programs
are still running in the same (potentially fragmentable) address space.

>                                                             Kenneth S.
Blackney
>      Phone: (215) 895-1505                                    Drexel
University
>   Internet: Ken_Blackney@DUPR.OCS.Drexel.EDU                 Computing
Services
>     Bitnet: BLACKNEY@DUPR.BITNET                         Philadelphia,
PA 19104

Philip Machanick
philip@pescadero.stanford.edu

rad@genco.uucp (Bob Daniel) (07/19/90)

In article <3102@gmdzi.UUCP> strobl@gmdzi.UUCP (Wolfgang Strobl) writes:
> 
>Is my understanding of the Mac way correct?  What if an app needs more
>memory, can it request that its partition be increased in size?  

  Under MultiFinder, each application allocates its own "heap".  It is
  possible to access a temporary handle outside of the heap using
  MFTempHandle.

>Is there
>any way to unfragment memory?  Does system 7 change this?  Would a PMMU
>help?

  You can unfragment the memory within a heap but not all heaps.  I do not
  know about Sys7.