Re: mac schmack

[prev] [thread] [next] [lurker] [Date index for 2003/09/08]

From: peter (Peter da Silva)
Subject: Re: mac schmack
Date: 21:29 on 08 Sep 2003
> >That's the ONLY way in which Mac OS 9 is faster than Mac OS X, when you're
> >comparing the same operations.

> No, it isn't.  Sending Apple events is faster in Mac OS, for example (on my
> machines, Mac OS 9.2.x and Mac OS X 10.2.x, anyway).

I did not know that, but I can see how that could be the case. That's going to
be a result of memory protection.

Could you comment on where this might be a bottleneck?

> >> It may be faster at IO, one some machines.

> >Unless there's a driver problem on OS X, OS X can not help but beat OS 9
> >on IO because it never has to defer IO in favor of computation, *and* the
> >impact of non-polled I/O on computation is negligable.

> Again, you are missing the point.  I am talking about raw speed apart from
> problems with multitasking.  I said this already, quite clearly.

Once you eliminate what you're dismissing as "problems with multitasking"
there's very little left for which the OS can have an effect on.

In particular, in Mac OS X or any other preemptive multitasking system,
if there is only one active application it will monopolize all the CPU. In
practice, it will lose a fraction of a percent to things like the scheduler
but that will be no more than a fraction of a percent on any machine for
which OS X is even vaguely practical. And cooperative applications, as we
will see, have their own overhead to deal with... overhead that can be even
more significant.

I've been doing realtime control systems for over 20 years. I've measured
the OS overhead on machines all the way back to the PDP-11... if you can
show a situation where a cooperative system is more than a percent or so
faster than a preemptive system for a single active application then I can
show you an application that needs to be fixed.

> The one glaring exception to what I'm talking about is networking.  Yes,
> networking on Mac OS X is tons faster.  Happy?  :p

Networking is one of those things that involves heavy multitasking, so
no wonder.

Virtual memory on Mac OS X is tons faster.

A lot of GUI operations are tons faster on Mac OS X, too.

Even within an app, and ignoring things like downloading because they
involve the evil networking, a lot of stuff is faster on Mac OS X because
it can meaningfully happen in the background.

> Right, the OS is not involved.  Right.  Uh-huh.  Sorry, I thought you
> actually had a serious point here.  You see, when I grant that apps can be
> slowed down because of cooperative vs. preemptive multitasking and then go
> on to say how Mac OS, apart from such things as these, is not slower, and
> you go on to assert it is slower specifically because of those excluded
> reasons, I get confused.

Obviously. What you're saying is "Mac OS isn't slower than Mac OS X when
you're not actually using the OS".

Well, yeh, I'll grant that point. And I'd like a bit more info on where
Apple Events are going to be a bottleneck. I have an idea I'm not going
to like the answer.

> That would be a nice way to sum up, if that were the only thing the OS did.
> When I call a sleep() function, for example, it is the OS that is providing
> that, both in the API and in what the API does when it is called.

If I understand rightly what call you're talking about here, Mac OS X is
faster because a preemptive application doesn't have to call it at all.

The need for an application in Mac OS to periodically poll the OS for events
that other applications may (but usually don't) need to react to is actually
going to make a compute bound application marginally faster on Mac OS X.

Thanks for reminding me.

This example does bring the confusion into focus. You're not talking
about the relative cost of cooperative versus preemptive multitasking at all!
The extra cost to a system call in Mac OS X has nothing to do with
multitasking or the scheduler, it's purely a matter of memory protection
overhead. On the Amiga, for example, which had a real-time preemptive
multitasking OS... the "system call" (message passing) overhead was
significantly lower than it was even in the original Mac OS. The context
switch overhead was as low as in the Mac, it was shared among multiple
messages, and it only happened when there was actual work to do that
required a context switch... if the call could be completed in the current
context it was just a subroutine call, otherwise it took 4 instructions
to put the message on a queue. The scheduler (sleep) was only involved in
two cases: (1) the application needed to wait on an external event; or
(2) an interrupt occurred.

The bottom line is that there is no detectable overhead that can be
attributed to preemptive multitasking by itself.

The cost you're seeing is all due to memory protection.

> Well, of course, there IS multitasking, cooperative intead of preemptive.
> But there is also an OS below the GUI.  Not sure exactly why you say there
> isn't.  Shorthand for saying you need the GUI to do most things?

The Macintosh scheduling and event handling is based on the requirements and
capabilities of the GUI. Interprogram communication, scheduling, context
switches, all happens through APIs derived from the GUI... it's not like
OS X, AmigaOS, NT, or other modern operating systems where there's a formal
underlying OS that provides services that the GUI, along with other
subsystems, uses.

> Yes, which is why people like me, who knew their systems very well, kept
> such components out of the System Folder.

That is an accomodation to the problem. The average user comes to his own
accomodation with that problem, just as I have come to an accomodation with
my vision and my knees. To say that this doesn't "significantly harm the
average user" seems just the least bit jesuitical to me.

> >OS X doesn't act like that. Yes, sometimes some program will put up a moded
> >grab and I'll get a few seconds of lollypop in that app. VERY rarely, if I
> >have a few dozen applications running and a backup going on

> I *often* see significant system slowdown because of one misbehaving
> process on Mac OS X.

And this is similar to the way OS 9 behaves? By the time OS X has reached the
point of "significant system slowdown" what are you running? If you tried to
do a fraction of the same things on OS 9 what would it have done? Would you
be "significantly harmed" if OS X had locked up completely many times more
often?

I occasionally see "significant system slowdown" in OS X myself. I've come
to an accomodation with it... but in terms of accomodation this is like
comparing a sore finger with multiple amputations.

> >> When you are browsing the web or reading email, it simply didn't matter.

> >Like hell it didn't. The only reason it didn't was because someone spent a
> >grand or two on their Mac and they'd lose face if they admitted even to
> >themselves that under the covers the emperor had no clothes.

> No, it is because to me it *actually didn't happen* because I know how to
> keep the machine running well.

After you learned how to work around the problems, then I'm sure it didn't
happen any longer.

That doesn't mean it actually didn't happen, for people less technically
oriented or less patient with their computers.

Oh... let's get one thing straight. I'm not saying that the trade-off isn't
worth it, or that it wasn't worth the money, I'm just pointing out that
there's a lot of Mac users there who deny that this tradeoff exists, and
at the same time excuse what I consider grossly unpleasant and far too
frequent failures of the old OS with things like "it only froze for X
seconds, at least it didn't crash".

> You really look stupid by telling me what I experienced.  Really, you do.
> Just a helpful hint.

Here's a helpful hint. If you're going to tell me my narratization of the
process is so completely off base, you probably want to stick a few more
paragraphs between it and something like this:

> Now, I guess I should clarify and say it wasn't an "active" problem, or
> somesuch.  Of course it was a problem, but it was a problem that I worked
> around.  I didn't merely learn to live with it, I tuned my system to
> decrease, and mostly negate, its negative effects.

Because here you're saying, in a lot of the same words, exactly the same thing
that I was saying and that you're objecting to.

There's stuff above here

Generated at 14:02 on 01 Jul 2004 by mariachi 0.52