STREAMS Programming Guide

MultiThreaded (MT) STREAMS Overview

The SunOS 5 operating system is fully multithreaded, able to make effective use of the available parallelism of a symmetric shared-memory multiprocessor computer. All kernel subsystems are multithreaded: scheduler, virtual memory, file systems, block/character/STREAMS I/O, networking protocols, and device drivers.

MT STREAMS requires you to use some new concepts and terminology. These concepts apply not only to STREAMS drivers, but to all device drivers in the SunOS 5 system. For a more complete description of these terms, see Writing Device Drivers. Additionally, see Chapter 1, Overview of STREAMS of this guide for definitions and Chapter 8, Messages - Kernel Level for elements of MT drivers.

You need to understand the following terms and ideas.


Sequence of instructions executed within context of a process


Mechanism to restrict access to data structures

Single Threaded

Restricting access to a single thread


Allowing two or more threads access


Two or more CPUs concurrently executing the OS


Simultaneous execution


Suspending execution for the next thread to run


Portion of code that is single threaded

Mutual Exclusion

Exclusive access to a data element by a single thread at one time

Condition Variables

Kernel event synchronization primitives

Counting Semaphores

Memory based synchronization mechanism

Readers/Writer Locks

Data lock allowing one writer or many readers at one time


On specific event, call module function