send, recv 등을 호출해서 I/O를 하게되면 I/O가 끝날때까지 호출한 쓰레드는 블럭되고 아무것도 못하죠. 그럼 이렇게 블럭된 상태의 쓰레드는 CPU를 계속 점유하나요? 아니면 I/O가 끝날때까지 wait하는건가요?
리눅스 커널의 경우는 sleeping 합니다.
recv 함수가 호출하는 커널 network layer의 BSD Socket과 Transport에 해당하는 함수들을 보면 대강 이렇습니다.
recv(User space) ==> sys_recv (kernel space system call) -> sock_recvmsg -> tcp_recvmsg -> 그리고 sleeping 입니다. Sleep 을 깨우는 것은 network tasklet 입니다.
감사합니다~
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
sleeping 합니다.
리눅스 커널의 경우는 sleeping 합니다.
recv 함수가 호출하는 커널 network layer의 BSD Socket과 Transport에 해당하는 함수들을 보면 대강 이렇습니다.
recv(User space) ==> sys_recv (kernel space system call) -> sock_recvmsg -> tcp_recvmsg -> 그리고 sleeping 입니다.
Sleep 을 깨우는 것은 network tasklet 입니다.
감사합니다
감사합니다~
댓글 달기