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 Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/ Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 Not really sure, but perhaps pcntl_fork Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/#findComment-740014 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 Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/#findComment-740023 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? Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/#findComment-740028 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. Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/#findComment-740073 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). Link to comment https://forums.phpfreaks.com/topic/141378-multi-threading/#findComment-740141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.