JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
STREAMS Programming Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Part I Application Programming Interface

1.  Overview of STREAMS

2.  STREAMS Application-Level Components

3.  STREAMS Application-Level Mechanisms

4.  Application Access to the STREAMS Driver and Module Interfaces

5.  STREAMS Administration

6.  Pipes and Queues

Part II Kernel Interface

7.  STREAMS Framework - Kernel Level

8.  STREAMS Kernel-Level Mechanisms

9.  STREAMS Drivers

10.  STREAMS Modules

11.  Configuring STREAMS Drivers and Modules

12.  Multithreaded STREAMS

Multithreaded (MT) STREAMS Overview

MT STREAMS Framework

STREAMS Framework Integrity

Message Ordering

MT STREAMS Perimeters

Inner Perimeters

Outer Perimeters

PERMOD Perimeter

Hot Perimeters

Defining Perimeter Types

Choosing a Perimeter Type

MT SAFE Modules and Drivers

MT SAFE Module

MT SAFE Driver

Routines Used Inside a Perimeter

qprocson/qprocsoff

qtimeout/qunbufcall

qwriter

qwait

Asynchronous Callback Functions

close() Race Conditions

Unloading a Module that Uses esballoc

Use of the q_next Field

MT SAFE Modules Using Explicit Locks

Constraints When Using Locks

Preserving Message Ordering

Preparing to Port

Porting to the SunOS 5 System

Sample Multithreaded Device Driver Using a Per Module Inner Perimeter

Sample Multithreaded Module With Outer Perimeter

13.  STREAMS Multiplex Drivers

Part III Advanced Topics

14.  Debugging STREAMS-based Applications

Part IV Appendixes

A.  Message Types

B.  Kernel Utility Interface Summary

C.  STREAMS-Based Terminal Subsystem

D.  STREAMS FAQ

Glossary

Index

Multithreaded (MT) STREAMS Overview

The SunOS 5 operating system is fully multithreaded, which means that it can 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 different concepts and terminology. These concepts apply not only to STREAMS drivers, but to all device drivers in the Oracle Solaris operating environment. 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, STREAMS Kernel-Level Mechanisms for elements of MT drivers.

Some of the multithreaded terms and ideas are.

Thread

Sequence of instructions executed within context of a process.

Lock

Mechanism to restrict access to data structures.

Single Threaded

Restricting access to a single thread.

Multithreaded

Allowing two or more threads access to a data element.

Multiprocessing

Two or more CPUs concurrently executing the Operating System.

Concurrency

Simultaneous execution.

Preemption

Suspending execution for the next thread to run.

Monitor

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.

Callback

On occurrence of a specific event, call a module function.

Synchronous Access

Only one thread is allowed in the perimeter. Upon return from a call the action is complete; when the thread is done, the job is done.

Asynchronous Access

Multiple threads are allowed in the perimeter. Upon return form a call there is no guarantee that the job is complete.

Perimeter Claim

A thread has synchronous access in the perimeter. The claim prevents subsequent synchronous access until the claim is released.

Exclusive Access

Calling a synchronous entry point in the perimeter.

Writer

A thread that has exclusive access to a perimeter.