└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # State of the Art of Parallel Javascript 2 | 3 | Javascript is defined as a single-threaded programming and execution model, but 4 | several independent designs and implementations for parallel Javascript exist 5 | covering a spectrum of capabilities. 6 | This list aims to capture the state of the art for parallel Javascript 7 | and enabling technologies like shared-memory. 8 | 9 | This is a work in progress, additions and corrections are welcome. 10 | Please feel free to submit a PR to this list or send an update to *mogill@synsem.com*. 11 | 12 | 13 | ## Classification System 14 | 15 | This list separates parallelism and synchronization into separate concerns 16 | to capture implementations ranging from shared memory with no source of 17 | parallelism to shared-nothing multiprocessing. 18 | 19 | - __Types of Parallelism__: How processes/threads are created and managed 20 | - __Fork-Join__ - New threads/processes are created explicitly 21 | - __Bulk Synchronous Parallel__ - A fixed number of processes 22 | are started when the program is executed, all entering the program at `main()`. 23 | - __Loop Level__ - Iterations of loops are distributed to multiple processes/threads 24 | - __Asynchronous__ - Non-blocking function calls or continuation passing 25 | - __None__ - No form of parallelism is provided by the platform 26 | - __Types of Synchronization__: Categories of how processes enforce order of operations: 27 | - __Messaging__ - Active Messages/Remote Procedure Calls cause a function 28 | to execute using the message payload at the destination 29 | - __Atomic Read-Modify-Write__ - Fetch-And-Phi memory operations that atomically 30 | load from memory, perform an arithmetic or comparison operation, store the result back to memory, 31 | and return the original value stored in memory 32 | - __Barrier__ - Wait for a known number of processes to arrive before 33 | any proceeds. Frequently used with Bulk Synchronous Parallelism 34 | - __Mutex__ - Mutual exclusion locks and semaphores 35 | - __None__ - No synchronization is provided 36 | - __Shared Memory__: Directly sharing memory between processes/threads 37 | - __Sharing Model__: What is shared between threads/processes 38 | - __Shared Everything__ - All heap variables are shared unless explicitly made thread-private 39 | - __Explicit Sharing__ - Declaration of shared variables requires different syntax than private data 40 | - __Shared Nothing__ - No shared memory capabilities 41 | - __Coherency__: Whether or not all processes see the most recent copy of data 42 | - __Atomicity__: Whether or not other processes can see a partially completed memory operation 43 | 44 | 45 | 46 | ## What is Considered "Parallel Javascript" and "Shared Memory" 47 | Because parallelism is not part of the base language, parallel JS might mean 48 | anything from two mutually dependent Node.js programs communicating via sockets, 49 | to transpiling a downloaded module before evaluating it, 50 | to loop-level parallelism with mutex locks. 51 | 52 | Accessing _shared memory_ differs from accessing shared remote caches, object stores, or databases 53 | in that it is too fast to merit being made asynchronous. Specifically, 54 | the overhead for scheduling a callback is greater than the 55 | amount of time needed to perform the work. Shared memory 56 | also introduces the potential hazards when one process modifies the value 57 | of a variable used by another thread. 58 | 59 | Javascript projects do not use the terms *multithreaded* or *shared memory* consistently, 60 | projects that describe themselves with those terms but might better be described 61 | as *asynchronous* (i.e.: the `async` Node.js package) and/or *message passing* 62 | (i.e.: Node's built-in `cluster`) are not listed. 63 | 64 | Shared memory can be implemented separately from a parallel programming model, 65 | indeed the de-facto standard, Shared Array Buffers, exists solely to support parallel 66 | programming but does not itself implement any parallelism, that is provided 67 | by WebWorkers. Parallel memory models 68 | with no parallel execution model are included in this list because they are 69 | complementary to other forms of parallelism. 70 | 71 | 72 | 73 | ## Concurrency vs. Parallelism 74 | 75 | This document uses the terms *concurrent* and *parallel* according the definitions given 76 | by the Go language: 77 | 78 | > Concurrency is about dealing with lots of things at once. 79 | > Parallelism is about doing lots of things at once. 80 | >

81 | > -GoBlog [Concurrency is Not Parallelism](https://blog.golang.org/concurrency-is-not-parallelism) 82 | 83 | 84 | ## List of Parallel and Shared-Memory Javascript Projects 85 | 86 | | Project Web Site | Parallelism Model(s) | Shared Memory Model | Unique Features | Intended Uses | Usage Examples | Set # Procs | First Release | Latest Release | Active | Platform | 87 | |---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------|:-----------:|:-------------:|:--------------:|:------:|:-----------:| 88 | | [AliOS ](https://github.com/alibaba/AliOS-nodejs/wiki/Workers-in-Node.js-based-on-multithreaded-V8) | Fork-Join | N/A | Proposal only, no implementation yet, work in progress | Asynchronous processing | N/A | ? | N/A | N/A | Yes | V8 | 89 | | [Concurrent Javascript ](https://webkit.org/blog/7846/concurrent-javascript-it-can-work/) | Fork-Join | Shared everything, atomic Read-Modify-Write operations | C-like shared everything memory proposal, no implementation yet, work in progress | ? | N/A | ? | N/A | N/A | Yes | WebKit | 90 | | [Extended Memory Semantics (EMS.js)](https://github.com/SyntheticSemantics/ems) | Loop decomposition, Fork-Join, Bulk Synchronous Parallel | Atomic Read-Modify-Write operations on persistent objects in shared memory | Allows any number or kind of processes and devices to share objects. Hardware accelerators supported. | High Performance Computing, ad-hoc analytics on unstructured data. | Parallel web server, word counting, transaction processing | Yes | 2013 | 2017 | Yes | V8 | 91 | | [Fibers ](https://github.com/laverdet/node-fibers) | Fork-Join, Futures | N/A | Implements asynchronous functionality used by other asynchronous libraries | Asynchronous processing | Fibonacci | N/A | 2011 | 2017 | Yes | V8 | 92 | | [isolated-vm ](https://github.com/laverdet/isolated-vm) | Fork-Join | Limited sharing within an isolate, Shared arrays | Exposes v8 runtime API to JS, isolates created in JS run on separate threads | Sandboxed execution of user functions in an application | Quicksort | Yes | 2017 | 2018 | Yes | V8 | 93 | | [JXcore ](https://github.com/jxcore/jxcore) | Fork-Join | N/A | Supported multiple engines (V8, Spider Monkey, Chakra), multi-threading, shared objects | ? | Fibonacci, messaging | Yes | 2014 | 2016 | No | V8, SM, Chk | 94 | | [mmap-object ](https://github.com/allenluce/mmap-object ) | N/A | Serially accessed shared object memory | Native C++ implementation based on Boost | ? | N/A | N/A | 2017 | 2017 | Yes | V8 | 95 | | [Napa.js ](https://github.com/Microsoft/napajs) | Fork-Join | Non-coherent shared objects | Microsoft implemented for V8 | "...highly iterative services with non-compromised performance in Bing..." | Fibonacci, Pi, Max square sub-matrix | Yes | 2017 | 2017 | Yes | V8 | 96 | | [Nexus.js ](https://github.com/voodooattack/nexusjs) | Asynchronous I/O | N/A | Makes possible promise-based multi-threading for WebKit | Node.js-like asynchronous I/O for implementing web servers | Web server | No | 2016 | 2017 | Yes | JSC | 97 | | [node-multithread ](https://github.com/losfair/node-multithread) | Fork-Join | Non-coherent shared objects | Map-reduce oriented | ? | N/A | No | 2017 | 2017 | No | V8 | 98 | | [node-shared-cache ](https://github.com/kyriosli/node-shared-cache) | N/A | Limited atomicity on shared objects | BSON for internal storage Key-value store | N/A | N/A | N/A | 2015 | 2016 | No | V8 | 99 | | [node-worker-farm ](https://github.com/rvagg/node-worker-farm) | Fork-Join | N/A | Basic F-J running in a pool of separate Node.js processes | Asynchronous processing | Pi | Yes (poolsz)| 2013 | 2017 | Yes | Node.js | 100 | | [Parallel.js ](https://github.com/parallel-js/parallel.js) | Map-Reduce | N/A | Web-worker based | Map-reduce | N/A | No | 2014 | 2016 | No | V8 | 101 | | [promise-worker ](https://github.com/nolanlawson/promise-worker) | Fork-Join | N/A | Implements promises as workers | Asynchronous processing | N/A | N/A | 2017 | 2017 | Yes | V8 | 102 | | [RiverTrail ](https://github.com/IntelLabs/RiverTrail) | SIMD, loop-level | Shared arrays and global variables via closures(?) | Browser plug-in, OpenCL support, explicitly SIMD with implicit loop-level parallelism | Array & image processing, other OpenCL amenable algorithms | Image processing, OpenCL acceleration of JS | ? | 2011 | 2017 | No | SM | 103 | | [Shared Array Buffers ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics) | N/A | Atomic Read-Modify-Write operations on a shared integer array | De-facto standard supported by major JS implementations, C-like semantics | Target for Emscripten | N/A | N/A | 2016 | 2017 | Yes | V8, SM | 104 | | [WebWorkers ](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) | Fork-Join | Messaging, shared array buffers | De-facto standard supported in major browsers | Streaming media | N/A | Implicit | 2010 | 2017 | Yes | Chrome, FF | 105 | | [Worker ](https://github.com/nodejs/worker/) | Fork-Join | Atomic Read-Modify-Write operations on a shared integer array | Native to Node | Asynchronous processing | N/A | Implicit | 2018 | 2018 | Yes | Node | 106 | | [Workerpool ](https://github.com/josdejong/workerpool) | Fork-Join | N/A | Small implementation | Asynchronous processing | Background worker | N/A | 2014 | 2017 | Yes | V8 | 107 | 108 | 109 | - **Project Web Site** - Name of and link to the project 110 | - **Parallelism Model** - Type(s) of parallelism the project exposes to applications 111 | - **Shared Memory Model** - Coherency and communication of shared data 112 | - **Unique Features** - Notable differentiators 113 | - **Intended Uses** - Target application(s) of the project 114 | - **Examples** - Examples provided by implementation 115 | - **Set # Procs** - Does the API allow the program to specify the number of parallel processes 116 | - **First Release** - Date of initial public release 117 | - **Latest Release** - Date of most recent release 118 | - **Active** - Does the project have ongoing development in the past 6 months 119 | - **Engines** - Supported Javascript engines 120 | --------------------------------------------------------------------------------