SlideShare a Scribd company logo
MULTICORE JS 🚀
PAST, PRESENT AND FUTURE
UJJWAL SHARMA (@RYZOKUKEN)
JSCONF INDIA 2021 🇮🇳
@ryzokuken
ABOUT ME 👦
@ryzokuken
@ryzokuken
Ujjwal "Ryzokuken" Sharma
Compilers Hacker at Igalia
TC39 Delegate
ECMA-402 Editor
Node.js Core Collaborator
V8 Contributor
International Speaker
@ryzokuken
@ryzokuken
ABOUT IGALIA 💼
Software Consultancy
HQ in Galicia, Spain 🇪🇸
Free Software
TC39, W3C
Web Browsers 🌐
Compilers
Web Standards 📚
@ryzokuken
IGALIA 💖BLOOMBERG 💖GOOGLE
@ryzokuken
WHY MULTICORE JS? 👨‍💻
JavaScript was designed in 1995 (26 years ago)
CPU hardware is scaling with multi-core, big/little rather than frequency
The client side is moving to the Web
JS and WASM are taking over servers too!
e.g., Fastly's and CloudFlare's models
Important to expose hardware capabilities to software
@ryzokuken
WHY DO I CARE? 😳
Your users use a mobile phone
You run JS or WASM on a server
You build computationally heavy web applications
You want to utilize full hardware capabilties.
@ryzokuken
OLD NEWS ⏳
High-level async constructs (allows work in the background)
Workers (and SharedWorkers, ServiceWorker, AudioWorklet, etc)
postMessage
MessageChannel
async/await
WebAssembly MVP
@ryzokuken
FAILED ATTEMPTS 😿
ParallelJS
SIMD.js
@ryzokuken
RECENT WINS 🏆
Atomics and SAB
WeakRef
WASM Threading
WASM SIMD
@ryzokuken
ARE STANDARDS A GOOD PLACE TO GET STUFF DONE? 😅
Project Fugu shows that multi-implementer standards aren't the only way to
ship
However, the JS and Wasm world does operate on a lockstep model
Many big efforts have successfully been developed in standards bodies and
then shipped broadly
@ryzokuken
ARE STANDARDS A GOOD PLACE TO GET STUFF DONE? 😅
Important to have a coherent whole for JS and Wasm
JS/Wasm engine teams have historically been more conservative about
implementing non-standard things than higher levels of Chromium
When this path was not taken, it is seen as a mistake, e.g., PJS and
strong mode
@ryzokuken
CONCURRENT JS 🐎
A VISION FOR THE FUTURE OF JAVASCRIPT
@ryzokuken
A TALE OF TWO CONCURRENCY MODELS ♻
@ryzokuken
WEB-LIKE 🕸
Run-to-completion (Workers)
Message-passing (postMessage)
Async APIs (Promises)
No data races, data isolation
@ryzokuken
THREAD-LIKE 🧵
Sync APIs, manual synchronization (Atomics)
Data races, shared memory (SABs)
@ryzokuken
WEB-LIKE 🕸
@ryzokuken
THREAD-LIKE 🧵
@ryzokuken
@ryzokuken
REALITY
@ryzokuken
@ryzokuken
WEB-LIKE 🕸
GOODS
BADS
Ease of reasoning + using
Causal
Data race free by construction
Isolation
Asynchronous = smoother
Less focused on manual synchronization mechanics (locks, queues, etc)
Leaving performance on the table
@ryzokuken
THREAD-LIKE 🧵
GOODS
BADS
WebAssembly interop
WasmGC interop
Good performance
Hard to reason & use
Manual synchronization
Data races
Acausal astonishments
"Must be this tall"
Exposes more timing channels
@ryzokuken
LET'S IMPROVE BOTH MODELS SIMULTANEOUSLY! 😇
@ryzokuken
ROADMAP 🛣🗺
@ryzokuken
PHASE 1
WEB-LIKE
THREAD-LIKE
Language support for asynchronous communication
Ability to spawn units of computation
Shared memory
Basic synchronization primitive
Ability to spawn threads
@ryzokuken
PHASE 1
Actually, we're done here! ✅
Promises
async/await
Workers
SharedArrayBuffer
Atomics
@ryzokuken
PHASE 2
WEB-LIKE
THREAD-LIKE
Ergonomic and performant data transfer
Ergonomic and performant code transfer
Higher level objects that allow concurrent access
Higher level synchronization mechanisms
@ryzokuken
PHASE 2 🕸
Designed to address biggest observed pain points
Transferring data is expensive:
Transferrables very limited
Weird reparenting of [[Prototype]] even when transferred
Often copied
Transferring data is unergonomic:
Often requires serialization/deserialization
Identity discontinuity
Transferring code is basically not possible, we transfer strings
@ryzokuken
PROPOSAL: MODULE BLOCKS
Aims to solve: Ergonomic sharing of code
Spearheaded by Surma
let moduleBlock = module {
export let y = 1;
};
let moduleExports = await import(moduleBlock);
assert(moduleExports.y === 1);
assert(await import(moduleBlock) === moduleExports);
@ryzokuken
UPCOMING PROPOSAL: SHARED DISJOINT HEAPS
Aims to solve: Ergonomic and performant sharing of data and code
Let developers separate their heap
Agent-local heaps can point into shareable heaps
Shareable heaps cannot point into agent-local heaps
Unit of sharing is transferable heap
@ryzokuken
PHASE 2 🧵
Also designed to address biggest observed pain points
Nobody knows how to use SABs and Atomics well
Impedance mismatch too high
@ryzokuken
PROPOSAL: STRUCTS
Aims to solve: Higher-level objects that allow concurrent access
Spearheaded by Shu-yu Guo
struct class Box {
constructor(x) { this.x = x; }
x;
}
let box = new Box();
box.x = 42; // x is declared
assertThrows(() => { box.y = 8.8; }); // structs are
sealed
assertThrows(() => { box.__proto__ = {} }); // structs are
sealed
@ryzokuken
FUTURE PHASE
WEB-LIKE
THREAD-LIKE
Lighter-weight actors?
Integration with scheduling APIs
Concurrent std lib?
Tooling?
Integration with WasmGC
Concurrent std lib?
@ryzokuken
SPECIAL THANKS 🙇
Daniel Ehrenberg
Shu-yu Guo
The organizers and programme committee
@ryzokuken
THANK YOU! 🙏
@ryzokuken

More Related Content

PPTX
B4UConference_Sexy Angular Stack
PPT
Dev381.Pp
PDF
Migrate to Microservices Judiciously!
PDF
Practical WebAssembly with Apex, wasmRS, and nanobus
PDF
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
PDF
Oracle code bogota-Handle the Complexity of Migrate to Microservices from Mon...
PPTX
Enterprise Integration Patterns and Apache Camel
PDF
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
B4UConference_Sexy Angular Stack
Dev381.Pp
Migrate to Microservices Judiciously!
Practical WebAssembly with Apex, wasmRS, and nanobus
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
Oracle code bogota-Handle the Complexity of Migrate to Microservices from Mon...
Enterprise Integration Patterns and Apache Camel
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB

Similar to Multicore Javascript Past, Present and Future.pdf (20)

PDF
Containerizing couchbase with microservice architecture on mesosphere.pptx
PDF
Overview of QP Frameworks and QM Modeling Tools (Notes)
PDF
ParaForming - Patterns and Refactoring for Parallel Programming
PDF
Oracle Code Javaday Sao Paulo Monolith_to Microservices
PDF
2018 MONOLITICH TO MICROSERVICES - Conferencia Javeros colombia
PPTX
Technology Stack Discussion
PDF
Java in the Age of Containers and Serverless
PDF
Daniel Steigerwald - Este.js - konec velkého Schizma
PDF
Sexy React Stack
PDF
BISSA: Empowering Web gadget Communication with Tuple Spaces
PDF
Java in the age of containers - JUG Frankfurt/M
PDF
WebSocket Perspectives and Vision for the Future
PDF
OrientDB the database for the web 1.1
PDF
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
PDF
SOA & WebLogic - Lift & Shift to the Cloud
PDF
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
PDF
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
PDF
#JavadayEcuador Monolith to Microservices
PDF
Scala Days Highlights | BoldRadius
PDF
GraphQL for Native Apps
Containerizing couchbase with microservice architecture on mesosphere.pptx
Overview of QP Frameworks and QM Modeling Tools (Notes)
ParaForming - Patterns and Refactoring for Parallel Programming
Oracle Code Javaday Sao Paulo Monolith_to Microservices
2018 MONOLITICH TO MICROSERVICES - Conferencia Javeros colombia
Technology Stack Discussion
Java in the Age of Containers and Serverless
Daniel Steigerwald - Este.js - konec velkého Schizma
Sexy React Stack
BISSA: Empowering Web gadget Communication with Tuple Spaces
Java in the age of containers - JUG Frankfurt/M
WebSocket Perspectives and Vision for the Future
OrientDB the database for the web 1.1
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
SOA & WebLogic - Lift & Shift to the Cloud
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
#JavadayEcuador Monolith to Microservices
Scala Days Highlights | BoldRadius
GraphQL for Native Apps
Ad

More from Igalia (20)

PDF
Life of a Kernel Bug Fix
PDF
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
PDF
Advancing WebDriver BiDi support in WebKit
PDF
Jumping Over the Garden Wall - WPE WebKit on Android
PDF
Collective Funding, Governance and Prioritiation of Browser Engine Projects
PDF
Don't let your motivation go, save time with kworkflow
PDF
Solving the world’s (localization) problems
PDF
The Whippet Embeddable Garbage Collection Library
PDF
Nobody asks "How is JavaScript?"
PDF
Getting more juice out from your Raspberry Pi GPU
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
PDF
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
PDF
CSS :has() Unlimited Power
PDF
Device-Generated Commands in Vulkan
PDF
Current state of Lavapipe: Mesa's software renderer for Vulkan
PDF
Vulkan Video is Open: Application showcase
PDF
Scheme on WebAssembly: It is happening!
PDF
EBC - A new backend compiler for etnaviv
PDF
RISC-V LLVM State of the Union
PDF
Device-Generated Commands in Vulkan
Life of a Kernel Bug Fix
Unlocking the Full Potential of WPE to Build a Successful Embedded Product
Advancing WebDriver BiDi support in WebKit
Jumping Over the Garden Wall - WPE WebKit on Android
Collective Funding, Governance and Prioritiation of Browser Engine Projects
Don't let your motivation go, save time with kworkflow
Solving the world’s (localization) problems
The Whippet Embeddable Garbage Collection Library
Nobody asks "How is JavaScript?"
Getting more juice out from your Raspberry Pi GPU
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
Demystifying Temporal: A Deep Dive into JavaScript New Temporal API
CSS :has() Unlimited Power
Device-Generated Commands in Vulkan
Current state of Lavapipe: Mesa's software renderer for Vulkan
Vulkan Video is Open: Application showcase
Scheme on WebAssembly: It is happening!
EBC - A new backend compiler for etnaviv
RISC-V LLVM State of the Union
Device-Generated Commands in Vulkan
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Reach Out and Touch Someone: Haptics and Empathic Computing
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
Building Integrated photovoltaic BIPV_UPV.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MIND Revenue Release Quarter 2 2025 Press Release

Multicore Javascript Past, Present and Future.pdf

  • 1. MULTICORE JS 🚀 PAST, PRESENT AND FUTURE UJJWAL SHARMA (@RYZOKUKEN) JSCONF INDIA 2021 🇮🇳 @ryzokuken
  • 4. Ujjwal "Ryzokuken" Sharma Compilers Hacker at Igalia TC39 Delegate ECMA-402 Editor Node.js Core Collaborator V8 Contributor International Speaker @ryzokuken
  • 6. ABOUT IGALIA 💼 Software Consultancy HQ in Galicia, Spain 🇪🇸 Free Software TC39, W3C Web Browsers 🌐 Compilers Web Standards 📚 @ryzokuken
  • 8. WHY MULTICORE JS? 👨‍💻 JavaScript was designed in 1995 (26 years ago) CPU hardware is scaling with multi-core, big/little rather than frequency The client side is moving to the Web JS and WASM are taking over servers too! e.g., Fastly's and CloudFlare's models Important to expose hardware capabilities to software @ryzokuken
  • 9. WHY DO I CARE? 😳 Your users use a mobile phone You run JS or WASM on a server You build computationally heavy web applications You want to utilize full hardware capabilties. @ryzokuken
  • 10. OLD NEWS ⏳ High-level async constructs (allows work in the background) Workers (and SharedWorkers, ServiceWorker, AudioWorklet, etc) postMessage MessageChannel async/await WebAssembly MVP @ryzokuken
  • 12. RECENT WINS 🏆 Atomics and SAB WeakRef WASM Threading WASM SIMD @ryzokuken
  • 13. ARE STANDARDS A GOOD PLACE TO GET STUFF DONE? 😅 Project Fugu shows that multi-implementer standards aren't the only way to ship However, the JS and Wasm world does operate on a lockstep model Many big efforts have successfully been developed in standards bodies and then shipped broadly @ryzokuken
  • 14. ARE STANDARDS A GOOD PLACE TO GET STUFF DONE? 😅 Important to have a coherent whole for JS and Wasm JS/Wasm engine teams have historically been more conservative about implementing non-standard things than higher levels of Chromium When this path was not taken, it is seen as a mistake, e.g., PJS and strong mode @ryzokuken
  • 15. CONCURRENT JS 🐎 A VISION FOR THE FUTURE OF JAVASCRIPT @ryzokuken
  • 16. A TALE OF TWO CONCURRENCY MODELS ♻ @ryzokuken
  • 17. WEB-LIKE 🕸 Run-to-completion (Workers) Message-passing (postMessage) Async APIs (Promises) No data races, data isolation @ryzokuken
  • 18. THREAD-LIKE 🧵 Sync APIs, manual synchronization (Atomics) Data races, shared memory (SABs) @ryzokuken
  • 24. WEB-LIKE 🕸 GOODS BADS Ease of reasoning + using Causal Data race free by construction Isolation Asynchronous = smoother Less focused on manual synchronization mechanics (locks, queues, etc) Leaving performance on the table @ryzokuken
  • 25. THREAD-LIKE 🧵 GOODS BADS WebAssembly interop WasmGC interop Good performance Hard to reason & use Manual synchronization Data races Acausal astonishments "Must be this tall" Exposes more timing channels @ryzokuken
  • 26. LET'S IMPROVE BOTH MODELS SIMULTANEOUSLY! 😇 @ryzokuken
  • 28. PHASE 1 WEB-LIKE THREAD-LIKE Language support for asynchronous communication Ability to spawn units of computation Shared memory Basic synchronization primitive Ability to spawn threads @ryzokuken
  • 29. PHASE 1 Actually, we're done here! ✅ Promises async/await Workers SharedArrayBuffer Atomics @ryzokuken
  • 30. PHASE 2 WEB-LIKE THREAD-LIKE Ergonomic and performant data transfer Ergonomic and performant code transfer Higher level objects that allow concurrent access Higher level synchronization mechanisms @ryzokuken
  • 31. PHASE 2 🕸 Designed to address biggest observed pain points Transferring data is expensive: Transferrables very limited Weird reparenting of [[Prototype]] even when transferred Often copied Transferring data is unergonomic: Often requires serialization/deserialization Identity discontinuity Transferring code is basically not possible, we transfer strings @ryzokuken
  • 32. PROPOSAL: MODULE BLOCKS Aims to solve: Ergonomic sharing of code Spearheaded by Surma let moduleBlock = module { export let y = 1; }; let moduleExports = await import(moduleBlock); assert(moduleExports.y === 1); assert(await import(moduleBlock) === moduleExports); @ryzokuken
  • 33. UPCOMING PROPOSAL: SHARED DISJOINT HEAPS Aims to solve: Ergonomic and performant sharing of data and code Let developers separate their heap Agent-local heaps can point into shareable heaps Shareable heaps cannot point into agent-local heaps Unit of sharing is transferable heap @ryzokuken
  • 34. PHASE 2 🧵 Also designed to address biggest observed pain points Nobody knows how to use SABs and Atomics well Impedance mismatch too high @ryzokuken
  • 35. PROPOSAL: STRUCTS Aims to solve: Higher-level objects that allow concurrent access Spearheaded by Shu-yu Guo struct class Box { constructor(x) { this.x = x; } x; } let box = new Box(); box.x = 42; // x is declared assertThrows(() => { box.y = 8.8; }); // structs are sealed assertThrows(() => { box.__proto__ = {} }); // structs are sealed @ryzokuken
  • 36. FUTURE PHASE WEB-LIKE THREAD-LIKE Lighter-weight actors? Integration with scheduling APIs Concurrent std lib? Tooling? Integration with WasmGC Concurrent std lib? @ryzokuken
  • 37. SPECIAL THANKS 🙇 Daniel Ehrenberg Shu-yu Guo The organizers and programme committee @ryzokuken