Op werkdagen voor 23:00 besteld, morgen in huis Gratis verzending vanaf €20
,

Multithreaded JavaScript

Concurrency Beyond the Event Loop

Paperback Engels 2021 9781098104436
Verkooppositie 3390Hoogste positie: 3390
Verwachte levertijd ongeveer 8 werkdagen

Samenvatting

Traditionally, JavaScript has been a single-threaded language. Nearly all online forum posts, books, online documentation, and libraries refer to the language as single threaded. Thanks to recent advancements in the language-such as the Atomics and SharedArrayBuffers objects and Web Workers in the browser-JavaScript is now a multi-threaded language. These features will go down as being the biggest paradigm shift for the world's most popular programming language.

Multithreaded JavaScript explores the various features that JavaScript runtimes have at their disposal for implementing multithreaded programming, providing both practical real-world examples, as well as reference material.

- Learn what multithreaded programming is and how you can benefit from it
- Understand the differences between a web worker, a service worker, and a worker thread
- Know when and when not to use threads in an application
- Orchestrate communication between threads by leveraging the Atomics object
- Build high-performance applications using the knowledge you gain from this book
- Benchmark performance to learn if you'll benefit from multithreading

Specificaties

ISBN13:9781098104436
Taal:Engels
Bindwijze:paperback
Aantal pagina's:200
Uitgever:O'Reilly
Druk:1
Verschijningsdatum:5-10-2021
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Geef uw waardering

Zeer goed Goed Voldoende Matig Slecht

Over Thomas Hunter

Thomas Hunter II previously worked as a Developer Advocate and API Architect for Barracuda Networks’ Copy.com, a large file-sharing and storage service, where his main concern was getting a well-documented API into the hands of third-party developers. Part of his duties involved building an OAuth 1.0a provider from scratch using PHP, a fate he wouldn’t wish on his worst of enemies. Currently Thomas spends his days at OpenTable where he maintains microservices, builds new ones as needed, and generates cURL requests for other teams to debug their services. His nights are occasionally spent giving talks at meetups and conferences.

Andere boeken door Thomas Hunter

Inhoudsopgave

Foreword
Preface
Target Audience
Goals
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments

1. Introduction
What Are Threads?
Concurrency Versus Parallelism
Single-Threaded JavaScript
Hidden Threads
Threads in C: Get Rich with Happycoin
With Only the Main Thread
With Four Worker Threads

2. Browsers
Dedicated Workers
Dedicated Worker Hello World
Advanced Dedicated Worker Usage
Shared Workers
Shared Worker Hello World
Advanced Shared Worker Usage
Service Workers
Service Worker Hello World
Advanced Service Worker Concepts
Message Passing Abstractions
The RPC Pattern
The Command Dispatcher Pattern
Putting It All Together

3. Node.js
Before We Had Threads
The worker_threads Module
workerData
MessagePort
Happycoin: Revisited
With Only the Main Thread
With Four Worker Threads
Worker Pools with Piscina
A Pool Full of Happycoins

4. Shared Memory
Intro to Shared Memory
Shared Memory in the Browser
Shared Memory in Node.js
SharedArrayBuffer and TypedArrays
Atomic Methods for Data Manipulation
Atomics.add()
Atomics.and()
Atomics.compareExchange()
Atomics.exchange()
Atomics.isLockFree()
Atomics.load()
Atomics.or()
Atomics.store()
Atomics.sub()
Atomics.xor()
Atomicity Concerns
Data Serialization
Booleans
Strings
Objects

5. Advanced Shared Memory
Atomic Methods for Coordination
Atomics.wait()
Atomics.notify()
Atomics.waitAsync()
Timing and Nondeterminism
Example of Nondeterminism
Detecting Thread Preparedness
Example Application: Conway’s Game of Life
Single-Threaded Game of Life
Multithreaded Game of Life
Atomics and Events

6. Multithreaded Patterns
Thread Pool
Pool Size
Dispatch Strategies
Example Implementation
Mutex: A Basic Lock
Streaming Data with Ring Buffers
Actor Model
Pattern Nuances
Relating to JavaScript
Example Implementation

7. WebAssembly
Your First WebAssembly
Atomic Operations in WebAssembly
Compiling C Programs to WebAssembly with Emscripten
Other WebAssembly Compilers
AssemblyScript
Happycoin in AssemblyScript

8. Analysis
When Not to Use
Low Memory Constraints
Low Core Count
Containers Versus Threads
When to Use
Summary of Caveats

A. Structured Clone Algorithm

Index

Managementboek Top 100

Rubrieken

Populaire producten

    Personen

      Trefwoorden

        Multithreaded JavaScript