Re: Re: how do you get to do multiple mysql queries concurrently?
| From: | Per Jessen | Date: | Mon, 28 Jan 2008 20:52:46 +0000 |
| Subject: | Re: Re: how do you get to do multiple mysql queries concurrently? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268231@lists.php.net to get a copy of this message | ||
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