foundations of multi-thread