Subject: Re: "fast" syscalls?
To: None <email@example.com>
From: Jed Davis <firstname.lastname@example.org>
Date: 03/21/2006 17:30:23
Brett Lymn <email@example.com> writes:
> You may want to look at some of the audio drivers which allow you to
> mmap a buffer into userland. From memory they handle the
> userland/kernel interaction by updating the head/tail pointers in a
> circular queue, userland updates one pointer and the kernel updates
> the other... when they pointers are equal the queue is empty.
> Unfortunately, it still needs an ioctl to kick the process along but
> the bulk data transfer is handled more efficiently.
Virtual devices under Xen work a lot like that -- shared mapping of a
ring buffer, incrementing produces/consumer indices, and virtual
interrupts used by each side to kick the other. The relevant code,
alas, isn't the clearest thing out there, and requirement of memory
barriers (since the producer and consumer domains could be running
concurrently on different CPUs in a MP machine) probably doesn't help.
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l)))))) (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k))))))) '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))