当前位置:网站首页>Thrift threadmanager and three monitors
Thrift threadmanager and three monitors
2022-07-03 13:49:00 【yolo_ yyh】
Catalog
One 、ThreadManager
effect : Thread pool management class , Create a thread with a thread factory
characteristic : Threads will not be created or destroyed , Instead, save the number of idle threads variable 、 Active threads variable ;
Maintain a task (task) queue , And balance the response and waiting time of the service , Notify the thread pool policy object (PoolPolicy object ) Relevant information , from PoolPolicy object Determine pool sizing , The advantage of this is that the strategy can be decoupled .
Two 、 Three Monitor
(1) monitor_
To coordinate task Fast execution , Join the slow situation , When one worker Finish one task, It will start from tasks Get another one in , If not , Just block ; When new task Add to tasks perhaps worker When cleaned ,monitor_ Wake up again .
(2) workerMonitor_
Every worker Run out task Will be added to deadWorkers_ Inside ,addWorker and removeWorker Will not change workCount_, It will only change workMaxCount_, Only when run When it's time to change manager_ Of workerCount_, Synchronization is by workerMonitor_ be responsible for .
(3) maxMonitor_
Used to monitor waiting task number , When manager_ call add add to task when , If the maximum has been exceeded , Will wait , Wait until call worker Of run Method , Remove... From the task queue task after , When the task queue length is less than the maximum , Wake up again .
边栏推荐
- 软件测试工作那么难找,只有外包offer,我该去么?
- Field problems in MySQL
- mysql中的字段问题
- 网上开户哪家证券公司佣金最低,我要开户,网上客户经理开户安全吗
- Comprehensive evaluation of double chain notes remnote: fast input, PDF reading, interval repetition / memory
- 父亲和篮球
- 常见的几种最优化方法Matlab原理和深度分析
- Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
- Sequence table (implemented in C language)
猜你喜欢

Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market

Libuv Library - Design Overview (Chinese version)

MyCms 自媒体商城 v3.4.1 发布,使用手册更新
![[技术发展-24]:现有物联网通信技术特点](/img/f3/a219fe8e7438b8974d2226b4c3d4a4.png)
[技术发展-24]:现有物联网通信技术特点

【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明

logback日志的整理

Mastering the cypress command line options is the basis for truly mastering cypress

Unity EmbeddedBrowser浏览器插件事件通讯

Comprehensive evaluation of double chain notes remnote: fast input, PDF reading, interval repetition / memory

全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
随机推荐
CVPR 2022 | 美团技术团队精选6篇优秀论文解读
刚毕业的欧洲大学生,就能拿到美国互联网大厂 Offer?
【电脑插入U盘或者内存卡显示无法格式化FAT32如何解决】
Asp. Net core1.1 without project JSON, so as to generate cross platform packages
项目协作的进度如何推进| 社区征文
Sequence table (implemented in C language)
php 迷宫游戏
Internet of things completion -- (stm32f407 connects to cloud platform detection data)
[technology development-24]: characteristics of existing IOT communication technology
Kivy教程之 如何自动载入kv文件
Depth and breadth first traversal of tree (regardless of binary tree)
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
[today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay
Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
SQL Injection (POST/Search)
PHP maze game
The principle of human voice transformer
记录关于银行回调post请求405 问题
Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
Unity Render Streaming通过Js与Unity自定义通讯