当前位置:网站首页>Why is epoll efficient?
Why is epoll efficient?
2022-06-21 13:59:00 【Do not deceive the dark room__】

Epoll The bottom implementation of is shown in the figure above :( understand )
- ( Red and black trees , Is a special binary tree ,Epoll How can I monitor many ? First create the root node of the tree , Each root node is a fd Store in the form of a structure ( The node contains some attributes , contain callback function ), For a tree, you can attach nodes at will .
- Linked list , When a file descriptor generates an event , Automatically called callback function , Through the callback callback Function to find the event corresponding to the linked list ( Read time or write events ), The linked list is an event linked list .
epoll Why efficient ?
1.select and poll The monitored files need to be copied and transferred between the operating system and the kernel layer , Each poll needs to be copied from the user layer to the kernel layer , Efficiency is very low , and epoll The kernel layer and the user layer share memory , The monitor event descriptor does not exist in the kernel layer nor in the application layer , The kernel layer monitors directly from the shared space , Greatly improved efficiency
2.select Polling mechanism used , Polling , That is, the event occurrence query will be performed for each monitored event descriptor , Low efficiency , and epoll Use the event notification mechanism , namely
The event will be notified , Instead of polling , Greatly improved efficiency .
边栏推荐
- Some atom operations
- [googolu] takeout rebate system - business domain name of KFC configuration applet
- Chapter IX Cisco ASA application nat
- The SQL query statement executes select (1) first, and the ByteDance algorithm engineer is interviewed
- 6. functions
- seaborn数据总体分布的可视化策略
- MySQL - index
- Set up ZABBIX monitoring and email alarm
- Record the processing process of slow response of primary system
- [test process and theory - Test Technology System]
猜你喜欢

MySQL - index

Async get and post request interface data (add, delete, modify and query pages)

Taobao secsha plug-in

Read distributed consistency protocols 2pc and 3pc

Turn to the countdown for coupon issuance! First look at the rules of interstellar pocket donation

Highly available configuration of database (MySQL)

Explain the design idea and capacity expansion mechanism of ThreadLocal in detail

Installation of MySQL 8.0.19 under alicloud lightweight application server linux-centos7

seaborn数据总体分布的可视化策略

Lamp architecture 5 - MySQL Cluster and master-slave structure
随机推荐
Comprehensively analyze the key points of knowledge required for interface testing and interface testing
3D slicer import label and view label
What is Devops in an article?
Add SSL security certificate to web site
8. structure
Explanation of vim, makefile and GDB tools
[deeply understand tcapulusdb technology] tmonitor background one click installation
CSDN's test teacher teaches JMeter to generate stress test reports
Prepare for the golden three silver four, are you ready? Summary of software test interview questions
Review notes of web development technology
Sort query results according to the input order of fuzzy query jancode
MySQL - data type
Detailed explanation of hashtable source code in C #
MySQL - transaction management
Oracle client11 and pl/sql12 installation
3000 frame animation illustrating why MySQL needs binlog, redo log and undo log
Map collection traversal, adding, replacing and deleting elements
[in depth understanding of tcapulusdb technology] tcapulusdb business data backup
Please, don't use pessimistic locks in high concurrency scenarios!
Must the database primary key be self incremented? What scenarios do not suggest self augmentation?