What Rental Threading Is

Recently, I was learning more about Microsoft Edge, the newest Web browser Microsoft announced on April 29. Not only does this new browser offer new and exciting features but also provides better scalability and high performance. While reading some papers and articles, I noticed that “rental threading” model plays a major role in the process.

Multithreading is a common approach for browsers to handle execution and there are several threading models. Eric Lippert talks about threading model in script engines including single-threaded, free-threaded, apartment threaded and rental-threaded. Rental threading is something that makes it possible for Edge to do what it does.

The rental threading model is used by the JavaScript Runtime (JSRT), the library to execute JavaScript in Windows 10 and Edge. See the detailed article here. Whereas rental-threading is single-threaded, it is not married to the thread it was created on. Script operations context can change the thread from time to time depending on the availability. An operation can start in one thread and wait and then pick up another thread that is idle and available.

As explained in this article:

In a rental-threaded model, hosts could create thread pools to ensure that they do not exceed a particular thread (and CPU) utilization quota. Such a model enables high scalability at low cost as it does not require the application to create a new thread for every request that comes in and requests need not block for other requests to be serviced.

With JSRT APIs, hosts also get the flexibility for managing the runtime's background operations. Chakra provides a high-performance concurrent JIT compiler and garbage collector. By default, each runtime manages its own set of threads for both background compilation and background garbage collection. Based on the app needs, hosts can provide their own threads for those operations or can force the runtime to perform those tasks on the primary thread, ensuring that applications have predictable behavior and performance characteristics.

References:

http://blogs.windows.com/msedgedev/2015/05/18/using-chakra-for-scripting-applications-across-windows-10/

http://blogs.msdn.com/b/ericlippert/archive/2003/09/18/what-are-threading-models-and-what-threading-model-do-the-script-engines-use.aspx

http://blogs.msdn.com/b/larryosterman/archive/2004/04/28/122240.aspx

https://msdn.microsoft.com/en-us/library/ms765459%28v=vs.85%29.aspx

Up Next
    Ebook Download
    View all
    Learn
    View all