Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript multithreading in IE6?

Is JavaScript multithreading possible in IE6?

Are there any third party libraries for this?

like image 644
Dilip Avatar asked Mar 15 '10 22:03

Dilip


People also ask

Is JavaScript capable of multithreading?

Multithreading in JavaScript is the real right now. You can offload your work into multiple threads and share memory between them.

Do web workers make JavaScript multithreaded?

Developers have been solving this problem in desktop applications for a long time with multithreading. Web Workers bring multithreading to JavaScript web applications. Different parts of code can run simultaneously without blocking each other and communicate using message passing techniques.

CAN node js be multithreaded?

Node. js runs JavaScript code in a single thread, which means that your code can only do one task at a time. However, Node. js itself is multithreaded and provides hidden threads through the libuv library, which handles I/O operations like reading files from a disk or network requests.

Is JavaScript multithreaded and how it handles multithreading?

As you may probably know, Javascript is single-threaded. To clarify better, this means that one single thread handles the event loop. For older browsers, the whole browser shared one single thread between all the tabs.


3 Answers

JavaScript does not support native multithreading in current web browsers. Even if it did, I bet IE 6 wouldn't have supported it :)

Running your scripts in multiple iframes could be one workaround, as Jason Kester suggested in another answer.

In addition, for modern browsers you might be interested in checking out Web Workers, but this is definitely something out of the IE 6's league:

  • Stack Overflow: JavaScript and Threads
  • Dive into HTML 5: Web Workers
  • Firefox 3.5: Web Workers in action
  • John Resig: Computing with JavaScript Web Workers
like image 116
Daniel Vassallo Avatar answered Oct 12 '22 03:10

Daniel Vassallo


Run your tasks in IFrames

Assuming you're talking about multitasking on the client side, you can open n frames on your page, each pointed to a page on your domain.

There are lots of ways to architect it from there. Probably the easiest would be to have a single .js include that you run from each frame. It phones home to parent.readyToGo() or whatever, and gets some work assigned. The worker methods can call something like parent.taskFinished() to report when they're done.

Most importantly, don't listen to anybody telling you not to run your mission critical multithreaded javascript application on IE6. I'm sure you have good reasons:)

like image 35
Jason Kester Avatar answered Oct 12 '22 04:10

Jason Kester


There is no way - definitely not in IE6. You can fake it by using lots of window.setTimeout()s.

See Why doesn't JavaScript support multithreading?

like image 42
Andras Vass Avatar answered Oct 12 '22 02:10

Andras Vass