Richard Lynch wrote: > On Sat, January 26, 2008 3:32 am, Per Jessen wrote: >> In a threaded environment you often have e.g. semaphores and mutexes >> to coordinate access to shared data. When you've forked a process, >> you share data over IPC or similar. When you create a new thread, it >> has access to global scope variables in the main tread. It has >> access to shared heap storage. None of this applies to a forked >> process. > > That all depends on which implementation of threading you are using... Very true. What I described is posix threading in linux as well as the general idea of threading found in MVS/zOS. > And, ultimately, if the program wasn't written correctly to handle > being forked/threaded it's gonna crash... Also true. But that's like saying an incorrectly written for-loop will crash :-) > Whether it's two "threads" or two "processes" trying to utilize the > same resource as it they had exclusive access when they don't, you end > up in the same position... True again. However, I was commenting on your assertion that "Process forking has EVERYTHING to do with thread safety", which I will stay is wrong. When you fork another process, you don't need to worry about whether your code is thread-safe or not. You don't have to be reentrant, you could even use self-modifying code if you felt the urge. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php