Re: detecting when an app is beach-balling
Re: detecting when an app is beach-balling
- Subject: Re: detecting when an app is beach-balling
- From: Erik Buck <email@hidden>
- Date: Mon, 22 Oct 2007 19:47:39 -0700 (PDT)
Unlike many embedded systems, all Mac OS X threads are
preemptively scheduled. That effectively means that
no thread can monopolize the CPU. All threads are
periodically suspended/preempted so that other threads
can run. Watch dog timers are generally not involved.
There are standard Unix real-time extensions:
Functions like rtprio() enable you to set the relative
priority of threads or processes so that they will be
preempted less or more.
There are also POSIX processor sets (pset_create())
that enable you to specify which threads can run on
which processors in multi-processor systems. If you
disable interrupts on a processor and set up a system
so that the only thread that can run on the particular
processor (or core) is your thread, your thread will
not be preempted. That is the only way to solve hard
real time problems on a Unix system.
The halting problem is irrelevant to these issues.
I believe the Mac OS X window server periodically
sends events to the event queue of all applications
that have a connection to the window server. If an
application does not remove the event from its queue,
the window server changes the cursor to the beach ball
automatically. The only thing the beach ball means is
that an application is not taking events out of its
queue fast enough.
Again, the halting problem is irrelevant to these
issues. It is true that an application that is in an
infinite loop will beach ball, but a perfectly healthy
application that isn't taking events out of it's queue
will also beach ball.
>From an application's perspective, the Unix select()
function is presumably called from the run loop and
used to block the calling thread unless at least one
input source (included in the select() call) has
pending input. The window server's event queue is
just one input source for select(). Timers,
distributed messages, apple events, distributed
notifications, and any file descriptors you add are
included in the select().
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden