munication (IPC)
CS-502 Operating SystemsFall 2006
(Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne and from Modern Operating Systems, 2nd ed., by Tanenbaum)
CS-502 Fall 2006
1
Inter-munication
munication
Wide Variety of munication (IPC) mechanisms – .,
Pipes & streams
Sockets & Messages
Remote Procedure Call
Shared memory techniques
OS dependent
Depends on whether municating processes share all, part, or none of an address space
CS-502 Fall 2006
2
Inter-munication
Common IPC mechanisms
Shared memory – read/write to shared region
., shmget(), shmctl() in Unix
Memory mapped files in WinNT/2000
Need critical section management
Semaphores – post_s() notifies waiting process
Shared memory or not, but semaphores need to be shared
Software interrupts - process notified asynchronously
signal ()
Pipes - unidirectional munication
Message passing - processes send and receive messages
Across address spaces
Remote procedure call – processes call functions in other address spaces
Same or different machines
CS-502 Fall 2006
3
Inter-munication
Shared Memory
Straightforward if processes already share entire address space
., threads of one processes
., all processes of some operating systems
eCos, Pilot
Critical section management
Semaphores (or equivalent)
Monitors (see later)
CS-502 Fall 2006
4
Inter-munication
Shared Memory (continued)
More difficult if processes inherently have independent address spaces
., Unix, Linux, Windows
Special mechanisms to share a portion of virtual memory
., shmget(), shmctl() in Unix
Memory mapped files in Windows XP/2000, Apollo DOMAIN, etc.
Very, very hard to program!
Need critical section management among processes
Pointers are an issue
CS-502 Fall 2006
5
Inter-munication
IPC – Software Interrupts
Similar to hardware interrupt.
Processes interrupt each other
Non-process activities interrupt processes
Asynchronous! Stops execution then restarts
Keyb
munication (IPC) 来自淘豆网www.taodocs.com转载请标明出处.