- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 112字
- 2021-08-05 10:46:42
Single-core execution
If this is executed in a single core, that core will then interleave between the three threads, each time filtering some of the words before switching to the next one. This interleaving process is called context switching.
Context switching adds overhead to the overall process, because it requires saving the state of the current thread and then loading the state of the next one. This overhead makes it likely that this multi-threaded implementation of isPalindrome() will take longer in a single-core machine when compared to the sequential implementation seen before. This happens because the sequential implementation will have one core do all the work but will avoid the context switch.
推薦閱讀
- 演進式架構(原書第2版)
- Maven Build Customization
- Android開發精要
- Hands-On Image Processing with Python
- 程序員數學:用Python學透線性代數和微積分
- Vue.js快速入門與深入實戰
- Architecting the Industrial Internet
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Visual Basic程序設計與應用實踐教程
- SQL Server 2016數據庫應用與開發
- Java Web開發就該這樣學
- Lift Application Development Cookbook
- 自己動手構建編程語言:如何設計編譯器、解釋器和DSL
- 基于JavaScript的WebGIS開發
- C語言從入門到精通(第5版)