From: johnsd2@vccnw07.its.rpi.edu (Daniel Norman Johnson)
Subject: Re: Why a Mac???
Reply-To: johnsd2@rpi.edu
Organization: Rensselaer Polytechnic Institute, Troy, NY.
Date: Thu, 1 Oct 1992 21:24:51 GMT

In article <5364@krafla.rhi.hi.is>, karlth@rhi.hi.is (Karl Thoroddsen) writes:
|> In <6040.2ac300ae@hayes.com> bcoleman@hayes.com (Bill Coleman) writes:
|> 
|> >In article <5344@krafla.rhi.hi.is>, karlth@rhi.hi.is (Karl Thoroddsen) writes:
|> 
|> >> No Windows 3.1 doesn't need memory handles, 
|> >News flash. Windows 3.1 still has handles.
|> 
|> Windows 3.1 *has* handles and you *can* use them, but you don't *need* them 
|> when managing memory.  They are only used as intermediate steps in memory 
|> allocation.

I agree completely. :)

|> Simplified steps:
|> 
|> NormalPointer *pointer;    
|> pointer=GlobalLock(GlobalAlloc(size));
|> <'pointer' points to a moveable block>
|> <No need to Lock/Unlock during references>
|> <.. .......>
|> <Later ....>
|> GlobalFree(GlobalHandle(pointer));
|> 
|> Notes:  GlobalAlloc returned a handle that was locked immediatly.
|> 	No need to keep the handle, cause it ain't used.

You mean, "ain't used again."
But it IS used (by GlobalFree); Its just that you dont need
to keep it. You can get it.

|> >> Windows 3.0 running Real Mode did
|> >> and it was implemented like MacOS implements handle objects.  
|> 
|> >Actually not. Windows has a single table of "master pointers", while the
|> >Mac memory manager dynamically allocates blocks of master pointers as they
|> >are needed.
|> 
|> Both the Mac and Windows Real mode use intermediate software allocations to
|> implement moveable memory blocks, whether they are called Master Pointers(Mac)
|> or Burgermaster Table(Windows Real mode).  The main point is that Windows 3.1
|> implementation is CPU supported and hidden from the programmer.

It is hidden by the compiler, NOT Windows. If you're compiler does
this, hooray! Just don't program in assembly. :)

This is because there aren't enough selectors to do around,
so you need to break up  the  blocks you allocate into sub-blocks
and use THOSE.

|> >> In Windows 3.1
|> >> all memory blocks are relocatable be default and it's totally hidden from the
|> >> programmer.
|> >Not completely.
|> 
|> You can of course always "hack" your way past this.  But I've never seen
|> it done (Although it probably has been done) and it isn't done during
|> normal memory allocation.

Care to explain how you can hack pst this stuff, short of using
an axe on your CPU?

|> >>>You DO have to lock handles in windows. 
|> >> 
|> >> Not in Windows 3.1.
|> 
|> >Yes you do. You have to call GlobalLock at least once. The difference between
|> >Windows 3.0 and 3.1 is that in 3.1 you can leave the handle "locked" with
|> >no dileterious effect. Since Windows uses 286 memory management to rearrange
|> >physical memory, you don't have to keep dereferences handles in one place.
|> 
|> That's right, there are handles in Windows 3.1, but you don't *need* them,
|> unless you consider calling GlobalLock once *using* handles.

Which I do. So there! :)

[deletia- locking trivia]

|> >> You can request a fixed block of memory.
|> 
|> >Odd, you can do this under the Mac OS, too.
|> 
|> What's odd?

That Fixed memory blocks are supposed to be a feature  of
Windows, when the MacOS not only has them,  but has special
commands to allocate them (NewPtr- it allocates a block
as low as posisble in the heap and  returns a pointer to it)

|> Ugh!

Ughly Ugh!

[here we go again, Karl... :)]
-- 
			- Dan Johnson
And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0

These opinions have had all identifiying marks removed, and are untraceable.
You'll never know whose they are.
Newsgroups: comp.sys.mac.advocacy