Buy tickets for the next conference JavaScript fwdays’24 conference!

Web Locks API in Node.js and browser

Talk video

Talk presentation

Race condition and deadlocks in asynchronous programming is not something strange but most of developers are not thinking about it and expects a miracle using promises and async/await. Parallel programming have well-known techniques and theory for concurrent computing and state management with different data structures to make them thread-safe. All those primitives like semaphore, mutex, spin-lock, monitors, barriers are usable for asynchronous programming as well but we may simplify them and combine with promises and sync/await to fulfill a concept of resource locking in single-threaded runtime.

While we are getting closer to real parallel programming with multi-threading in JavaScript we have Web locks API as a single and simple abstraction for all needs. It is already available in browsers and can be simply ported to node.js with a hope to reuse it for multi-threading as well with known limitations.

Timur Shemsedinov
Metarhia, Kiev Polytechnic Institute
  • Researcher, lecturer, open-source enthusiast, 25 years in IT
  • 3rd place in Ukraine by Github followers
  • CTO at Salucyber, Chief architect at Metarhia
  • Free video lectures > 200
  • Metarhia community organizer, speaker at >40 conferences
  • Expert in building distributed enterprise applications, systems architecture, cybernetics, system programming, DBMS, production automation, telemetry, network servers and protocols, system analysis
  • Twitter
Sign in
Or by mail
Sign in
Or by mail
Register with email
Register with email
Forgot password?