System-call based threading of obgen.

This is a complete working set of code.