Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » Experiments with a threading library for Zend: spawning a new executor [RSS Feed]

#1 Jan. 18, 2011 04:22:07

Sam V.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Experiments with a threading library for Zend: spawning a new executor


Hi all,

As some of you may be aware, we (OpenParallel) have already successfully
shown that adding access to threading primitives (Intel's GPL TBB
library) can be a performance benefit to WordPress in the context of
PHP/HipHop¹.

We are now experimenting with adding similar functionality to PHP/Zend.
Now, they are really entirely different because one is a compiler and
the other is a virtual machine/interpreter.

So, the first obstacle we must overcome is being able to create working
slave executors. Once this is shown to work, then the executors can be
set to run in their own threads. Then we have the fun job of fixing all
the leaks :-). In the context of ZTS this is essentially:

void* newinterp = tsrm_new_interpreter_context();
tsrm_set_interpreter_context(newinterp);
init_executor(newinterp);

// ... do something with newinterp, eg zend_call_function ...

tsrm_set_interpreter_context(tsrm_ls);

(full code is available athttp://github.com/openparallel/php-src.git)

This is somewhat similar to the work that a SAPI would have to do to
make an executor for use. In fact one of the possible tidy approaches to
implementing threading might be to treat threads as an internal SAPI.

However the call to init_executor() does not seem to completely set up
the executor to a working state, and trying to use it results in
crashes. Using gdb I can track these down, yet they are executor fields
which init_executor() at least tried to set up; I haven't tracked down
what is going on.

What I'm after is:

1) any hints or clues from people familiar with the Zend subsystems -
such as memory management, and the various stacks, to provide hints as
to how to set them up "correctly"

2) interested internals experts for continuing and/or providing ongoing
mentoring assistance (funding may be available for this)

3) pointers to any hardcore internals documentation which may be useful
in training up new internals experts. Right now I'm mostly just reading
source and making educated guesses; the online internals manuals seem
more focused on things like opcodes and nothing relevant to this.

Thanks in advance for any help!

Cheers,
Sam

1 -http://openparallel.wordpress.com/2010/11/01/tbb-in-wordpress-–-white-paper/--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » Experiments with a threading library for Zend: spawning a new executor [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support