PSL Shared Global Channels

PSL supports the use of shared global channels for communication between one process and another process or file.

Requirement for Shared Global Channels in PSL

In previous versions of PSL, channels were restricted to a single PSL process. Restricting a channel to a single process meant that each PSL process that wished to communicate with, or query to, an external process such as a database had to open its own channel. Opening a new channel for each caller heavily increased resource usage.

Another problem with the previous channel mechanism was that there was no way for one PSL process to open the channel and another PSL process to use it. The usual workaround was to do everything in one collector parameter that performed all queries and set the consumer parameter values. That method had the following limitations:

  • no way to have distinct poll times for the various consumers
  • no convenient way to deactivate queries that were deemed unnecessary

All the agent scheduling features were lost unless the KM developer could explicitly code the equivalent functionality into the collector's PSL code.

Implementation of PSL Shared Global Channels

The current version of PSL allows one PSL parameter to open a channel to an external process in an explicitly shared mode that allows any number of other PSL processes to send data to, and receive data from, the channel.

The ability to share channels also requires PSL to provide a mechanism for concurrent programming techniques. PSL provides these in the form of external synchronization primitives.

The primitives are preferable to building concurrency into the channel opening, reading, writing, and closing functions. For example, having each PSL process lock a shared channel explicitly prevents concurrent reading by one process and writing by another. In addition, having the synchronization primitives separate from channels allows them to be used to synchronize the use of any shared resource such as the Agent's internal symbol table or an external file.

The current implementation of the read(), readln(), and write() functions for shared channels will fail immediately (without blocking) if another PSL process is already blocked on the channel. The KM uses PSL locks and/or PSL condition variables to enforce the desired synchronization of shared channels.

Effect of PSL Shared Global Channel Mechanisms

The PSL functions ensure that all operations on a channel are serialized, with all PSL function calls appearing to be atomic. The PSL programmer can be assured that file channel reads and writes in different processes will take place atomically. The locks provided in PSL prevent unpredictable interleaving of sequences of PSL read and write calls to the channel.

The single exception to serialization on channels created using the popen() function is the allowance for a concurrent read and write operation. A read can occur when a write is pending on the channel, and a write can occur when a read is blocked or pending on the channel; thus, both a read and a write PSL process can be blocked on a shared channel.

File channels opened using the fopen() function can never cause a PSL read() or write() function to block. To enforce serialization, the second reader process cannot be blocked, nor can the second writer process be blocked; hence, the second PSL read(), readln(), and write() functions on a file channel will fail.

Where to go from here

Overview of PSL

Was this page helpful? Yes No Submitting... Thank you