Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1161 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11239 invoked from network); 2 May 2003 11:13:08 -0000 Received: from unknown (HELO secure.thebrainroom.com) (213.239.42.171) by pb1.pair.com with SMTP; 2 May 2003 11:13:08 -0000 Received: from zaneeb.brainnet.i (brain.dial.nildram.co.uk [195.149.29.154]) by secure.thebrainroom.com (8.9.3/8.9.3) with ESMTP id MAA23120; Fri, 2 May 2003 12:13:07 +0100 Received: from zaneeb.brainnet.i (IDENT:MvCnOayNz0Zf0wKym+drMVje1w67m15P@zaneeb.brainnet.i [127.0.0.1]) by zaneeb.brainnet.i (8.11.6/8.11.6) with ESMTP id h42BD8808386; Fri, 2 May 2003 12:13:08 +0100 Date: Fri, 2 May 2003 12:13:08 +0100 (BST) X-X-Sender: wez@zaneeb.brainnet.i To: Ananth Kesari cc: internals@lists.php.net In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] To understand ZTS in PHP. From: wez@thebrainroom.com (Wez Furlong) The PHP/ZE architecture has a very strong thread-affinity; all "global" variables in an instance of the engine are stored in thread-local-storage so that they are: a) safe from modification by other instances of the engine running on different threads (in the same process) b) Reasonably fast to fetch in callbacks made by third-party libraries. You *need* a ZTS build of PHP when the SAPI that is running PHP is multithreaded; eg: when more than one thread is running concurrently. ZTS is not mandatory because passing around the TSRMLS introduces overhead in terms of additional stack usage and some CPU time. Also, TSRMLS_FETCH() (which plucks the engine globals out of the TLS), is quite expensive, even though it is tuned for speed. Based on what you have mentioned in the past about Netware (that it doesn't have processes, only threads), it sounds like ZTS should be used on that platform. However, you're the netware expert, not me :) The decision to use ZTS is usually made by configure based on the SAPI you are compiling for; eg: Apache 1.3.x does not require ZTS (at least on regular UNIX platforms), nor does CGI, whereas threaded servers, such as ISAPI and NSAPI do require it. --Wez. On Fri, 2 May 2003, Ananth Kesari wrote: > Hi, > > We are developing PHP for NetWare. We have a question here. This could > be a trivia, but still asking to understand more. > > In the TSRM module, and other places also, the code contains ZTS (I > guess ZTS stands for Zend Thread Safety. Am I correct?). From what I > understand this is for providing safety to the threads using mutexes. > Correct me if I am wrong. > > We have a couple of questions on this: > 1. What happens if I do not use ZTS? Can we safely use it on > production > servers which get multiple requests? > 2. Is ZTS platform specific? We need to see if we "really" need this to > be enabled on NetWare. > 3. Why is ZTS an option and not mandatory? > > Your inputs on this is highly appreciated. > > Thanks, > Ananth. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > >