Some multiprocessor aware changes.

More to come, in areas where race conditions can happen.