2016년 2월 14일 일요일

'epoll' based on IO Multiplexing in Linux Environment

  • Echo Server & Client using 'epoll' Example Screen



  • select vs epoll

1. select
- advantage
 1. 'select' is independent about Operating System. Thus, It is operated by various OS.

- disadvantage
 1. All file desciptor is checking in the Loop. 
 ex) for(i=0; i<fd_max+1; i++)
 2. If 'select' is called, observe target which copied using 'fd_set' variable is sending to OS every time. 
 ex) cpy_reads=reads;
ex2) if((fd_num=select(fd_max+1, &cpy_reads, 0, 0, &timeout))==-1)
Inefficient!!


2. epoll ( equal to 'Windows - IOCP, BSD - kqueue, Solaris - /dev/poll' )

- advantage
 1. All file desciptor isn't checking in the Loop. 
 2. If 'epoll_wait' is called, observe target isn't sending to OS every time. 
Efficient!!

- disadvantage
 1. 'epoll' is dependent about Operating System. 

- add explanation
 1. If server has litter client, 'epoll' Function isn't unconditionally needed to use IO Multiplexing Model. 

  • Functions related 'epoll'
epoll_create : epoll file descriptor repository creation 
epoll_ctl : file descriptor enrollment & deletion in the repository
epoll_wate : file descriptor change waiting

댓글 없음:

댓글 쓰기