Concurrent programming: practice 8