Associate thread with virtualmachine