isolated-threads - NodeJS real threads with shared memory

  •        1

Since the different thread is executed in an isolated instance of v8, you will not be able to use Buffer or require and you will not have access to any kind of event loop functions, like setTimeout or setInterval. When you are passing data between isolates, the data is serialized and copied between threads (read more here). If you with to copy a large amount of data, you should use Typed Arrays (like UInt8Array or Float64Array) with a SharedArrayBuffer backend (if available). In the above example we allocate a w * h * c sized shared buffer, and then use it as a backend for Uint8Array. We do all data manipulation using the uint8 array and then return back the shared one. Upon receiving the shared array from the thread, we reinterpret it into a uint8 array and extract our data.

https://github.com/legraphista/isolated-threads#readme

Dependencies:

isolated-vm : ^1.6.1
ws : ^5.2.1

Tags
Implementation
License
Platform

   




Related Projects

Smart Thread Pool

  •    DotNet

Smart Thread Pool is a thread pool written in C#. It is far more advanced than the .NET built-in thread pool. Here is a list of the thread pool features: * The number of threads dynamically changes according to the workload on the threads in the pool. * Work items can...

worker-threads-pool - Easily manage a pool of Node.js Worker Threads

  •    Javascript

Easily manage a pool of Node.js Worker Threads. Number of active workers in the pool.

Volley-demo - An demonstration of Volley - HTTP library announced by google in I/O 2013

  •    Java

An demonstration of Volley - HTTP library announced by google in I/O 2013. Android has provided two HTTP Clients AndroidHttpClient (Extended from apache HTTPClient) and HttpUrlConnection to make a HTTP Request. Both has its own pros and cons. When an application is developed, we write HTTP connection classes which handles all the HTTP requests, creating THREADS to run in background, managing THREAD pool, response parsing, response caching, handling error codes, SSL connections, running requests in parallel and others stuffs around that. Every developer has his own way of implementing these functionalities.Some might use AsycnTask for running network operations in background, or some might use passing handlers created from UI thread to HTTP connection classes which then executes network operation in worker thread and uses the handler to pass back the parsed HTTP response back to the main thread.

learnrxjava - A set of exercises to designed to teach developers Rx (Reactive Streams)

  •    Java

A sequential program runs on a flat timeline. Each task is only started after the previous one completes. In concurrent programs, multiple tasks may be running during the same time period and a new task may begin at any time. In threaded programs, introducing concurrency trades space for time. Allocating memory for more threads allows application servers to make network requests concurrently instead of sequentially. Threaded network requests can dramatically reduce server response times, but like all trade-offs this approach has its limits. Unchecked thread creation can cause a server to run out of memory or to spend too much time to context switching. Thread pools can help manage these problems, but under heavy load the number of threads in an application server’s pool will eventually be exhausted. When this happens network requests will be serialized, causing response times to rise. At this point the only way to bring down response times again is to scale up more servers, which increases costs.


thread-pool-cpp - High performance C++11 thread pool

  •    C++

Example run: Post job to thread pool is much faster than for boost::asio based thread pool. See benchmark/benchmark.cpp for benchmark code.

Java Thread Pooling Framework

  •    

A Java framework for building flexible thread pool where threads can be allocated and recycled.

threads.js - Easy to use, yet powerful multi-threading library for node.js and the browser.

  •    Javascript

Javascript thread library. Uses web workers when run in browsers and child processes when run by node.js. Also supports browsers which do not support web workers.You don't have to write the thread's code inline. The file is expected to be a commonjs module (so something that uses module.exports = ...), for node and browser.

threadpool - A simple C Thread pool implementation

  •    C

A simple C Thread pool implementation

Odyssey - Scalable PostgreSQL connection pooler

  •    C

Advanced multi-threaded PostgreSQL connection pooler and request router. Odyssey can significantly scale processing performance by specifying a number of additional worker threads. Each worker thread is responsible for authentication and proxying client-to-server and server-to-client requests. All worker threads are sharing global server connection pools. Multi-threaded design plays important role in SSL/TLS performance.

Threading.Net : Multi threads, threadpool, backgroundworker windows form sample

  •    

Threading.Net, is a small windows form application that highlights the benefits of multithreaded programming by comparing in parallel, using progessbars, the same process running in single thread and in multi thread mode.

microjob - A tiny wrapper for turning Node

  •    TypeScript

A tiny wrapper for turning Node.js threads in easy-to-use routines for CPU-bound. Microjob is a tiny wrapper for Node.js threads and is intended to perform heavy CPU loads using anonymous functions. So, Microjob treats Node.js threads as temporary working units: if you need to spawn a long-living thread, then you should use the default API.

ThreadPool - A simple C++11 Thread Pool implementation

  •    C++

A simple C++11 Thread Pool implementation.

nedmalloc - An EXTREMELY FAST portable thread caching malloc implementation written in C for multiple threads without lock contention based on dlmalloc

  •    C

An EXTREMELY FAST portable thread caching malloc implementation written in C for multiple threads without lock contention based on dlmalloc. Optimised for x86 and x64. Compatible with C++. Can patch itself into existing binaries on Windows.

Solaris-compatible Thread Library (STL)

  •    C

The Solaris-compatible Thread Library (STL) enables applications that use the Solaris threads API (thr_create(), mutex_lock(), etc.) to be ported to other systems that have a POSIX threads library. STL maps between Solaris types and POSIX types, and adds

cprops - c prototyping tools

  •    C

the c prototyping tools library provides thread-safe linked list, priority queue, hash table, hash list, AVL tree and trie implementations, as well as a thread pool and thread management framework, a tcp and http socket api, and a dbms abstraction layer.

puma - A Ruby/Rack web server built for concurrency

  •    Ruby

Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications in development and production. Under the hood, Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request in a thread from an internal thread pool. Since each request is served in a separate thread, truly concurrent Ruby implementations (JRuby, Rubinius) will use all available CPU cores.

Do Work in Background Thread to Keep GUI Responsive

  •    DotNet

Demonstrate simple example of using BackgroundWorker class to do work on a background thread and then update the GUI in a thread-safe manner.

PINRemoteImage - A thread safe, performant, feature rich image fetcher

  •    Objective-C

PINRemoteImageManager is an image downloading, processing and caching manager. It uses the concept of download and processing tasks to ensure that even if multiple calls to download or process an image are made, it only occurs one time (unless an item is no longer in the cache). PINRemoteImageManager is backed by GCD and safe to access from multiple threads simultaneously. It ensures that images are decoded off the main thread so that animation performance isn't affected. None of its exposed methods allow for synchronous access. However, it is optimized to call completions on the calling thread if an item is in its memory cache. PINRemoteImage supports downloading many types of files. It, of course, supports both PNGs and JPGs. It also supports decoding WebP images if Google's library is available. It even supports GIFs via returning FLAnimatedImages if it's compiled in (though this can be disabled).