• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: idle waste
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: idle waste


  • Subject: Re: idle waste
  • From: "Timothy J. Wood" <email@hidden>
  • Date: Thu, 28 Mar 2002 14:20:22 -0800

On Thursday, March 28, 2002, at 12:07 PM, Paul Cezanne wrote:
If I have a Cocoa application just sitting there doing nothing, how much CPU time does it waste? A lot, some, not much, negligible?

None, assuming the Mach thread scheduler doesn't get broken. When an application is idle, it is blocked waiting for a message from the kernel. This puts its thread on a wait queue and it shouldn't get run again until the resource it is waiting on (a Mach port) is tickled.

I essentially need to write a UNIX daemon and would rather do it in Cocoa since it has to have some minimal UI, but it will be running all the time.

This won't work if you want your code to run while no one is logged in or if you want your code to start as part of the system startup. Instead, you should split your code into a proper daemon and a GUI app to manage the daemon.

Bonus question: Does the amount wasted change if I have a window with controls in it open?

It can. If you have a progress view, a default button (so the Aqua UI code is throbbing it) or any other control that wants to draw itself. As long as none of your controls are updating, then, no, there is no additional CPU time expense.

-tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >idle waste (From: Paul Cezanne <email@hidden>)

  • Prev by Date: Re: idle waste
  • Next by Date: Bug in g++'s int constructor?
  • Previous by thread: Re: idle waste
  • Next by thread: Keyboard events in an NSTextEntry
  • Index(es):
    • Date
    • Thread