文档介绍:(IPC)PartBIPCmethodsSignalsMutex(MUTualEXclusion)SemaphoresSharedmemoryMemorymappedfilesPipes&namedpipesSocketsMessagequeuesMPI(MessagePassingInterface)BarriersSemaphores(Bounded)Producer-(rules):Theproducermustpauseproductionifthewarehousefillsup(bounded).Ifthewarehouseisempty,theconsumermustwaitforsomethingtobeproduced.(Bounded)producer-consumerproblemDanger,WillRobinson(asharedvariable)!(Bounded)Producer-’(putsconsumeronreadyqueue).!(Theschedulerinterrupteditrightbeforethecalltosleep().)Producerkeepsinsertingdataintobufferuntilit’!=0soitgoestosleep!Bothsleepforever!:UpincrementsthevalueofthesemaphorehistoricallydenotedasV(alsoknownassignal)DowndecrementsthevalueofthesemaphoreP(alsoknownaswait)SemaphoresTypes:--group-other(canbesystem-wide).Binarysemaphores==unlocked0=lockedThentousethisasamutex: