Blocking I/O, Non-Blocking I/O
I/O can take place in kernel level
process, thread needs to request for I/O in kernel
β Blocking I/O
block user process during I/O
- Process(Thread) requests I/O in kernel 
 - When kernel is done, return value to process 
 
- when I/O is in process, user process(thread) has to wait
 waste resource
- I/O does not use CPU
 
- If various client connecting server is made in blocking
- if there is I/O
 - cannot stop client process
 - need to create each process thread for each client
 - if a lot of clients connect at once
 - ππ» context switching between thread
 
 
β Non-Blocking I/O
does not block user process during I/O
- User process calls 
recvfrommethod
tell kernel process needs data from socket - Kernel cannot return 
recvfromimmediately, so returnsEWOULDBLOCK - User process does its work 
 - if there is data on 
recvfromfor user, recives data from Bufferrecvfromis on the memory of kernel, thus faster retrival of data recvfromwill copy the data, and return to user
 This post is licensed under  CC BY 4.0  by the author.