当前位置:网站首页>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 .
边栏推荐
- 使用Tensorflow进行完整的深度神经网络CNN训练完成图片识别案例2
- SwiftUI 开发经验之作为一名程序员需要掌握的五个最有力的原则
- Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market
- [技術發展-24]:現有物聯網通信技術特點
- 服务器硬盘冷迁移后网卡无法启动问题
- [understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
- Software testing is so hard to find, only outsourcing offers, should I go?
- Kivy教程之 如何自动载入kv文件
- IBEM 数学公式检测数据集
- 3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
猜你喜欢

Libuv Library - Design Overview (Chinese version)

SQL Injection (GET/Select)

Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
![[technology development-24]: characteristics of existing IOT communication technology](/img/f3/a219fe8e7438b8974d2226b4c3d4a4.png)
[technology development-24]: characteristics of existing IOT communication technology

Kivy tutorial how to automatically load kV files

MySQL 数据处理值增删改

Resolved (error in viewing data information in machine learning) attributeerror: target_ names

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

SQL Injection (POST/Search)

MySQL installation, uninstallation, initial password setting and general commands of Linux
随机推荐
SQL Injection (GET/Select)
The reasons why there are so many programming languages in programming internal skills
Comprehensive evaluation of double chain notes remnote: fast input, PDF reading, interval repetition / memory
MyCms 自媒体商城 v3.4.1 发布,使用手册更新
双链笔记 RemNote 综合评测:快速输入、PDF 阅读、间隔重复/记忆
Software testing is so hard to find, only outsourcing offers, should I go?
The shortage of graphics cards finally came to an end: 3070ti for more than 4000 yuan, 2000 yuan cheaper than the original price, and 3090ti
[développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
PHP maze game
Unity render streaming communicates with unity through JS
Typeerror resolved: argument 'parser' has incorrect type (expected lxml.etree.\u baseparser, got type)
Spark practice 1: build spark operation environment in single node local mode
IBEM mathematical formula detection data set
Unity EmbeddedBrowser浏览器插件事件通讯
Go 1.16.4: manage third-party libraries with Mod
掌握Cypress命令行选项,是真正掌握Cypress的基础
Error handling when adding files to SVN:.... \conf\svnserve conf:12: Option expected
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe for the online account manager to open an account
静态链表(数组的下标代替指针)
Open PHP error prompt under Ubuntu 14.04