Go to main content

STREAMS Programming Guide

Exit Print View

Updated: November 2020
 
 

What Is STREAMS?

STREAMS is a flexible programming model for UNIX system communication services. STREAMS defines standard interfaces for character input/output (I/O) within the kernel, and between the kernel and the rest of the UNIX system. The mechanism consists of a set of system calls, kernel resources, and kernel routines.

STREAMS enables you to create modules to provide standard data communications services and then manipulate the modules on a stream. From the application level, modules can be dynamically selected and interconnected. No kernel programming, compiling, and link editing are required to create the interconnection.

STREAMS provides an effective environment for kernel services and drivers requiring modularity. STREAMS is similar to the layering model in networking protocols. For example, STREAMS is suitable for:

  • Implementing network protocols

  • Developing character device drivers

  • Developing network controllers (for example, for an Ethernet card)

  • I/O terminal services

The fundamental STREAMS unit is the stream. A stream is a full-duplex bidirectional data-transfer path between a process in user space and a STREAMS driver in kernel space. A stream has three parts: a stream head, zero or more modules, and a driver.

Figure 1  Simple Stream

image:Diagram shows the basic components of a stream.