jonsamwell Posted January 18, 2009 Share Posted January 18, 2009 Hi Is it possible to multi thread in php? Basically i have a huge amount of data that would be suite to splitting up into 3/4 threads to increase the speed, the information wouldn't have to be protected (thread safe) so not too difficult. Can php do this? Regards, Jon Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 Not really sure, but perhaps pcntl_fork Quote Link to comment Share on other sites More sharing options...
jonsamwell Posted January 18, 2009 Author Share Posted January 18, 2009 Not really sure, but perhaps pcntl_fork Does it run at the same time as the parent process or just time slices with the parent or stops the parent process altogether? Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted January 18, 2009 Share Posted January 18, 2009 From the manual page linked too.... Please see your system's fork(2) man page for specific details as to how fork works on your system. Also, are you planning on running these processes via a server or the command line interface? Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted January 18, 2009 Share Posted January 18, 2009 Does it run at the same time as the parent process or just time slices with the parent or stops the parent process altogether? That all depends on your server. If your running on a multi-core processor, or a mult-processor server, then the threads can run simultaneously, but it's the operating system that determines whether they do so or not. Quote Link to comment Share on other sites More sharing options...
btherl Posted January 19, 2009 Share Posted January 19, 2009 As for in-process threads (like posix threads) rather than processes, I'm pretty sure php doesn't support them. We may be able to give some more detailed help if you give us your php version, OS and architecture (eg php 5.2.3 on Windows XP SP2 with Intel E2180). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.