Timeout (max_execution_time) implemented for Windows
| From: | Zeev Suraski | Date: | Fri, 16 Jun 2000 15:21:59 +0000 |
| Subject: | Timeout (max_execution_time) implemented for Windows | ||
| Groups: | php.dev php.windows | ||
| Request: | Send a blank email to php-dev+get-21528@lists.php.net to get a copy of this message | ||
Just a small heads-up - timeouts have been successfully implemented in the
Win32 version of PHP 4.0. The implementation is completely different from
the UNIX implementation, and behaves a bit differently, but it works and
it's quite efficient too (only slightly less efficient than the UNIX
equivalent).
The main difference between the Win32 implementation and the UNIX
implementation is that the UNIX implementation is simpler, and yet it's
more robust, because it relies on an OS-level service, which can
asynchronously interrupt the process when the CPU time exceeds a certain
amount.
With Win32, it's not quite possible to ask the OS to asynchornously
interrupt you when a timeout occurs, let alone know how much CPU time
you've spent (the latter is probably possible using non-standard
methods, because somehow, the task manager works :).
For this reason, the Win32 timeout implementation is partially
synchronous. That is, the timeout will be delivered to the thread that
times out asynchronously; But this message will wait for it until it
reads it.
What does it mean effectively? It means that under Windows, the timeouts
will not be able to interrupt 3rd party library code (e.g., a function
that fetches an SQL recordset, which is coming back very slowly), and it
won't be able to recover from bugs in PHP/Zend (if for some reason they
get stuck in an endless loop, not that this should happen anyway).
Otherwise - the timeout system works quite well.
There's one more inherent difference - the Win32 timeouts use the realtime
clock, as opposed to paying attention to the CPU time the process/thread
has taken. This may mean that a script will perform fine with a given
timeout when there's no load, but will fail when the load is high, because
it'll take it more real time to do the same task (even though it will take
about the same CPU time).
That's all.
Zeev
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/