1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-26 20:34:40 +01:00
Go to file
2015-08-19 10:59:55 -05:00
benchmarks Add benchmark for socket pairs 2015-08-03 00:28:38 -05:00
examples Add locks to thread context 2015-08-18 10:12:06 -05:00
src Inherit all from parent and handle loader in child 2015-08-19 10:59:55 -05:00
tests Add cleanup to tests 2015-08-10 22:35:59 -05:00
.gitattributes Add benchmarks for profiling implementations and backends 2015-07-16 03:02:58 -05:00
.gitignore Add vagrant to gitignore 2015-08-02 19:45:44 -05:00
composer.json Update dependencies 2015-08-18 19:04:12 -05:00
CONTRIBUTING.md Initial commit 2015-07-10 15:15:42 -05:00
LICENSE Initial commit 2015-07-10 15:15:42 -05:00
phpdoc.dist.xml Initial commit 2015-07-10 15:15:42 -05:00
phpunit.xml.dist Merge back into one test suite 2015-08-05 11:29:22 -05:00
README.md Add benchmarks for profiling implementations and backends 2015-07-16 03:02:58 -05:00
Vagrantfile Update provisioning to provide xdebug for code coverage & auto-load extensions 2015-08-05 02:51:04 -05:00

Concurrency Component for Icicle

Under development.

Concurrent provides a means of parallelizing code without littering your application with complicated lock checking and inter-process communication.

Requirements

  • PHP 5.5+
  • pthreads for multithreading or
  • System V-compatible UNIX OS and PHP with --enable-pcntl and --enable-sysvsem

Benchmarks

A few benchmarks are provided for analysis and study. Can be used to back up implementation decisions, or to measure performance on different platforms or hardware.

vendor/bin/athletic -p benchmarks -b vendor/autoload.php

Documentation

Concurrent can use either process forking or true threading to parallelize execution. Threading provides better performance and is compatible with UNIX and Windows but requires ZTS (Zend thread-safe) PHP, while forking has no external dependencies but is only compatible with UNIX systems. If your environment works meets neither of these requirements, this library won't work.

Contexts

Concurrent provides a generic interface for working with parallel tasks called "contexts". All contexts are capable of being executed in parallel from the main program code. Each context is able to safely share data stored in member variables of the context object.

Synchronization

Contexts wouldn't be very useful if they couldn't work on a shared data set. Contexts allow you to share any serializable objects via the properties of a context.

Threading

Threading is a cross-platform concurrency method that is fast and memory efficient. Thread contexts take advantage of an operating system's multi-threading capabilities to run code in parallel.

Forking

For UNIX-like systems, you can create parallel execution using fork contexts. Though not as efficient as multi-threading, in some cases forking can take better advantage of some multi-core processors than threads. Fork contexts use the pcntl_fork() function to create a copy of the current process and run alternate code inside the new process.

License

All documentation and source code is licensed under the Apache License, Version 2.0 (Apache-2.0). See the LICENSE file for details.