TOC 
Previous 
Next 
The epoll API
Why epoll is better
    - 
		Signals are not used.
				
 
 
- 
		Kernel maintains data structures that "remember" the set of file 
		descriptors monitored 
		by the application.
		
 
 
		    - 
				No need to repeatedly exchange lists of file descriptors
				between kernel and user space.
				
 
 
- 
				Kernel can "notice" when file descriptor becomes ready 
				(no need to repeatedly re-check all descriptors).
				
 
 
- 
				Performs well even when monitoring several thousand file descriptors.
		    
 
The following table compares poll(), 
select(), and epoll 
for monitoring different numbers (N) of file descriptors.
| Number of descriptors monitored (N)
 | poll() CPU time (seconds)
 | select() CPU time (seconds)
 | epoll CPU time (seconds)
 | 
| 10 | 1.12 | 1.28 | 0.65 | 
| 100 | 6.8 | 7.1 | 0.68 | 
| 1000 | 157 | 151 | 0.89 | 
| 10000 | 1750 | 1087 | 0.97 | 
 
    - 
		Measurements are elapsed time for 100 000 operations.
		
 
 
- 
		Test was arranged so that 
		one randomly selected file descriptor was ready 
		each time a monitoring operation was performed.
		
 
 
- 
		As N increases, epoll times
		remain near constant.
		
 
 
(C) 2006, Michael Kerrisk