生产者消费者
华工计算机辅修OS的实验二的问题1,不让用Python写不过还是写了~~~import threadingimport timeimport random#假设初始时无货物,货物架大小为30n=30empty,full,mutex=threading.Semaphore(30),threading.Semaphore(0),threading.Semaphore(1)def producer(i,goods): while(1): empty.acquire()
原创
2021-11-26 14:36:04 ·
467 阅读 ·
0 评论