Threading Models And Threading Pool

Single Threaded reactor

event-loop libraries such as libeventlibev,Programs using libevent :html

Choromium:  Google's open-source web browser(on Mac and Linux)react

Memcached: a high-performance,distributed memory object caching systemweb

Transmission : a fast,eash, and free BitTorrent client緩存

N:1 Threading library

Also known as Fiber,纖程,Typical examples are GNU Pth,StateThreads oop

Muti-threaded reactor

boost::asio is a typical examplespa

M:N threading library

Issue

Muti-core scalability

Asynchronous programming

 

 

CachedThreadPool:可緩存的線程池,該線程池中沒有核心線程,非核心線程的數量爲Integer.max_value,就是無限大,當有須要時建立線程來執行任務,沒有須要時回收線程,適用於耗時少,任務量大的狀況。線程

SecudleThreadPool:週期性執行任務的線程池,按照某種特定的計劃執行線程中的任務,有核心線程,但也有非核心線程,非核心線程的大小也爲無限大。適用於執行週期性的任務。scala

SingleThreadPool:只有一條線程來執行任務,適用於有順序的任務的應用場景。orm

FixedThreadPool:定長的線程池,有核心線程,核心線程的即爲最大的線程數量,沒有非核心線程
 htm

相關文章
相關標籤/搜索