note 47844 added to control-structures.declare

From: Date: Thu, 02 Dec 2004 13:44:44 +0000
Subject: note 47844 added to control-structures.declare
Groups: php.notes 
Request: Send a blank email to php-notes+get-81274@lists.php.net to get a copy of this message
i want to make a short not that many think multi-tasking is not working as expected, but actualy this is expected. multi-tasking / multi-treading does not run paralel as many think. its actualy a constant switching between 2 or more treads. this has to do with the fact there is only 1 cpu. and 1 cpu can only execute one command at the time. every os works this way, linux, windows, even mac. the only thing here is that os are written in C++ and PHP first has to be translated into C++ calls before executed. thats why PHP will never be as fast as C++ code and thus you will note the switching as a delay. thinking it does not run paralel but at this very moment your os is switching between diffrent treads with about 1 million switches every seconds where php may only achief 40.000 a second. so when designing some multi-tasking system you must expect a system that constantly switches form task about every 20 tick for example. this will give the idea that the system is executing multiple thinks at the same time while actualy switching between them every 20 ticks. hope this clears things up for some people trying to design a multi-treaded / multi-tasking system just as me. most important: keep the switching code to a minimum. this is executed as wel between every switching treads. ---- Manual Page -- http://www.php.net/manual/en/control-structures.declare.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47844 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47844&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47844&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81274) next »