php-general Digest 31 Oct 2012 16:27:54 - Issue 8027
Topics (messages 319624 through 319637):
Multithreading for OOP PHP
319624 by: Florian Müller
319626 by: marco.behnke.biz
319627 by: Ovidiu Farauanu
319628 by: Ovidiu Farauanu
319629 by: Florian
Hi guys
I was wondering, what actually the reason is that PHP itself does not support
multi-threading?
I guess this would be realizable, or not? If not, why?
Maybe this is a stupid question, but still somehow interesting. Realization in
a way as Java does (or just something in that way) would
Johannes Reichardt johannes.reicha...@googlemail.com hat am 30. Oktober 2012
um 16:37 geschrieben:
In times of testability and several design patters, the use of static calls
is
really outdated.
I understand that you can read and write the invocations of the methods much
faster, but
Florian Müller florian-muel...@outlook.com hat am 31. Oktober 2012 um 07:58
geschrieben:
Hi guys
I was wondering, what actually the reason is that PHP itself does not support
multi-threading?
I guess this would be realizable, or not? If not, why?
Maybe this is a stupid question, but still
Hello Florian,
Usually you want to run a PHP script in two different environments:
1. inside a webserver
2. in a command line interface
For a web application, the application server does the work for you.
It is the server job to have a thread pool and balance it correctly.
So you don't need
Yes Marco has right.
But more than that, OOP is mainly designed to run in a single threaded
environment and it is not the best idea to be used for concurrent
programming because you will need synchronization everywhere and this slows
down the code, but also ask for a lot of other troubles.
I
I actually tought about just the same structures as Java uses(something in this
way:
Thread t = new Thread(new Runnable() {public void run() {...blabla
}}
I thought this would actually be a good benefit if PHP supported this. It's
just as we sometimes use PHP for doing some big
Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59
geschrieben:
Hello Florian,
Usually you want to run a PHP script in two different environments:
1. inside a webserver
2. in a command line interface
For a web application, the application server does the work for
Ovidiu Farauanu ovidiugabr...@gmail.com hat am 31. Oktober 2012 um 09:59
geschrieben:
Yes Marco has right.
But more than that, OOP is mainly designed to run in a single threaded
. I don't put a comment on that.
environment and it is not the best idea to be used for concurrent
Il Wed, 31 Oct 2012 11:57:11 +0100, ma...@behnke.biz ha scritto:
But it if PHP would be threadsafe, you would be able to run the Apache
in a much faster and less memory using way.
There once was a configure option in PHP to compile it threadsafe, but
they dropped it for a reason.
Because PHP
Il Wed, 31 Oct 2012 11:50:00 +0100, ma...@behnke.biz ha scritto:
The drawback of forking is the memory overhead. With every fork you take
the same amount of memory which is not the case if you could use real
threads.
No, it is not.
Forking in Linux uses COW (copy-on-write), so a
Hey guys (and/or gals),
I have heard this question entirely too many times, I think at some point
Rasmus just stopped responding to it. The real reason that PHP is not
threaded has nothing to do with PHP internal or extension thread safety,
the reason is more to the extent that it doesn't make
On Wed, Oct 31, 2012 at 6:46 AM, Alex Nikitin niks...@gmail.com wrote:
Hey guys (and/or gals),
I have heard this question entirely too many times, I think at some point
Rasmus just stopped responding to it. The real reason that PHP is not
threaded has nothing to do with PHP internal or
That's all understood but there are times when that one request from
the visitor requires many sub-requests like connection to DB and
making SOAP calls.
I would say it's more than just there are times, that's how a typical
script lives, it imports libraries, queries the database, and talks
On Tue, Oct 30, 2012 at 7:33 AM, ma...@behnke.biz ma...@behnke.biz wrote:
In times of testability and several design patters, the use of static
calls is
really outdated.
I understand that you can read and write the invocations of the methods
much
faster, but you should think more to the
On 10/31/12 1:58 AM, Florian Müller wrote:
Hi guys
I was wondering, what actually the reason is that PHP itself does not support
multi-threading?
I guess this would be realizable, or not? If not, why?
Maybe this is a stupid question, but still somehow interesting. Realization in
a way as Java
On Wed, Oct 31, 2012 at 11:37 AM, Florian Müller
florian-muel...@outlook.com wrote:
I actually tought about just the same structures as Java uses(something in
this way:
Thread t = new Thread(new Runnable() {public void run() {
...blabla }}
I thought this would actually be a
On Wed, Oct 31, 2012 at 9:27 AM, Alex Nikitin niks...@gmail.com wrote:
That's all understood but there are times when that one request from
the visitor requires many sub-requests like connection to DB and
making SOAP calls.
I would say it's more than just there are times, that's how a
Consider the following code:
?php
class bob
{
static function factory()
{
echo 'In factory!br';
}
}
bob::factory();
$var = 'bob';
$var::factory();
?
When I run this, In Factory! is displayed twice, as I would expect.
So by all accounts, there's nothing wrong with the code.
Am 31.10.12 18:13, schrieb Adam Richardson:
On Tue, Oct 30, 2012 at 7:33 AM, ma...@behnke.biz ma...@behnke.biz wrote:
In times of testability and several design patters, the use of static
calls is
really outdated.
I understand that you can read and write the invocations of the methods
much
Am 31.10.12 18:13, schrieb Adam Richardson:
While OOP is one way to approach programming, it's not the only way. Even
Rasmus has said he leans procedurally:
http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html
Found another interesting discussion on that topic:
It's just as we sometimes use PHP for doing some big Server works (e.g.
database copying or something) and
it would be nice to controll by yourself which Thread (or process) does which
part of the job.
I don't suppose that the client is sitting there waiting for a reply
until the browser
You do all that in the context of a single PHP instance and linear code,
calling curl_multi handles its own threading, you just get back results,
you dont have to store it anywhere outside PHP memory space, and you can
configure timeouts and all that stuff, or you can regulate it yourself. The
On Wed, Oct 31, 2012 at 4:46 PM, Marco Behnke ma...@behnke.biz wrote:
1. If you have code using static methods and members and use phpunit for
testing it, you have to either make sure, that everything is properly
resetted after use OR have to run phpunit in a mode where every test is run
in
On Wed, Oct 31, 2012 at 3:42 PM, Christoph Boget
christoph.bo...@gmail.com wrote:
Consider the following code:
?php
class bob
{
static function factory()
{
echo 'In factory!br';
}
}
bob::factory();
$var = 'bob';
$var::factory();
?
When I run this, In Factory! is
25 matches
Mail list logo