3 ms·
> One option is to design every such API so that it can accept a batch of work. There is some of that with scatter-gather APIs like writev and readv system cal
by rdtsc 13y ago
> One option is to design every such API so that it can accept a batch of work.
There is some of that with scatter-gather APIs like writev and readv system calls.
AIO is there on Linux for disk access.
Then for sending data to a socket there is sendfile() system call. Kinds of lets the kernel handle the copying.
> In terms of a mechanism, could the OS and applications communicate through concurrent data structures like the disruptor pattern rather than by direct context switching?
There are some already. Mostly involving read-only data. Those are implemented via pages mapped to processes' memory. These are called vDSOs. gettimeofday() call is one such instance.
Other instances of that is for capturing network packets often use a ring of shared memory for getting data out.
Another way to do this, instead re-creating all the APIs from scratch is to optimize schedulers more. Make them cache (code and data) aware. In userland you can set CPU affinity of your processes. Maybe match interrupt affinity with your CPU affinity to make sure data is present in the cache.