PHP's Single Thread Behavior and html Frames

45 views
Skip to first unread message

ashore

unread,
Nov 1, 2014, 6:32:45 AM11/1/14
to professi...@googlegroups.com
I'm seeing some weird behavior in a frames-based application, which prompts me to ask the following.

Say I have an application that uses two html frames (Yes, deprecated; I know.)

In frame #1  I'm running a script that does a sleep().  How does that affect the script in frame #2?  Can it run while frame#1 script is sleeping?

(I'm trying to set up a test, but having some difficulty,so ... .)


gedq

unread,
Nov 3, 2014, 5:51:46 AM11/3/14
to professi...@googlegroups.com
You're telling the php parser back on the server to wait n seconds, so all php activity will halt :)

Robert Gonzalez

unread,
Nov 3, 2014, 2:34:22 PM11/3/14
to professional-php
Have you actually tried anything? I just tried this scenario and, as I expected, the requests run independent of each other so a sleep in one script doesn't affect the processing of the other script at all.

--
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to professional-p...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Robert Gonzalez
   

ashore

unread,
Nov 18, 2014, 8:39:19 PM11/18/14
to professi...@googlegroups.com
Robert, agreed.  That's what I wd expect and have seen, I believe.

Now since PHP is single-threaded, when running two parallel php scripts in a single-user context - as in that frames-based html - the 2nd core in a multi-core CPU won't be dispatched.

Is that yr understanding, too?

AS

Marcus Fernandez

unread,
Nov 21, 2014, 10:10:55 AM11/21/14
to professi...@googlegroups.com
You're having problems with session locks. See this http://php.net/manual/en/function.session-write-close.php

Marcus Fernandez

vishal bhandare

unread,
Nov 22, 2014, 9:00:04 AM11/22/14
to Professional PHP Developers
Hi Marcus,

You are correct, if we use session the it will happen.

Regards,
Vishal
--

Reply all
Reply to author
Forward
0 new messages