Unit- IV. Inter-process Communication:. Contents:. Inter-Process Communication Process Tracing Pipes Sockets System V IPC Multiprocessor systems. IPC:. Independent processes & co-operating processes Communicating two processes related or unrelated. Purposes for IPC Information Sharing
- child must allow tracing explicitly by invoking ptrace; - parent can control the execution of its direct children only; - extremely inefficient (requires several context switches); - cannot control a process already running;
- security problems when tracing a setuid programs (user can obtain super user privileges) – to avoid this UNIX disables tracing such programs;
Fig 6-1 Data flow through a pipe.
- ptr to 1st and last msg on linked list
- no of msg & total no of data byte on linked list
- max no of bytes of data byte on linked list
- process id of last process
- timestamp of last system call
When msgget called
search msg queue to find id with given key
if no entry
allocate new queue struct
check permission & return
Shared Memory :
if entry present & permission
return descriptor for entry
if no entry & IPC_CREAT flag
verify size & allocate region using allocreg
saves permission modes, size, ptr to region table
allocate mem when attach region
addr- address returned by shmat
id-shared mem table entry
cmd- type of operation
shmstatbuf-address of user level structure that contain status information
In uniprocessor Unix system integrity of kernel data structure is maintained by two policies.
Solutions with semaphore :
Operations on semaphores:
Following sequence protects a resource
Multiprocessor algorithm wait
search all child process;
if (status of child is zombie)
P(zombie_semaphore); /* initialized to 0*/
1: Master – slave
1: Increased memory contention in h/w .
2: Wait longer period of time to gain semaphore.
3: Master processor becomes bottleneck.