Concurrent JavaScript: It can work (2017)
4 hours ago
- #WebKit
- #JavaScript
- #Concurrency
- SharedArrayBuffer enables concurrent access in JavaScript, allowing for multi-threaded programming.
- A strawman API proposes adding threads, locks, condition variables, and thread-local variables to JavaScript for full concurrency.
- Implementation in WebKit involves segmented butterflies for wait-free operations and transition-thread-locality inference to minimize overhead.
- Performance goals include no regressions for non-concurrent code, linear scalability, and sensible memory model semantics.
- Concurrency interacts with the DOM by restricting access to main-thread-only objects but allowing limited concurrent accesses to global properties.
- The proposed scheme relies on 64-bit systems and aims to keep overhead minimal for most property accesses.