|
|
Why are Expander and Explorer eating CPU time in the background?
|
|
|
|
Fresh-Faced Recruit
Join Date: Jun 2001
Location: Belgium
Status:
Offline
|
|
Most apps usu 0.0% CPU time when inactive in the background, as reported by top. Except Stuffit Expander en Internet Explorer. They constantly eat 0.5% to 1% CPU time. Why? Bad carbonisation?
|
*** Col. Panick with [ck] that's me.
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
They are probably calling WaitNextEvent() with a too small sleep time. WaitNextEvent() returns control to the calling application whenever an event has occurred or after the specified sleep time (to allow the handling of periodic task such as continuing downloading a web page or decompressing a file at idle time).
They wouldn't have to switch to carbon events completely (would probably be a major task for Internet Explorer), just pass a very large sleep time (MAXINT) to WaitNextEvent() and install Carbon Event Timers for periodic tasks (as needed).
Developer
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Apr 2001
Location: Capital city of the Empire State.
Status:
Offline
|
|
Sounds like a polite way of saying they were poorly written.
|
/mal
"I sentence you to be hanged by the neck until you cheer up."
MacBook Pro 15" w/ Mac OS 10.8.2, iPhone 4S & iPad 4th-gen. w/ iOS 6.1.2
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jun 2001
Location: Belgium
Status:
Offline
|
|
malvolio: i still prefer the first answer, though.
I also feel that a high cpu load is not really what makes processes run slower. Swapping Virtual Memory and paging is way worse. OS X also seems to put a high strain on the video board.
|
*** Col. Panick with [ck] that's me.
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Poorly written? Sort of, perhaps. I'd classify it as "quickly ported". WaitNextEvent() and friends are sort of the basis for the run-loop architecture of Classic Mac OS apps. Since every app on that system gets full control of the processor when it wants to, that architecture works well there.
However, on a modern core OS, it kills performance to be demanding CPU time every few milliseconds just to ask "did something happen?". Instead, its best to use the Carbon Event architecture to let the system tell you when things happen.
At WWDC they put a lot of emphasis on the fact that Mac OS X has very different performance characteristics from Mac OS 9. You can get a Carbon app up and running on X pretty quickly, but if you stop there, your app will suck.
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Dec 2000
Location: Los Angeles, CA
Status:
Offline
|
|
We were just learning about polling vs. interrupts in our CS class last quarter - am I right in assuming that WaitNextEvent and Carbon Events are direct analogs of these concepts in action?
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: May 1999
Location: Green Bay, WI USA
Status:
Offline
|
|
You think that's bad? Launch AIM, and watch its CPU usage while in the background (normally around 30-60%)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|