How does GHC runtime deal with file I/O?
Some papers on GHC runtime internals mention that it uses epoll/kqueue/poll to detect whether a file descriptor is ready to read/write.
I can understand how it's done for socket I/O. But what about disk file access? The poll syscall doesn't work with ordinary files, only with socket I/O; true?
The only option I can imagine here is using a thread pool for blocking syscalls, one thread-per-request...
In the unthreaded RTS, the whole runtime will block. In the threaded RTS, it will do safe foreign calls like this via thread pool, so the capability will not block.
链接地址: http://www.djcxy.com/p/20642.html上一篇: 哪个异常终止进程? (iis的w3wp)
下一篇: GHC运行时如何处理文件I / O?