CSC 325 Operating Systems with an Emphasis on UNIX

Chapter 4: Processes


Process Concepts

UNIX Process Image


Process Scheduling


Context Switch


Process Creation

Example Process Tree


Process Termination


Cooperating Processes


Producer-Consumer Problem


Threads


Types of threads


Interprocess Communication (IPC)

Provides a mechanism to allow processes to communicate and to synchronize their actions.


Implementation questions:


Direct Communication


Indirect Communication


Buffering - queue of messages attached to the link; implemented in one of three ways.


Exception Conditions - error recovery


Pipes

A pipe is a simple method for communicating between two processes.

UNIX Pipes

This section will deal with the simplest and most used interprocess communication (IPC) mechanism in UNIX, namely pipelines. A pipe is a one-way communication channel defined by two file descriptiors, one open for writing and one for reading, such that what is written by the former can be read by the latter. A pipe is created by passing and array of two integers to the pipe() system call. Note that the data flowing in a pipe are managed directly by the kernel, so you can think of them flowing "through'' the kernel.


A UNIX pipe.

Pipes make it nice for the sharing of file descriptors between parent and children. If you first open a pipe, and then spawn a child, parent and child will share the pipe's file descriptors as well, so you get the scenario depicted as follows:
A UNIX pipe after forking.