<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.fileprocess.process.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'book.parallel.php',
    1 => 'parallel',
    2 => 'parallel',
  ),
  'up' => 
  array (
    0 => 'refs.fileprocess.process.php',
    1 => 'Erweiterungen zur Prozesskontrolle',
  ),
  'prev' => 
  array (
    0 => 'function.system.php',
    1 => 'system',
  ),
  'next' => 
  array (
    0 => 'parallel.setup.php',
    1 => 'Installation',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/parallel/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.parallel.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.parallel" class="book">
 
 <h1 class="title">parallel</h1>
 

 <div id="intro.parallel" class="preface">
  <h1 class="title">Einführung</h1>
  <p class="simpara">
  parallel is a parallel concurrency extension for PHP ≥ 7.2.0.
  As of parallel 1.2.0, PHP ≥ 8.0.0 is required.
  </p>
  <p class="simpara">
   A brief description of the concepts core to parallel follows, more detailed information may be found within this section of the manual.
  </p>
  <div class="simplesect">
   <h3 class="title">Runtime</h3>
   <p class="simpara">
     A <span class="classname"><a href="class.parallel-runtime.php" class="classname">parallel\Runtime</a></span> represents a PHP interpreter thread. A <span class="classname"><a href="class.parallel-runtime.php" class="classname">parallel\Runtime</a></span> is configured with an optional bootstrap file passed to <span class="methodname"><a href="parallel-runtime.construct.php" class="methodname">parallel\Runtime::__construct()</a></span>, this is typically an autoloader,
    or some other preloading routine: The bootstrap file will be included before any task is executed.
   </p>
   <p class="simpara">
    After construction the <span class="classname"><a href="class.parallel-runtime.php" class="classname">parallel\Runtime</a></span> remains available until it is closed, killed, or destroyed by the normal scoping rules of PHP objects.
    <span class="methodname"><a href="parallel-runtime.run.php" class="methodname">parallel\Runtime::run()</a></span> allows the programmer to schedule tasks for execution in parallel.
    A <span class="classname"><a href="class.parallel-runtime.php" class="classname">parallel\Runtime</a></span> has a FIFO schedule, tasks will be executed in the order that they are scheduled.
   </p>
  </div>
  <div class="simplesect">
   <h3 class="title">Functional API</h3>
   <p class="simpara">
    parallel implements a functional, higher level API on top of <span class="classname"><a href="class.parallel-runtime.php" class="classname">parallel\Runtime</a></span> that provides a single function entry point to executing parallel code
    with automatic scheduling: <span class="function"><a href="parallel.run.php" class="function">parallel\run()</a></span>.
   </p>
  </div>
  <div class="simplesect">
   <h3 class="title">Task</h3>
   <p class="para">
    A task is simply a <span class="classname"><a href="class.closure.php" class="classname">Closure</a></span> intended for parallel execution. The <span class="classname"><a href="class.closure.php" class="classname">Closure</a></span> may contain almost any instruction, including nested closures.
    However, there are some instructions that are prohibited in tasks:
    <ul class="itemizedlist">
     <li class="listitem">
     <span class="simpara">yield</span>
     </li>
     <li class="listitem">
     <span class="simpara">use by-reference</span>
     </li>
     <li class="listitem">
     <span class="simpara">declare class</span>
     </li>
     <li class="listitem">
     <span class="simpara">declare named function</span>
     </li>
    </ul>
   </p>
   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <span class="simpara">
     Nested closures may yield or use by-reference, but must not contain class or named function declarations.
    </span>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <span class="simpara">
     No instructions are prohibited in the files which the task may include.
    </span>
   </p></blockquote>
  </div>
  <div class="simplesect">
   <h3 class="title">Future</h3>
   <p class="simpara">
    The <span class="classname"><a href="class.parallel-future.php" class="classname">parallel\Future</a></span> is used to access the return value from the task, and exposes an API for cancellation of the task.
   </p>
  </div>
  <div class="simplesect">
   <h3 class="title">Channel</h3>
   <p class="simpara">
    A task may be scheduled with arguments, use lexical scope variables (by-value), and return a value (via a <span class="classname"><a href="class.parallel-future.php" class="classname">parallel\Future</a></span>), but these only allow uni-directional communication:
    They allow the programmer to send data into and retrieve data from a task, but do not allow bi-directional communication between tasks.
    The <span class="classname"><a href="class.parallel-channel.php" class="classname">parallel\Channel</a></span> API allows bi-directional communication between tasks, a <span class="classname"><a href="class.parallel-channel.php" class="classname">parallel\Channel</a></span> is a socket-like link between tasks that the programmer can use to send and receive data.
   </p>
  </div>
  <div class="simplesect">
   <h3 class="title">Events</h3>
   <p class="simpara">
    The <span class="classname"><a href="class.parallel-events.php" class="classname">parallel\Events</a></span> API implements a native feel (<span class="classname"><a href="class.traversable.php" class="classname">Traversable</a></span>) event loop, and <span class="methodname"><a href="parallel-events.poll.php" class="methodname">parallel\Events::poll()</a></span> method.
    It allows the programmer to work with sets of channels and or futures.
    The programmer simply adds channels and futures to the event loop, optionally setting the input for writes with <span class="methodname"><a href="parallel-events.setinput.php" class="methodname">parallel\Events::setInput()</a></span>,
    and enters into a foreach: parallel will read from and write to objects as they become available yielding <span class="classname"><a href="class.parallel-events-event.php" class="classname">parallel\Events\Event</a></span> objects
    describing the operations that have occurred.
   </p>
  </div>
   <div class="simplesect">
   <h3 class="title">Siehe auch</h3>
   <ul class="simplelist">
    <li><a href="philosophy.parallel.php" class="xref">Philosophy</a></li>
   </ul>
  </div>
 </div>

 




 




 




 




 




 




 




 




 




 







 




 

<ul class="chunklist chunklist_book"><li><a href="parallel.setup.php">Installation</a></li><li><a href="philosophy.parallel.php">Philosophy</a></li><li><a href="functional.parallel.php">Functional API</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel.bootstrap.php">parallel\bootstrap</a> — Bootstrapping</li><li><a href="parallel.run.php">parallel\run</a> — Execution</li></ul></li><li><a href="class.parallel-runtime.php">parallel\Runtime</a> — The parallel\Runtime class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-runtime.construct.php">parallel\Runtime::__construct</a> — Runtime Construction</li><li><a href="parallel-runtime.run.php">parallel\Runtime::run</a> — Execution</li><li><a href="parallel-runtime.close.php">parallel\Runtime::close</a> — Runtime Graceful Join</li><li><a href="parallel-runtime.kill.php">parallel\Runtime::kill</a> — Runtime Join</li></ul></li><li><a href="class.parallel-future.php">parallel\Future</a> — The parallel\Future class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-future.cancel.php">parallel\Future::cancel</a> — Cancellation</li><li><a href="parallel-future.cancelled.php">parallel\Future::cancelled</a> — State Detection</li><li><a href="parallel-future.done.php">parallel\Future::done</a> — State Detection</li><li><a href="parallel-future.value.php">parallel\Future::value</a> — Resolution</li></ul></li><li><a href="class.parallel-channel.php">parallel\Channel</a> — The parallel\Channel class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-channel.construct.php">parallel\Channel::__construct</a> — Channel Construction</li><li><a href="parallel-channel.make.php">parallel\Channel::make</a> — Access</li><li><a href="parallel-channel.open.php">parallel\Channel::open</a> — Access</li><li><a href="parallel-channel.recv.php">parallel\Channel::recv</a> — Sharing</li><li><a href="parallel-channel.send.php">parallel\Channel::send</a> — Sharing</li><li><a href="parallel-channel.close.php">parallel\Channel::close</a> — Closing</li></ul></li><li><a href="class.parallel-events.php">parallel\Events</a> — The parallel\Events class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-events.setblocking.php">parallel\Events::setBlocking</a> — Behaviour</li><li><a href="parallel-events.settimeout.php">parallel\Events::setTimeout</a> — Behaviour</li><li><a href="parallel-events.setinput.php">parallel\Events::setInput</a> — Input</li><li><a href="parallel-events.addchannel.php">parallel\Events::addChannel</a> — Targets</li><li><a href="parallel-events.addfuture.php">parallel\Events::addFuture</a> — Targets</li><li><a href="parallel-events.remove.php">parallel\Events::remove</a> — Targets</li><li><a href="parallel-events.poll.php">parallel\Events::poll</a> — Polling</li></ul></li><li><a href="class.parallel-events-input.php">parallel\Events\Input</a> — The parallel\Events\Input class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-events-input.add.php">parallel\Events\Input::add</a> — Inputs</li><li><a href="parallel-events-input.clear.php">parallel\Events\Input::clear</a> — Inputs</li><li><a href="parallel-events-input.remove.php">parallel\Events\Input::remove</a> — Inputs</li></ul></li><li><a href="class.parallel-events-event.php">parallel\Events\Event</a> — The parallel\Events\Event class</li><li><a href="class.parallel-events-event-type.php">parallel\Events\Event\Type</a> — The parallel\Events\Event\Type class</li><li><a href="class.parallel-sync.php">parallel\Sync</a> — The parallel\Sync class<ul class="chunklist chunklist_book chunklist_children"><li><a href="parallel-sync.construct.php">parallel\Sync::__construct</a> — Construction</li><li><a href="parallel-sync.get.php">parallel\Sync::get</a> — Access</li><li><a href="parallel-sync.set.php">parallel\Sync::set</a> — Access</li><li><a href="parallel-sync.wait.php">parallel\Sync::wait</a> — Synchronization</li><li><a href="parallel-sync.notify.php">parallel\Sync::notify</a> — Synchronization</li><li><a href="parallel-sync.invoke.php">parallel\Sync::__invoke</a> — Synchronization</li></ul></li></ul></div><?php manual_footer($setup); ?>