next up previous top
Next: PortBinding
Up: Property
Previous: OpenMode

PipeType

Description

The PipeType property is used to further specify a Pipe connector in UniCon. It specifies the underlying mechanism that the UniCon compiler uses to implement the associated pipe in the system at run-time. There are two implementation mechanisms that the UniCon compiler can choose from. One is a nameless buffer inside the Unix kernel that is allocated with a call to the standard C library function pipe. The system designer selects this mechanism with the value unnamed in the PipeType property. The other mechanism is a fifo file, allocated with a call to either of the two routines mknod or mkfifo. The system designer selects this mechanism with the value named in the PipeType property.

Both an unnamed pipe buffer and a fifo file exhibit nearly identical behavior. They both are opened simultaneously for reading and writing. Both buffers are circular; when reading or writing beyond the end of the buffer, the read or write buffer pointer is reset to the beginning of the buffer and I/O continues if there is room left (when writing) or data left (when reading). Data is written to the buffer sequentially, and placed in the buffer immediately after previously written bytes. The write buffer pointer is advanced after each byte that is written. Data is read from the buffer sequentially, and the read buffer pointer is advanced after each byte that is read. Reader processes are suspended when there is no more data to be read from the buffer (i.e., both the read and write buffer pointers are in the same position in the buffer). The processes are resumed when data is written to the buffer. Writer processes are suspended when the buffer becomes full. The processes are resumed when data is read from the buffer. If all writer processes close their end of the buffer, the reader processes get the value EOF (end-of-file) during their next read operations. If all reader processes close their end of the buffer, the writer processes receive the SIGPIPE signal from the Unix operating system.

There are two main differences between the two mechanisms. The first is the size of the buffer. An unnamed pipe buffer in the Unix kernel ranges between 4K and 8K bytes, depending on the particular version of Unix. A fifo file is a named file in the file system, and therefore it has nearly unlimited size. Size is the distinctive characteristic for selecting a particular PipeType value. The second main difference is the way that the buffers are created. An unnamed buffer is created with the pipe function in the C standard library. Two file descriptors are returned to the application as a result of the call; they are both open - one for reading and one for writing. A named fifo file is created in the file system with either the mknod or mkfifo function in the C standard library (most Unix systems have the mknod function; only a few have the mkfifo function - the usage of both functions is nearly identical). Once the fifo file is created, it must be opened manually (i.e., using the open function in the C standard library) by both the reader processes and the writer processes. All reader processes will be suspended until at least one process opens the fifo file for writing, and vice versa.

Property Lists

The PipeType property can legally be specified in the property list in the following UniCon language elements:

Value Syntax

The syntax of the value part of the PipeType property is one of the two keywords named or unnamed, optionally enclosed in double-quotes, surrounded by parentheses. The case of the letters can be upper, lower, or mixed.

Required Rule

Optional

The default value for the PipeType property is named.

Merge Rule

REPLACE

Subsequent specifications of the PipeType property in a single property list replace earlier specifications (i.e., the last specification is the one that the UniCon compiler uses).

Semantic Checks

The value part of the PipeType property must be one of the two keywords named and unnamed.

Example

The following is an example of a specification of a PipeType property. It is embedded in the protocol of a Pipe connector definition:

  CONNECTOR Unix_Pipe
    PROTOCOL IS
      TYPE Pipe
      PIPETYPE (unnamed)
      ROLE Source IS Source
      ROLE Sink IS Sink
    END PROTOCOL
    IMPLEMENTATION IS
      BUILTIN
    END IMPLEMENTATION
  END Unix_Pipe
Below is another example of a specification of a PipeType property. It is embedded in an instantiation of the above Pipe connector:

  USES My_Pipe PROTOCOL Unix_Pipe
    PIPETYPE (named)
  END My_Pipe
The PipeType value named in the My_Pipe Pipe instantiation overrides the PipeType value unnamed in the Unix_Pipe Pipe definition.


next up previous top
Next: PortBinding
Up: Property
Previous: OpenMode

Comments? Mail the current maintainer of this page.

Author: Gregory Zelesnik

Last Modified: May 12, 1996