-
August 11th, 2011, 09:06 PM
#1
PHP multi-threading
I'm afraid that this might be a pretty noobie question,
but I've been reading around the web that PHP doesn't really support multi-threading.
Does that mean that if multiple users visit my website, and that makes many PHP scripts run that try to vie for the same resource/files, could there be deadlock and other related issues? Or is that different? Are there precautions I'm supposed to take?
-
August 12th, 2011, 06:27 PM
#2
Re: PHP multi-threading
It's a scripting language and therefore not a low-level language. Reading files will not be an issue at all. If you're writing to databases, there will be a queue which will process as resources free. If you're writing to the same file, then it will change to whomever edits first. So, you will need to put writing in your own locks.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
August 21st, 2011, 01:57 AM
#3
Re: PHP multi-threading
Multi-threading is not possible in PHP.
However, it can be simulated as you suggest. I uncovered this article on it. But personally if you require multithreading, I'd say you are using the wrong software stack and maybe you need something a bit more powerful and suited to this kind of thing.
If its just updates or background activity/checks etc, you could run it via a cron task. Without knowing more about the problem you are wishing to solve, its hard to make valid suggestions.
Overseas consultants in India
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|