Re: Multi-threading
| From: | Alexey Zakhlestin | Date: | Thu, 21 Feb 2008 11:53:39 +0000 |
| Subject: | Re: Multi-threading | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35683@lists.php.net to get a copy of this message | ||
On 2/21/08, Nathan Rixham <nrixham@gmail.com> wrote:
> hope you don't mind me asking for a bit more info, I was always under
> the impressions that a thread is defined as (quote wiki)
>
> "Threads are a way for a program to fork (or split) itself into two or
> more simultaneously (or pseudo-simultaneously) running tasks. Threads
> and processes differ from one operating system to another but, in
> general, a thread is contained inside a process and different threads of
> the same process share some resources while different processes do not."
>
> and php supports pcntl_fork along with signal handlers and interprocess
> communication via functions like or stream_socket_pair.
>
> as such if I set up a cli app with parent and child processes
> (?threads), then isn't this multithreading in php?
>
> I know this strictly isn't the place for such questions, but I hope you
> won't mind enlightening me a little on the matter.
it is not multithreading.
multithreading means that a process starts several "threads" which
work simulatenously and share local resources (such as variables,
dynamically created functions/classes, database connections, etc.)
pcntl_fork creates several processes, which can communicate, but still
has their own sets of local resources
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/