problem 2 of Concurrency 5 assignment completed