Package com.lts.ipc

A package that supports interprocess communications.

See:
          Description

Class Summary
IPCPackage  
Utils An internal class that provides utility methods common to IPC classes.
 

Enum Summary
IPCException.Errors  
 

Exception Summary
IPCException A problem occurred while trying to use an IPC mechanism.
 

Package com.lts.ipc Description

A package that supports interprocess communications.

Table of Contents

Introduction

This package documents the CLIP library (com.lts.ipc). CLIP provides support for communication primitives that do not exist in the JRE, such as semaphores and named pipes, or improve support for primitives that exist but may not be as clear, such as shared memory.

Named Pipes

Named Pipes also refer to FIFOs or Message Queues. In the context of CLIP, a named pipe is an one-way IPC mechanism that appears on the underlying file system.

In terms of speed and bandwith, named pipes appear to fall somewhere between sockets and shared memory.

The underlying mechanism may or may not directly use the file created by this class. On Linux, for example, the file is the actual named pipe --- a FIFO. On Windows, the file is the logical name for the named pipe. The actual name exists in a Windows specific namespace.

Semaphores

A CLIP Semaphore is the traditional synchronization primitive that allow processes to signal each other. The CLIP implementation is an "n-ary" semaphore that also a file for use in allowing processes to identify the semaphore.

CLIP semaphores appear to be the faster than the other primitives in terms of synchronization, but of course do not provide any data exchange beyond that.

Shared Memory

The SharedMemory class is a more user-friendly implementation of the JRE mechanism for accessing shared memory: RandomAccessFile, FileChannel and MappedByteBuffer.

Should the JRE classes end up using some other mechanism that is unstuitable for for IPC, the intention is to change the CLIP version so that it keeps supporting shared memory.

CLIP shared memory appears to have the greatest bandwidth of all the CLIP IPC mechanisms.

CLIP shared memory exploits the underlying JRE support for synchronization via file locking to provide synchronization. This implementation appears to be roughly equal to the speed of named pipes and sockets, but significantly slower than that provided by semaphores.

Sockets

The CLIP com.lts.ipc.socket package is a collection of utilities for use with regular JRE sockets. CLIP does not try to provide a replacement for JRE sockets since they are good enough as is.

File Naming

CLIP uses files and file names to allow processes to identify instances of various IPC mechanisms that do not have a standard means for such identification across supported platforms. When creating an instance of Semaphore or NamedPipe, for example, the developer supplies a file name to identify it.

The idea is that all processes that use the same file name will be connected to the same mechanism. Two processes that both use "/foo/bar" as the name with the Semaphore class, for example, will be connected to the same semaphore.

The use of file names is functional as well as symbolic. On Linux and Windows, the name supplied is created and populated with the underlying name or handle that is used to access the primitive.

For example, on Windows the file name provided for a shared queue will contain the actual name that windows uses to identify the queue. For semaphores, the Windows file will contain an integer value that is passed to semaphore-related operations to identify the semaphore being operated on.

The manner in which files are used is similar to the way that shared memory operates.

See Also:
com.lts.ipc.namedpipe.NamedPipe, Semaphore, SharedMemory