NetBSD has the neat property that it's possible for a halfway decent C programmer to learn kernel programming from the man pages alone. The documentation is that good. FreeBSD and especially OpenBSD may also share this property, but NetBSD is my go-to OS to tinker with.