Rhapsody memory,was Re: Memory on the Mac

Adrian Hey ahey@iee.org
Wed, 27 May 1998 13:01:01 +0100 (BST)


On Sat 02 May 1998 I wrote:
> One particular message I would like to have seen, but never did
> (I presume I was a 'Persona Non Grata' at the time), was Melissa
> O'Neils message about Rhapsody API functions associated with memory
> management (Brent Knight told me about this). I had thought I'd wait
> until it appeared in the archive, but this seems to be stuck at
> Jan 15 at present. Would somebody who still has a copy of this be
> kind enough to post it to me?

Thanks to Ronny Wichers Schreur for updating the clean-list
archive by hand. That must have taken ages. At last I get to see
what Melissa O'Neill had to say.

> It's very rare for a buggy application to bring down Unix machines.

I'll have to take your word for that, though that doesn't seem to fit my
(admitedly limited) experience. In fact they seemed to be even less
robust than PC's under DOS/Windows. I wouldn't have thought that
possible, had I not seen it myself. (At the time I'd only ever used PC's
and VAX/VMS.) I suppose in my earlier message I assumed it was buggy apps
which caused the crashes. It could be that it was the OS that was
responsible.

> With regard to memory, it's certainly true that if an application
> allocates memory stupidly and without consideration for other programs
> running on the same machine, there is only a limited amount the
> operating system can do, 

Regretably, this is so. I've often wondered if there was anything an OS
or OS vendor could do to force applications writers to get their software
to behave itself. I haven't got any magic solutions. About the only thing
I can think of would be for OS vendors to vet every third party application
themselves and give it the 'thumbs up' if it makes the grade, hardly a
realistic proposal. The other big problem is fragmentation, if a heap isn't
garbage collected and compacted somehow, it can be very difficult to do
anything other than allocate memory stupidly. Perhaps it would be a good
idea for the OS to help with this. Unfortunately, this is very difficult
with languages like Pascal,C,C++ etc.

> but on the other hand, a good operating system can offer a number of
> useful tools and features for programs that want to use memory wisely.

Yes, this is about all one can reasonably hope for. If the OS makes memory
managment easy, most programmers will have the sense to use it.
(Although in the case of garbage collected languages, memory
management is outside the control of applications programmers, so
we'd better hope that the compiler writers get it right.)

> Rhapsody is based on NEXTSTEP, which uses a Mach kernel for managing
> memory. The important thing is that, unlike MacOS, applications are
> free to request more memory as they need it and free it up later.
> They can even tell the operating system that memory isn't going to
> be used in a while. Under Mach, that is achived by using vm_allocate,
> vm_deallocate, vm_deactivate, and vm_set_policy -- you can even ask
> about the state of memory as a whole with vm_statisics. Under a
> traditional Unix like Solaris, applications use sbrk to increase or
> decrease their memory allotment, and can tell the operating system
> about their paging behaviour using madvise.

This seems pretty sensible. I wonder, does this include a mechanism
for the OS to tell the application to free as much memory as possible?
Applications with garbage collected heaps could probably do this fairly
easily. (I suppose you would still need to be very careful about doing
this pre-emptively, since it would be difficult to know exactly
what the processor state was and what registers were active pointers etc..)
Knowing that the OS could re-claim memory if it needed it would help
applications/compiler writers feel more confident about being (temporarily)
greedy with memory. As far as garbage collected heaps are concerned, having
more heap space should reduce the average garbage collection overhead.
 
> P.S. Yes, most applications I've seen on Solaris are terrible.

Funny you should say that, but..

> To get an idea of what to expect from Rhapsody, go look at a NEXTSTEP machine.

Unfortunately I don't know anybody who's got a NEXTSTEP machine. I did
think about buying a copy of the OS a few years ago when it was ported
to PC's, but the price put me off.  I was quite keen to try it out, but
not _that_ keen. Still, I've already heard enough about Rhapsody to know
that its probably going to be a fairly good OS, certainly much better
than the trash we're all used to, so I'm a convert.

Does anybody know when we can expect to get to see Rhapsody?
Will it work on my shiny new G3?
Can we safely assume that Clean & Clean Apps will run in the 'Blue Box'?
I seem to remember (from a few years ago) a spiffy OS called 'Pink' was
promised. Whatever happened to this?
Perhaps Rhapsody also has a Pink Box.

Regards
-- 
Adrian Hey