Merge kernel ctor/dtor changes from Perforce.

In addition to thread constructors/destructors, we must also clean up after a destructed process that caches its thread object allocation.

Submitted-by: Robert Watson