• Complain

II Thomas Hunter - Multithreaded JavaScript: Concurrency Beyond the Event Loop

Here you can read online II Thomas Hunter - Multithreaded JavaScript: Concurrency Beyond the Event Loop full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2021, publisher: OReilly Media, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

II Thomas Hunter Multithreaded JavaScript: Concurrency Beyond the Event Loop
  • Book:
    Multithreaded JavaScript: Concurrency Beyond the Event Loop
  • Author:
  • Publisher:
    OReilly Media
  • Genre:
  • Year:
    2021
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Multithreaded JavaScript: Concurrency Beyond the Event Loop: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Multithreaded JavaScript: Concurrency Beyond the Event Loop" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

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 platformsuch as with web workers in the browser, worker_threads in Node.js, and the Atomics and SharedArrayBuffer objectsJavaScript engineers are able to build multi-threaded applications. These features will go down as being the biggest paradigm shift for the worlds 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.
  • 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 youll benefit from multiple threads

II Thomas Hunter: author's other books


Who wrote Multithreaded JavaScript: Concurrency Beyond the Event Loop? Find out the surname, the name of the author of the book and a list of all author's works by series.

Multithreaded JavaScript: Concurrency Beyond the Event Loop — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Multithreaded JavaScript: Concurrency Beyond the Event Loop" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Multithreaded JavaScript by Thomas Hunter II and Bryan English Copyright 2022 - photo 1
Multithreaded JavaScript

by Thomas Hunter II and Bryan English

Copyright 2022 Thomas Hunter II and Bryan English. All rights reserved.

Printed in the United States of America.

Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.

OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .

  • Acquisitions Editor: Amanda Quinn
  • Development Editor: Corbin Collins
  • Production Editor: Daniel Elfanbaum
  • Copyeditor: Tom Sullivan
  • Proofreader: nSight, Inc.
  • Indexer: nSight, Inc.
  • Interior Designer: David Futato
  • Cover Designer: Karen Montgomery
  • Illustrator: Kate Dullea
  • October 2021: First Edition
Revision History for the First Edition
  • 2021-09-22: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781098104436 for release details.

The OReilly logo is a registered trademark of OReilly Media, Inc. Multithreaded JavaScript, the cover image, and related trade dress are trademarks of OReilly Media, Inc.

The views expressed in this work are those of the authors, and do not represent the publishers views. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.

978-1-098-10443-6

[LSI]

Dedication

This book is dedicated to Katelyn and Rene.

Foreword

The book youre holding now is a fun one. Its a JavaScript book that opens with examples written in C, talks about multithreading with an explicitly single-threaded programming language, provides great examples of how and when to intentionally block the event loop after experts have been telling you for years to never do so, and closes with an excellent list of reasons and caveats about why you might not actually want to use the mechanisms the book describes. More importantly, its a book that I would consider essential reading for any JavaScript developer no matter where your code is expected to be deployed and run.

When Ive worked with companies to help them build more efficient and more performant Node.js and JavaScript applications, Ive often had to step back and take the time first to discuss many of the common misconceptions developers have about the programming language. For instance, I once had an engineer with a long history in Java and .NET development argue that creating a new promise in JavaScript was a lot like creating a new thread in Java (its not), and that promises allow JavaScript to run in parallel (they dont). In a separate conversation someone had created a Node.js application that was spawning over a thousand simultaneous worker threads and wasnt sure why they werent seeing an expected improvement in performance while testing on a machine that had only eight logical CPU cores. The lesson from these conversations is clear: multithreading, concurrency, and parallelism are still very unfamiliar and difficult topics for a very large percentage of JavaScript developers.

Dealing with these misconceptions is what led directly to me (working with my colleague and fellow Node.js Technical Steering Committee member, Matteo Collina) developing the Broken Promises workshop in which we would lay out the foundations of asynchronous programming in JavaScriptteaching engineering teams how to reason more effectively about the order in which their code would execute and the timing of various events. It also led directly to the development of the Piscina open source project (with fellow Node.js core contributor Anna Henningsen), which provides a best-practice implementation of a worker pool model on top of Node.js worker threads. But those only help with part of the challenge.

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.

James Snell,
Node.js Technical Steering Committee Member

Preface

Bryan and I (Thomas) first met during my interview at the San Francisco branch for DeNA, a Japanese mobile game development company. Apparently most of the upper management was going to say no, but after the two of us hung out at a Node.js meetup later that night, Bryan went and convinced them to give me an offer.

While at DeNA, Bryan and I worked on writing reusable Node.js modules so that game teams could build out their game servers, combining components as appropriate to suit the needs of their game. Performance was something we were always measuring, and mentoring game teams on performance was a part of the job; our servers were continuously scrutinized by developers in an industry that traditionally relied upon C++.

The two of us would work together in other capacities as well. Another such role was at a small security startup named Intrinsic where we focused on hardening Node.js apps at such a complete and granular level that I doubt the world will ever see another product like it. Performance tuning was a huge concern for that product as well since customers didnt want to take a hit to their throughput. We spent many hours running benchmarks, poring over flamegraphs, and digging through internal Node.js code. Had the worker threads module been available in all the versions of Node.js that our customers demanded, I have no doubt we would have incorporated it into the product.

Weve also worked together in nonemployment capacities as well. NodeSchool SF is one such example wherein we both volunteered to teach others how to use JavaScript and create Node.js programs. We have also spoken at many of the same conferences and meetups.

Both of your authors have a passion for JavaScript and Node.js, and for teaching them to others and eliminating misconceptions. When we realized there was such an extreme lack of documentation about building multithreaded JavaScript applications, we knew what we had to do. This book was born from our desire to not only educate others about the capabilities of JavaScript, but also to help prove that platforms like Node.js are just as capable as any other when it comes to building performant services that utilize the available hardware.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Multithreaded JavaScript: Concurrency Beyond the Event Loop»

Look at similar books to Multithreaded JavaScript: Concurrency Beyond the Event Loop. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Multithreaded JavaScript: Concurrency Beyond the Event Loop»

Discussion, reviews of the book Multithreaded JavaScript: Concurrency Beyond the Event Loop and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.