Книги и журналы » Компьютерная литература » Программирование (книги)
Multithreaded JavaScriptГод издания: 2022
Автор: Hunter Th II, English B.
Издательство: O’Reilly
ISBN: 978-1-098-10443-6
Язык: Английский
Формат: PDF/DjVu
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Да
Количество страниц: 214
Описание: The nature of javascript is to be single threaded. This is reflected not only in libraries and applications, but also in online forum posts, books, and online documentation. Thanks to recent advancements in the platform—such as with web workers in the browser, worker_threads in Node.js, and the Atomics and SharedArrayBuffer objects - javascript engineers are able to build multi-threaded applications. 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, using a spectrum of API reference material and high level programming patterns.
In this book, Bryan and Thomas expertly lay out the foundations of multithreaded development in general, and deftly illustrate how the various javascript runtimes like web browsers and Node.js enable parallel computing with a programming language that includes no built-in mechanisms to enable it. Because the responsibility for providing multithreading support has fallen on the runtimes, and because there are so many differences between those runtimes, browsers and platforms like Node.js implement multithreading in different ways. Although they share similar APIs, a worker thread in Node.js is really not the same thing as a web worker in a web browser. Support for shared workers, web workers, and service workers is nearly universal across browsers, and worker threads have been in Node.js for several years now, but they are all still a relatively new concept for javascript developers. No matter where your javascript runs, this book will provide important insight and information. Most importantly, however, the authors take the time to explain exactly why you should care at all about multithreading in your javascript applications.
- Learn what multithreaded programming is and how you can benefit from it
- Understand the differences between a dedicated worker, a shared worker, and a service worker
- Identify when and when not to use threads in an application
- Orchestrate communication between threads by leveraging the Atomics object
- Understand both the gains and pitfalls of using shared memory
- Benchmark performance to learn when you'll benefit from multiple threads
[spoiler="Примеры страниц"]

[/spoiler]
[spoiler="Оглавление"]
Foreword ix
Preface xi
1. Introduction 1
2. Browsers 19
3. Node.js 53
4. Shared Memory 73
5. Advanced Shared Memory 97
6. Multithreaded Patterns 121
7. WebAssembly 155
8. Analysis 169
Appendix. Structured Clone Algorithm 183
Index 187
[/spoiler]