Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does GHC runtime deal with file I/O?

Tags:

c

haskell

ghc

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...

like image 942
user3489275 Avatar asked May 19 '14 18:05

user3489275


1 Answers

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.

like image 112
Jake McArthur Avatar answered Sep 29 '22 19:09

Jake McArthur