473,225 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

PHP and Multi-thread

Hi All,

I can not find any information if PHP support multi-thread (Posix
thread) or not at all, can someone give out some information? Is it
supported? If yes, where's the info? If no, is it possible to make
doing multi-thread stuff?

Thanks.

YF
Jul 17 '05 #1
4 14540
OutsiderJustice wrote:
I can not find any information if PHP support multi-thread (Posix
thread) or not at all, can someone give out some information? Is it
supported? If yes, where's the info? If no, is it possible to make
doing multi-thread stuff?


You can do it, but don't try doing it when it's a script on a webserver.
Check out the following links (the 1st one is the PHP manual; the 2nd one
is a link on my website about how to do just this):

http://www.php.net/pcntl
http://www.electrictoolbox.com/artic...ocess-forking/

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #2
Chris Hope <bl*******@electrictoolbox.com> wrote in message news:<7x******************@news.xtra.co.nz>...
OutsiderJustice wrote:
I can not find any information if PHP support multi-thread (Posix
thread) or not at all, can someone give out some information? Is it
supported? If yes, where's the info? If no, is it possible to make
doing multi-thread stuff?


You can do it, but don't try doing it when it's a script on a webserver.
Check out the following links (the 1st one is the PHP manual; the 2nd one
is a link on my website about how to do just this):

http://www.php.net/pcntl
http://www.electrictoolbox.com/artic...ocess-forking/

Chris


Unfortunately there are so many problems with it:

- it is not really multi-thread, it's multi-process, it's expensive to
duplicate all resources in the child process
- it is only available on UNIX system; even so, if one forgot to do
'--enable-pcntl' when compiling PHP, one has to compile it again,
which can be a hassle.

I'm not a Windows guy, but I believe Windows also has it's own process
control APIs, so I'm kind of wondering why this is not implemented on
Windows version.

Is there anything may be useful to achieve multi-thread performance on
Windows system?

Yufeng
Jul 17 '05 #3
OutsiderJustice wrote:
Unfortunately there are so many problems with it:

- it is not really multi-thread, it's multi-process, it's expensive to
duplicate all resources in the child process
- it is only available on UNIX system; even so, if one forgot to do
'--enable-pcntl' when compiling PHP, one has to compile it again,
which can be a hassle.

I'm not a Windows guy, but I believe Windows also has it's own process
control APIs, so I'm kind of wondering why this is not implemented on
Windows version.

Is there anything may be useful to achieve multi-thread performance on
Windows system?


Yeah you're right it's not multi-threading proper, which I have done in .NET
with both VB and C#. As far as I have been able to determine there is no
way to do this in PHP other than using process forking. If someone else is
able to help out here I'd be interested to, although I'm coming from a Unix
platform not a Windows one.

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #4
"OutsiderJustice" <ou*************@yahoo.com> wrote in message
news:61**************************@posting.google.c om...
Chris Hope <bl*******@electrictoolbox.com> wrote in message news:<7x******************@news.xtra.co.nz>... I'm not a Windows guy, but I believe Windows also has it's own process
control APIs, so I'm kind of wondering why this is not implemented on
Windows version.

Is there anything may be useful to achieve multi-thread performance on
Windows system?


Take a look at the Win32 extension. In theory you can build a wrapper around
the W32 API. In practice though, it will probably be very unstable--if it
works at all.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.