Multi-threading/Forking VS Ajax or a combination

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Multi-threading/Forking VS Ajax or a combination

Post by jaoudestudios »

If a web page has 6 ajax calls, is that effectly like multi-threading/forking in php? or can both be combined for even greater benefit?
Attilitus
Forum Commoner
Posts: 27
Joined: Wed Aug 08, 2007 2:32 pm

Re: Multi-threading/Forking VS Ajax or a combination

Post by Attilitus »

I doubt you would get much benefit from trying to give PHP multi-threading capabilities. Is there something specific in your script that you think would benefit from multithreading?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Multi-threading/Forking VS Ajax or a combination

Post by requinix »

Multi-threading and AJAX may seem similar but they're very different ideas.

Multiple threads is like having 10 grocery cashiers ringing up your items. AJAX is like sending 10 different people to each buy a different fraction of your shopping list.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Multi-threading/Forking VS Ajax or a combination

Post by s.dot »

Personally I wouldn't bother with trying to achieve a multi-threading effect in PHP. It just can't be done... effectively/proficiently.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Multi-threading/Forking VS Ajax or a combination

Post by jaoudestudios »

Thanks for your feed back guys!
tasairis wrote:Multi-threading and AJAX may seem similar but they're very different ideas.

Multiple threads is like having 10 grocery cashiers ringing up your items. AJAX is like sending 10 different people to each buy a different fraction of your shopping list.
I like this analogy. I appreciate they are different but the result is similar ish, right?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Multi-threading/Forking VS Ajax or a combination

Post by requinix »

Multiple threads are more about efficiency (splitting one task into many smaller tasks); AJAX is more about nicer interfaces (not needing a page refresh to do something).
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Multi-threading/Forking VS Ajax or a combination

Post by jaoudestudios »

tasairis wrote:Multiple threads are more about efficiency (splitting one task into many smaller tasks); AJAX is more about nicer interfaces (not needing a page refresh to do something).
Yes, but if I have 10 parts of the page going off at the same time to do ajax, then surely that is similar to multi-threading?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Multi-threading/Forking VS Ajax or a combination

Post by requinix »

But not in PHP. You could say the JavaScript is multitasking (some people will get antsy if you say "multi-threading", even if that's what's really going on behind the scenes) but PHP (as far as you're concerned) is not.
Post Reply