Eppley Institute for Cancer Research

University of Nebraska Medical Center

Home - Introduction - CommonTasks - Index - About

Inter-Beamish Process Communication

Background

The idea of allowing different instances of BEAM-ish to communicate with each came about as a solution to searching for symmetry related reflections and the associated ways in which to display this information to the user while still staying with in the BEAM-ish frame work.

The core process works by passing messages.  The message scheme is similar to that used by web servers and clients but runs on UNIX sockets instead of TCP/IP sockets.  More information is provide in on the page Interprocess Communication as Implemented in BEAM-ish.

There is a lot of flexibility in how the communication is setup and propagated.  There are two basic mode of operation.  The first Master-Slave has one instance as the Master sending commands to the Slaves.  The other instance is Peer-Peer.  In this mode all instance send messages and control each other.

How is it started?

When ever BEAM-ish starts up it will locate the socket directory and create a socket.  The name is based on the window handle integer.  If it is able to setup a socket it will next seek out other instances and announce its presence with the Ping Hello command.  Other instances reply with Ping Pong, if they get and properly interpret the message.  The following shows command window outputs from two instances of BEAM-ish.  These commands happen automatically when an instance is started or exited.

First Instance

The first sequence shows BEAM-ish starting up, finding the socket directory, creating its own socket.

Beamish: Version 1.2.024
Beamish: Initializing...
Beamish: Socket Directory Available
Beamish: Initializing Socket...........Done
Beamish: Socket (/usr/people/disk2/jjl/Beamish/sockets/.beamish_wID_83886091) Active

Next it announces its presence to all the other instances of BEAM-ish.  The first one it finds is a left over socket from an improperly terminated instance of BEAM-ish.  It determines the socket is invalid and asks the user if it should be deleted.  Next it finds itself. There are no more sockets so BEAM-ish finishes starting up.

Beamish: Testing Sockets in /usr/people/disk2/jjl/Beamish/sockets

Found .beamish_wID_88080395 Sent Ping... Got Error... Handled
Found .beamish_wID_83886091 Self
Testing Done(0)

Beamish: Ready!

This instance receives a remote command.  In this case a Hello Ping from another instance.  It determines that this command is originating from a new instance that was not around when this instance announced its presence so it adds the new instance to the list of known instances.  Finally, it replies with the Ping Pong response.  Then it recieves a Ping GoodBye command.  It replies with a Ping Pong response.  Behind the scenes it removes the instance that initiated the GoodBye from its list of known instances.

Beamish: Remote Command[Ping] Token[Hello]
Beamish: New socket detected and added to list.

 /usr/people/disk2/jjl/Beamish/sockets/.beamish_wID_88080395

Beamish: Remote Reply Command[Ping] Token[Pong]
Beamish: Remote Command[Ping] Token[GoodBye]
Beamish: Remote Reply Command[Ping] Token[Pong]

The user has finished with this instance and decides to exit.  First this instance Ping GoodByes all the other instances.  Next it closes down its socket.  Finally, it updates the beamish.ini file.

Beamish: Disconnecting from hosts...Done
Beamish: Killing Socket.......Done
Beamish: Writing beamish.ini
Beamish: Exiting Normally

Second Instance

The next sequence is for the second instance.

As with the first it has the same startup order.  During testing it first finds itself and then finds the instance from the above log.  You can see where it send the Ping Hello command and that it got the Ping Pong response.  It determined this instance is functioning normally.

Beamish: Version 1.2.024
Beamish: Initializing...
Beamish: Socket Directory Available
Beamish: Initializing Socket...........Done
Beamish: Socket (/usr/people/disk2/jjl/Beamish/sockets/.beamish_wID_88080395) Active
Beamish: Testing Sockets in /usr/people/disk2/jjl/Beamish/sockets

Found .beamish_wID_88080395 Self
Found .beamish_wID_83886091 Sent Ping... Got Pong... Ok
Testing Done(1)

Beamish: Ready!

The user has completed using this instance and exits.  It tells the other instances it is leaving with Ping GoodBye command.  The other instance see the command and replies.  Next this instance closes its socket.  Finally, it updates the beamish.ini file.

Beamish: Disconnecting from hosts...Done
Beamish: Killing Socket.......Done
Beamish: Writing beamish.ini
Beamish: Exiting Normally

Related Menu Commands

Once BEAM-ish successfully announces it presence to other instances the user can setup those instances for inter process communication.  This is accomplished with the commands under the IPC menu.  The following lists the menu commands along with a description of the function.

Command: Enable

This command toggles on/off inter-process communication.  When enabled it will enable the other commands in the IPC menu.

Command: Select Servers

This command displays a list of servers that can receive commands.  It they have a check next to them then this instance is sending commands to them.  Selecting a server from  the drop down list will toggle its status between send messages (checked) to not send (unchecked).

Command: Forward Selections

When this menu is checked all selections made by the user in this instances will be forwarded to selected servers.  The forwarded items are the selection of reflections, toggling filters, zoom window options.

Command: Forward Overlays

When this menu is checked all the image overlay options selected by the user will be forwarded to other instances.  This includes the overlay of reflections, beam center, sectors and rings.

Command: Distribute Processing

When this menu item is checked this enables instances to combine reflection information into a master report.  The report can be generated from the Generate Master Report command on the Tools menu.

Command: Collective Stats

When this menu item is checked this enables instances to generate symmetry related reflection data.

Master Slave Configuration

In Master Slave mode one instance of BEAM-ish forwards information to the others.  Information only travels in one direction.  This can be accomplished by first starting up all the instances of BEAM-ish that will participate in this group and opening a project in each one.  Select one to be the master.  On the master, enable IPC.  Select the other servers from the server list.  Finally enable the functions that should be sent to the other instances from the above list.

Peer to Peer Configuration

In Peer to Peer mode information travels from any server to any other server.  This mode can be obtained by setting every instance in the group as the master is setup above.