Having kernel threading now working, I set about researching the BSD Socket library and working out how best to fit an implementation into the kernel, particularly with a loopback interface so that I could create a server thread and a client thread and let them talk.
Unfortunately, I didn't get far down this road before I really needed some good old fashioned thread synchronisation.
The Basics
Interrupts can happen at any time, they don't care what you're doing, they will interrupt the currently running code and let some other code run for a while. That's all well and good until you're half-way through updating some structure, you get interrupted, then the next task tries to read that data and finds it broken. Bad things ensue. In SQL Server, there are lot of fanciful things such as transaction isolation levels and snapshots and whatnot to assist you in not reading half-written data unless you really want to.