考虑以下实现DiningPhilosophers的尝试使用Go例程和channel。packagemainimport"fmt"funcphilos(idint,left,right,platechanbool){fmt.Printf("Philosopher#%dwantstoeat\n",id)有时这会按预期工作,即所有哲学家都吃,例如:Philosopher#4wantstoeatPhilosopher#3wantstoeatPhilosopher#2wantstoeatPhilosopher#1wantstoeatPhilosopher#4finishedeatingPhilo