TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-03-2009, 03:36 AM   #1 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
zongliang is on a distinguished road
Red face process and thread

hi,
I am novice in PHP, I have gotten a question.
Can we use process or thread in PHP?
Does it get anything with OS?
If we can, which function or class can be used?
thanks a lot!
Your reply will be appreciated.
zongliang is offline  
Reply With Quote
Old 06-03-2009, 10:45 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Sorry, I don't think I understand this question. Could you please elaborate?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-03-2009, 08:18 PM   #3 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

PHP has no native multi-threading support, however we can fork child processes.

http://uk2.php.net/pcntl
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 06-03-2009, 09:26 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I had an inkling that's what he meant, but he mentioned he was a novice. Forking to me is an advanced topic.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-04-2009, 01:43 AM   #5 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Yeah you can really get into a lot of trouble with forking and loops if you're not careful...
allworknoplay is offline  
Reply With Quote
Old 06-04-2009, 03:49 AM   #6 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
zongliang is on a distinguished road
Default

I am sorry.
My question is could we use signal, shared memory...(as used in C) in PHP?
If I was in windows, is the any problem?
zongliang is offline  
Reply With Quote
Old 06-04-2009, 02:20 PM   #7 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by zongliang View Post
I am sorry.
My question is could we use signal, shared memory...(as used in C) in PHP?
If I was in windows, is the any problem?
memory management is all done by PHP on the back end, whether you are using windows, linux etc...

users don't have any control over memory management other than cleraring out variables and objects at the end of scripts...but even that is done automatically....
allworknoplay is offline  
Reply With Quote
Old 06-05-2009, 01:27 AM   #8 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
zongliang is on a distinguished road
Default

Hi Allworknoplay,
thank you for you reply.
you are absolutely right, PHP do not have right to control memory.
Actually, signal, shared memory was used to send message between threads in C.
So my question is that "If I want to use thread in PHP, what function should I use? what will be used to send message between threads in PHP?"
zongliang is offline  
Reply With Quote
Old 06-05-2009, 09:48 AM   #9 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

PHP does have the ability to play around with shared memory which may or may not be useful for you.
Salathe is offline  
Reply With Quote
Old 06-05-2009, 10:15 AM   #10 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
zongliang is on a distinguished road
Default

Thank you, Salathe, it is useful for me.
So if I want to be advanced in PHP, I should use linux instead of windows!
zongliang is offline  
Reply With Quote
Old 06-05-2009, 10:23 AM   #11 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
So if I want to be advanced in PHP, I should use linux instead of windows!
Whilst I agree you should use Linux rather than Redmond, you don't have to use the penguin to be advanced at PHP, it just appears that most advanced topics of PHP need a proper operating system
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 06-05-2009 at 10:54 AM. Reason: engrish
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:42 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design