CLR Threads and Windows Threads
Today, the CLR uses the threading capabilities of Windows, so Part V of this book is really focusing on how the threading capabilities of Windows are exposed to developers who write code by using the CLR. I will explain about how threads in Windows work and how the CLR alters the behavior (if it does). However, if you’d like more information about threads, I recommend reading some of my earlier writings on the topic, such as my book Windows via C/C++, 5th Edition (Microsoft Press, 2007).
While a CLR thread maps directly to a Windows thread today, the Microsoft CLR team reserves the right to divorce itself from Windows threads in the future. Someday, the CLR may introduce its own logical thread concept so that a CLR logical thread doesn’t necessarily map to a physical Windows thread. For example, there has been talk of creating logical threads that use much less resources than physical threads, and then you could have many logical threads running on top of a very small number of physical threads. For instance, the CLR could determine that one of your threads is in a wait state and reassign that thread to do a different task. The benefits of this include easier coding, less resources used, and potentially improved performance. Unfortunately, implementing this solution would be a huge amount of work for the CLR team, so I would not expect a feature like this to make it into the CLR anytime soon.
For you, all of this means that your code should make as few assumptions as possible when manipulating threads. For example, you should avoid P/Invoking to native Windows functions since these functions have no knowledge of a CLR thread.5 By avoiding native Windows functions and sticking with Framework Class Library (FCL) types whenever possible, you’re guaranteed that your code will easily take advantage of these performance enhancements as they become available in the future.
相關文章
- 執行緒 threads執行緒thread
- Common threads: Awk by examplethread
- mormot.core.threads--TSynQueueORMthread
- mormot.core.threads--TSynParallelProcessORMthreadParallel
- Simplifying Graphics With Java and Threads (轉)Javathread
- MySQL 5.5 -- innodb_purge_threadsMySqlthread
- mormot.core.threads.pas unitORMthread
- mormot.core.threads--TBlockingProcessORMthreadBloC
- mormot.core.threads--TSynThreadORMthread
- mormot.core.threads--TSynThreadPoolORMthread
- Threads in Node 10.5.0: a practical introthread
- Java 8 併發: Threads 和 ExecutorsJavathread
- android ddms裡邊看threadsAndroidthread
- mormot.core.threads--TSynBackgroundThreadMethodORMthread
- Android Guide Dev 之Processes and ThreadsAndroidGUIIDEdevthread
- 奇怪的All threads (200) are currently busythread
- mormot.core.threads--TSynBackgroundTimerORMthread
- VisualVM第二章-ThreadsLVMthread
- One of the mosting interesting threads on theserversideRESTthreadServerIDE
- 有關threads中message的問題thread
- Node.js 真·多執行緒 Worker Threads 初探Node.js執行緒thread
- Java 21 新特性:虛擬執行緒(Virtual Threads)Java執行緒thread
- NID-00135: There are 1 active threads錯誤thread
- Threads Versus Greenlets in Python Networking Library GeventthreadPython
- Android中的Activitys, Threads和記憶體洩露Androidthread記憶體洩露
- Introduction to processes and threads(執行緒與程式的區別)thread執行緒
- mysql 5.5引數--innodb_read(write)_io_threadsMySqlthread
- Threads are going to be renewed over time to try and avoid a probable memory leak.threadGo
- 8.0新特性-並行查詢innodb_parallel_read_threads並行Parallelthread
- 修正後的SYSTEM_THREADS與SYSTEM_PROCESSES結構體thread結構體
- Meta:Threads目前擁有2.75億月活躍使用者thread
- MySQL 8.0新特性-並行查詢innodb_parallel_read_threadsMySql並行Parallelthread
- nodejs中使用worker_threads來建立新的執行緒NodeJSthread執行緒
- 有熟悉org.apache.tomcat.util.threads.ThreadPool的朋友麼?ApacheTomcatthread
- Description of Important Components / Threads in EM GC Agent_1101615.1ImportthreadGC
- Archery 平臺執行DDL error:Threads_connected exceeds its critical thresholdErrorthread
- MySQL 8.0 Reference Manual(讀書筆記73節--Thread Concurrency for InnoDB and I/O Threads)MySql筆記thread
- MySQL:簡單記錄performance_schema.threads中的3種執行緒ID各自的含義MySqlORMthread執行緒