Re: File IO preventing sleep
Re: File IO preventing sleep
- Subject: Re: File IO preventing sleep
- From: Lisa Zorn <email@hidden>
- Date: Thu, 23 May 2002 00:08:56 -0700
What version of the OS is this? The algorithm has been refined over
the releases, and this sounds like an older behavior. It should be
lower on newer builds, though the exact timing will depend on all the
details and will vary from run to run.
It's OS X.1.4.
There were some utilities floating around a while back that allowed you
to set the timings down to 1 minute to expedite such testing. You
might check the archives...
Thanks; I'll do that. That would be tremendous. (=
This is all part of a complicated dance done to determine the activity
state of individual subsystems -vs- the whole system. So, the disk
will spin down after some period of inactivity. Likewise the screen
dimming is driven by (in)activity in the HID system. System sleep is a
combination of the two, as well as other variables, and so the system
will sleep approximately n minutes after the last disk I/O or HID
activity. The algorithm is a bit more complicated than this, but you
get the idea.
Idle sleep logic is very tricky to get right, because you've got to
balance the user experience of having the system sleep when expected
against preventing sleep when it is unexpected. It is hard to get this
just right by watching block I/Os flow by.
In your case, I'd say do the absolute minimum number of I/Os that you
have to, and avoid doing them repeatedly so that you don't completely
block system sleep. If it causes a slight delay in system sleep, users
will probably not even notice (much). There are plenty of cases where
a simple thing can wedge the system awake: Leaving a browser open to a
webpage that causes periodic disk activity; An email client that checks
for mail once a minute and touches it's local cache every time;
scripting utilities that generate fake mouse events (stretching a
bit). The point is that users will mostly figure these things out
and/or live with them. We are always looking for superior algorithms
for predicting the users future desires, but it is not a perfect
science, and so you sometimes get effects like you are seeing.
I've reduced File IO to an absolute minimum, including my stat() calls,
so given what you're telling me, I'll be satisfied with that.
As an aside, I'm witnessing this "dance" in testing -- if I run enough
applications (and I'm really trying not to run anything that's not
absolutely necessary) -- eventually my baseline tests stop working, and
I have to reboot to get my computer to fall asleep. Since other
applications seem to be similarly interfering with sleep, I'll take that
as an indication that I can be satisfied with mine for now.
Thanks very much again,
-lisa
Glucose Development Corporation --
http://www.glu.com
_______________________________________________
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.