I had an idea of Adding Multi-threading functionality to php ( i called it PHPThreader ) in little words the idea was :-
1. make a Js class which Creates Ajax Objects in order to call PHP Scripts(Threads)
2. then make a PHP class Implements and Interfaces the Js Class
3. Implement the PHP Class with your script easily and LAUNCH threads very easy Just Like:-
$obj=new Thread($filename,$Inputs); in other words:-
$e=new Thread("Download.php","url="http://phpbuilder.com");

you will find the Classes & Documentation & Examples at :-
http://sourceforge.net/project/showfiles.php?group_id=203377&package_id=242365&release_id=532251
where

AjT.php : the Js Class which is implemented by the PHP class

Threader.php : PHP Class, which is a front to deal with the Js Class

Bag.php : is also dealing with Js Class to know the status of Thread( a finishing Alarm )

There are Two Examples:-
1. Downloading two files on parallel
2. PDM (Php Download Manager) a simple and primitive download manager in php😃

Please tell me what do u think of the Idea & Implementation .Thanks in advance and critique as u wish

    Well.... 37 reads and no replies this saddy
    Any way i made a second release PHPThreader 1.1

    you can get it Here

    i added Inter Thread Communication & Synchronization between threads
    but please reply tell me what do you think
    thanks in advance

      Can you really call this threading when it's really separate processes using files to communicate? You might want to use shared memory to make this communication faster.

        Well.... Many thanks to your interest

        You might want to use shared memory to make this communication faster.

        this is true for large sizes but when the size is small(100/200 Bytes) there is bearly no difference in speed
        but you didn't tell me if you benefited or not from the class ?do you think it's an add or it makes live somehow easier?
        please you all tell me . Thanks in advance

          It sounds to me like you've just made a convenient AJAX class which could be quite advantageous for use in Javascript development. I have not used your class, but for a given page, I don't see how this provides any functional improvement over standard AJAX except that it's easy to use.

          Does your code or your documentation provide any functionality to multiplex access to global resources like variables/alerts/etc? This is one of the problems I'm wrestling with as I move into multithreading.

            Does your code or your documentation provide any functionality to multiplex access to global resources

            Yes and the Synchronization of access too
            the idea is very simple and depends on what you can call properties or varaibles
            let's assume that we have a thread $t1 and another one $t2 then they can tslk as follows :-

            $t1->CSet("name","sneakyimp");

            then $t2 can access this very simply as

            $name=$t2->CGet("name");

            and there is a simple Mutex Sync. as $t2 can't read while $t1 is writting
            that's how it works
            and again i'd like to hear from you all (Esp. in applications point)
            Thanks in advance

              a year later

              Hello everybody 😃
              it's been around 9 months since the last update to class and finally i got time to it
              PHPThreader 1.6 Released
              you can get it from sf here : http://sourceforge.net/project/showfiles.php?group_id=203377&package_id=242365&release_id=617030

              or from phpclasses here : http://www.phpclasses.org/browse/package/4082.html

              The new version has the following features :-
              1)Full Online Documentation of class here : http://ajphpth.sourceforge.net [An offline version is provided in sf]
              2)new Communication Class : Shared Memory (shmop required )
              3)new Thread Calling Class : CliThread (using shell calls)
              4)new Abstract Mutex Class which can be used from user defined Communication Clases .
              5)new automatic System of thread watching
              6) a simple loader to overcome path issues

              7)new methods like Join()

              hope to hear from you about it
              Thanks

                Write a Reply...