Kernel/Userspace interfaces: can we ever get it right?
Linux has a love-hate relationship with userspace. Kernel developers
seem to never get the interface right, and the landscape is littered
with abandoned attempts. This paper will provide a systemic look at
the many of the current (and older) userspace interfaces to attempt to
identify the important characteristics of good design.
In the beginning Unix had system calls and file descriptors;
everything was interfaced with read/write and then along came real i/o
issues and the ioctl was added. This ruined the perfection of the
model, and the operating system world has been changed since. Linux
inherited this model, and added more interfaces as the need arose and ended
up with a cluttered array of interfaces. In
the current kernel, there are sysfs, procfs, debugfs, configfs,
netlink, ioctl, and special case system calls. Every time a new major
subsystem or driver is added, there is lots of effort expended
reworking the interface.
Given these problems, a higher level meta look is needed. The existing API's
need to be evaluated for:
* Documentation - how much is there, is it covered from both kernel
and user point of view. Does it show up in source tree and standard
* Portability - much as Linux developers like to think there is only one OS
most applications need run on multiple OS's.
* Flexible - can new features be added without breaking the interface.
Which strategies for versioning work or don't work (see wireless API).
Does the interface force a particular model (see sysfs).
* Transparent - can the interface be virtualized or handled remotely.
* Usability - Rusty's measure of is it easy to use in the right way, and
hard to misuse.
* Frequency - how many applications actually use it (few, some, many)?
The author and others tend to bring up netlink as the silver bullet of
interfaces but is lacking in several of these areas. Can netlink be
saved, is it workable?
Note:I intend also to bring in any additional characteristics discovered as part of
the Kernel/User interface panel at Linux Plumbers Conference.
Stephen has been involved with Linux kernel development for 7
years, mostly on TCP and network devices. He currently maintains the
bridging and iproute2 utilities. Currently at Vyatta, he focuses on
QoS, routing protocols, and performance. Stephen used to give more
talks in his previous role as fellow at OSDL, including Linux
Conference Europe 2007, Linux Conference Australia 2005, and Linux
Kongress tutorial in 2004.