News for hackers. Stuff that matters.
Re:What's wrong with 2006 programming? (2010) by trungaczne on Tuesday December 20, 2016 @11:45PM (#13226852)
Do you have any articles that talk about how FreeBSD does memory management differently?
Re:What's wrong with 2006 programming? (2010) by smegel on Tuesday December 20, 2016 @11:58PM (#13226894)
Re:What's wrong with 2006 programming? (2010) by wmf on Wednesday December 21, 2016 @12:13AM (#13226949)
Admittedly I didn't read it in detail, but I don't see anything about page-ins there. Can you explain the connection between kqueue and paging?
Re:What's wrong with 2006 programming? (2010) by tedunangst on Wednesday December 21, 2016 @12:37AM (#13227041)
There is no connection.

FreeBSD does page faults just like everybody else. Your process blocks until the memory is read in.

Re:What's wrong with 2006 programming? (2010) by smegel on Wednesday December 21, 2016 @01:12AM (#13227142)
Sure it would be my pleasure. Kqueue allows a read request to be scheduled that is non-blocking on a page fault. Linux always blocks the thread executing read() on a page fault. This is still true using aio_read(), as all that does is run another thread to call read() which blocks. Which is great for small numbers of read requests but scales poorly.

And the bit from the paper that is relevant:

> A non kqueue-aware application using the asynchronous I/O (aio) facility starts an I/O request by issuing aio read() or aio write() The request then proceeds independently of the application, which must call aio error() repeatedly to check whether the request has completed, and then eventually call aio return() to collect the completion status of the request. The AIO filter replaces this polling model by allowing the user to register the aio request with a specified kqueue at the time the I/O request is issued, and an event is returned under the same conditions when aio error() would successfully return. This allows the application to issue an aio read() call, proceed with the main event loop, and then call aio return() when the kevent corresponding to the aio is returned from the kqueue, saving several system calls in the process.

Re:What's wrong with 2006 programming? (2010) by SamReidHughes on Wednesday December 21, 2016 @03:27AM (#13227630)
Linux's family of async I/O functions is io_submit and friends, not aio_read. That paper is too old to be relevant.

Also, using a worker pool for I/O scales just fine and has no real disadvantages when talking to a disk or SSD.

Re:What's wrong with 2006 programming? (2010) by wmf on Wednesday December 21, 2016 @01:26AM (#13227191)
OK, so you're talking about AIO and other people here are talking about mmap. If you have working AIO then you can indeed write a fully async server at the cost of extra memory copies.
Re:What's wrong with 2006 programming? (2010) by smegel on Wednesday December 21, 2016 @01:52AM (#13227301)
Sadly mmap is also blocking on page faults on Linux :(
Re:What's wrong with 2006 programming? (2010) by mfukar on Wednesday December 21, 2016 @03:48AM (#13227710)
I would be very interested in how you envision a system that does NOT block on page faults.
Re:What's wrong with 2006 programming? (2010) by lgunsch on Wednesday December 21, 2016 @12:56PM (#13231099)
Read and write system calls have nothing to do with jump instructions causing a page fault by traversing data structures. That is what Redis is all about - in memory data structures available to clients.