implementing blocking syscalls in Linux -
i understand how implementing blocking i/o syscalls different non-blocking? googling didn't much, links or references appreciated.
thanks.
http://faculty.salina.k-state.edu/tim/ossg/device/blocking.html
blocking syscall put task (calling thread) sleep (block running on cpu), , syscall return after event (or timeout). non-blocking syscall not block thread, checks in-kernel states , returns.
more detailed description: http://www.makelinux.net/ldd3/chp-6-sect-2
one important issue: how driver respond if cannot satisfy request? call read may come when no data available, more expected in future. or process attempt write, device not ready accept data, because output buffer full. calling process not care such issues; programmer expects call read or write , have call return after necessary work has been done. so, in such cases, driver should (by default) block process, putting sleep until request can proceed. ....
there several forms of wait_event
kernel functions block caller thread, check include/linux/wait.h
; thread can waked different ways, example wake_up
/wake_up_interruptible
.
Comments
Post a Comment