JMK no matter what

PyCon #10: Non-blocking/Asynchronous I/O

준비한 것이 많은 것 같던데 발표하다 시간이 늦어져서 많이 스킵해서 아쉬웠다. 발표자료라도 봐야 할 듯? 재밌었음. aio 파이썬에서 쓰는 얘기 같은 거 좀 더 보고 싶은데.

  • (Under Linux)

  • (Usual) Buffered I/O

    • There are three buffers; one in user space, and two buffers (read/write) in Kernel
    • Lots of copying around. -.-
  • Blocked I/Os

  • Non-blocking I/O == styll synchronous!!

    • Still sequential
    • It's a property of the FD
    • returns EWOULDBLOCK or # of available bytes
    • when asked, kernel will get the data, but that's all
    • You have to poll the data out of kernel's buffer: read() again
    • and this is ugly
  • I/O Multiplexing

    • poll()
  • Event Driven I/O

    • The readiness of an FD for I/O is refered as an event
    • Libraries and frameworks
    • A (possibly) thin layer around I/O multiplexing?
    • Still everything is synchronous: once kernel's buffers fill up, there's no I/O happenning until you read() or write() it
    • So if the handler:
      • page faults
      • blocks on mutex
      • goes compute bound
      • => we're hosed
    • Why better? => far less memory, less context switching, do a lot of I/O without threads -- without GIL
    • libev, pyev
    • libevent
  • Non-blocking Frameworks
    • Tornado, Twisted, Asyncore
  • So we don't really have asynchronous I/O in Linux?
    • Windows has IOCP
    • aio_read aio_write in Linux: examples in Python plz orz
  • differences in poll/epoll
    • poll: give list every time
    • epoll: we don't want to give a list of 10000 fds; register once, get events triggered
  • eventlet?
2010-02-21 02:58:09 | JM | /after/conferences/ | 2 Comments
이희승
2010-02-22 11:19:51
슬라이드 주소는 여기: http://us.pycon.org/media/2010/talkdata/PyCon2010/068/Demyst.pdf
어떻게 보면 폰 노이만 아키텍처에서는 뭘 해도 synchronous 아닌가? 쪼개기 나름이지. 그니까 프레임워크를 쓰면 ugly 한 부분을 감춰주고 BIO, NBIO, AIO 사이에서 투명하게 전환시켜 줄 수 있어서 좋음~ㅋ
JM
2010-02-23 13:51:13
ㅎㅎ 슬라이드 링크까지! 감사감사. 이 사람은 synch 와 asynch 의 구분을 좀 특이하게 짓는 거 같더군요. 사실 제가 그쪽을 잘 모르기도 하고. 발표 자료나 다시 훑어봐야겠어요.

Leave a comment

春來不似春

About

Eventstream

Pages

Guestbook

Search

Site Admin

Recent Comments