文档介绍:munication(IPC)CS-502OperatingSystemsFall2006(SlidesincludematerialsfromOperatingSystemConcepts,7thed.,bySilbershatz,Galvin,&GagneandfromModernOperatingSystems,2nded.,byTanenbaum)CS-502Fall20061Inter-munication(IPC)mechanisms–.,Pipes&streamsSockets&municatingprocessesshareall,part,ornoneofanaddressspaceCS-502Fall20062Inter-monIPCmechanismsSharedmemory–read/.,shmget(),shmctl()inUnixMemorymappedfilesinWinNT/2000NeedcriticalsectionmanagementSemaphores–post_s()notifieswaitingprocessSharedmemoryornot,butsemaphoresneedtobesharedSoftwareinterrupts-processnotifiedasynchronouslysignal()Pipes-municationMessagepassing-processessendandreceivemessagesAcrossaddressspacesRemoteprocedurecall–processescallfunctionsinotheraddressspacesSameordifferentmachinesCS-502Fall20063Inter-.,.,allprocessesofsomeoperatingsystemseCos,PilotCriticalsectionmanagementSemaphores(orequivalent)Monitors(seelater)CS-502Fall20064Inter-municationSharedMemory(continued).,Unix,Linux,.,shmget(),shmctl()inUnixMemorymappedfilesinWindowsXP/2000,ApolloDOMAIN,,veryhardtoprogram!NeedcriticalsectionmanagementamongprocessesPointersareanissueCS-502Fall20065Inter-municationIPC–-processactivitiesinterruptprocessesAsynchronous!StopsexecutionthenrestartsKeyboarddriven–-CAnalarmscheduledbytheprocessexpiresUnix:SIGALRMfromalarm()orsettimer()resourcelimitexceeded(diskquota,CPUtime...)programmingerrors:invaliddata,dividebyzero,-502Fall20066Inter-municationSoftwareInterrupts(continued)SendInterrupt(pid,num)Sendsignaltypenumtoprocesspid,kill()inUnix(NTdoesn’tallowsignalstoprocesses)HandleInterrupt(num,handler)typenum,usefunctionhandlersignal()inUnixUseexceptionhandlerinWinNT/2000Typicalhan