• Complain

Ido Green - Web Workers: Multithreaded Programs in JavaScript

Here you can read online Ido Green - Web Workers: Multithreaded Programs in JavaScript full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2012, 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.

Ido Green Web Workers: Multithreaded Programs in JavaScript
  • Book:
    Web Workers: Multithreaded Programs in JavaScript
  • Author:
  • Publisher:
    OReilly Media
  • Genre:
  • Year:
    2012
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Web Workers: Multithreaded Programs in JavaScript: summary, description and annotation

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

Web apps would run much better if heavy calculations could be performed in the background, rather than compete with the user interface. With this book, youll learn how to use Web Workers to run computationally intensive JavaScript code in a thread parallel to the UI. Yes, multi-threaded programing is complicated, but Web Workers provide a simple API that helps you be productive without the complex algorithms.

If you have an intermediate to advanced understanding of JavaScript especially event handling and callbacksyoure ready to tackle Web Workers with the tools in this example-driven guide.

  • Start creating Web Workers and understand what they can and cant do
  • Determine which browser versions support the API
  • Use dedicated Web Workers for tasks that consume a lot of CPU, such as data parsing
  • Explore use cases for creating inline Workers, such as encapsulating a web app in one page
  • Create a shared Worker to communicate multiple web app instances to the server, and other uses
  • Learn best practices for debugging Web Workers
  • Apply Web Workers within the server-side Node environment

Ido Green: author's other books


Who wrote Web Workers: Multithreaded Programs in JavaScript? Find out the surname, the name of the author of the book and a list of all author's works by series.

Web Workers: Multithreaded Programs in JavaScript — 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 "Web Workers: Multithreaded Programs in JavaScript" 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
Web Workers
Ido Green
Published by OReilly Media

Beijing Cambridge Farnham Kln Sebastopol Tokyo To Ema Who always multi - photo 1

Beijing Cambridge Farnham Kln Sebastopol Tokyo

To Ema

Who always multi threaded

Preface

Web Workers is a powerful feature of HTML5 that hasnt received very much attention. It provides an API that allows you to run JavaScript in a separate thread that doesnt interfere with the user interface of your web application. This JavaScript runs in parallel with the main renderer and any of your user interface scripts on it. This allows long and processing-heavy tasks to be executed without making the page unresponsive.

Like threads in other technologies, Web Workers are relatively heavyweight. You dont want to use them in large numbers, as each one consumes significant system resources. Web Workers are expected to handle long tasks that rely on constrained resources (e.g., CPU, network bandwidth, etc.). They have a high startup cost and a high instance of memory cost.

Because it is a new, evolving standard, different browsers implement the Web Workers specification in different ways. Although some aspects of the implementation are stabilizing, I suspect that features like access to IndexedDB will be available soon in most modern browsers. I hope that with this book and the adoption of modern browsers we will see more usage of this powerful API.

Note

All the examples in this book were tested on Chrome (15+) and Firefox (7+). Web Workers also work in mobile Safari 5+, and will be especially useful because the new iPhone 4GS has a multi-core processor.

How This Book Is Organized

Before you can do much with Web Workers, it helps to know what they are and what they can do well. Next, youll learn how to confirm that your browser supports this feature with a simple Web Worker Hello World example. The next three chapters cover the different kinds of Web Workers (dedicated, shared, and inline), showing how to use each one of them and when it will be best to choose one over the other. After that, youll explore best practices for debugging your Web Workers. Finally, because Web Workers are also used outside of a browser, youll see how to apply them within the server-side Node environment.

Who This Book Is For

You should have a solid intermediate to advanced understanding of JavaScript before tackling the tools used in this book. In particular, you need to understand event handling and callbacks.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Web Workers by Ido Green (OReilly). Copyright 2012 Ido Green, 9781449322137.

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari Books Online
Note

Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

OReilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://oreil.ly/webworkers-1e

To comment or ask technical questions about this book, send email to:

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

I would like to thank Eric Bidelman for doing great review job. Without him, most of the examples would have crashed after 10 seconds.

Chapter 1. Overview

Modern web applications would often run better if there was a way to perform heavy calculations in the background instead of making the user interface wait for them to complete. The Web Workers specification[] defines an API for running computationally intensive code in a thread other than the web application user interface. Long tasks can run without affecting your interfaces memory and CPU footprint because the Worker will live in its own thread.

Multi-threaded programing is a complicated subject well stocked with complex algorithms and theoretical discussion. You can find other languages (e.g., Java) that give their developers a library to mask some of the complexity[]. The good news is that Web Workers provides a nice and simple API that lets you be very productive without worrying too much about deadlocks and similar problems.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Web Workers: Multithreaded Programs in JavaScript»

Look at similar books to Web Workers: Multithreaded Programs in JavaScript. 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 «Web Workers: Multithreaded Programs in JavaScript»

Discussion, reviews of the book Web Workers: Multithreaded Programs in JavaScript 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.