50 50 1 10 1 semaphore 1 1 codeBlockA: loop 2 compute 10 next end 50 50 1 10 1 semaphore 1 2 codeBlockA: hoge <- forkR codeBlockB yield compute 1 killThread hoge lock semaphore 1 compute 1 end codeBlockB: compute 1 lock semaphore 2 end 5 5 1 3 1 semaphore 1 1 codeBlockA: hoge <- forkI codeBlockA compute 1 end 5 5 1 2 1 semaphore 1 1 codeBlockA: compute 1 hoge <- forkI codeBlockA hoge <- forkI codeBlockA end 0 0