Browse Prior Art Database

Inter process locking for multiple java virtual machines

IP.com Disclosure Number: IPCOM000015992D
Original Publication Date: 2002-Aug-16
Included in the Prior Art Database: 2003-Jun-21
Document File: 3 page(s) / 45K

Publishing Venue

IBM

Abstract

A program is disclosed that allows multiple Java* Virtual Machines (JVMs) to serialize access to data or other resources shared between them, where each JVM runs as a separate process containing multiple threads. The program is referred in this disclosure by the name "shared monitors".

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 47% of the total text.

Page 1 of 3

Inter process locking for multiple java virtual machines

A program is disclosed that allows multiple Java* Virtual Machines (JVMs) to serialize access to data or other resources shared between them, where each JVM runs as a separate process containing multiple threads. The program is referred in this disclosure by the name "shared monitors".

Problem statement:

    In a multi-JVM environment it is necessary for multiple JVMs (also referred to as a "JVM set") to obtain access to and manipulate data which is shared with other JVMs in the set. To prevent collisions and subsequent data corruption, it is necessary to provide a system of "shared monitors", with a programming interface that allows any member JVM to serialize access to such data.

The system has the following requirements:

  1. Shared monitors must provide mutual exclusion: given a shared resource accessed by multiple concurrent JVM processes and threads, at any time only one process and thread should be able to access the resource. A JVM process and thread granted a resource must release it before it can be granted to another process and thread.

  2. Shared monitors must be recoverable: if a JVM that has been granted a resource terminates prematurely while continuing to hold the resource the resource must released by the system for use by other JVMs.

3. Shared monitors must be available for use by any member of the JVM set.
4. JVMs which are not part of a JVM set must be allowed to use the shared monitor programming interface, without suffering performance degradation.

Design

    The program makes use of normal local (inter-thread) monitors in each JVM, as thread safety cannot be guaranteed by inter-process locking alone. The principal idea is that any JVM wishing to apply a global lock to a shared resource must first acquire a local monitor, then associate the local monitor with an inter-process lock, and acquire the inter-process lock. This process must be seen to be atomic by the JVM concerned. The use of a local monitor and a two phase lock ensures thread safety at the single-JVM level.

This design is based on the following assumptions:

  1. A JVM set consists of a Master JVM and one or more Worker JVMs. The Master JVM completes its initialization before any Worker JVMs are started.

2. Shared memory is available between the Master and Worker JVMs.
3. Monitor hierarchy is enforced by 'convention'.

    The Master JVM creates a finite group of pre-allocated global semaphores in a global table held in its own memory space. A unique name (or names) used to create these sempahores is passed to each Worker JVM in the JVM set. The Worker JVMs then each set up local tables of shared monitors, each of which has a local thread

1

Page 2 of 3

monitor and a reference to the global (cross-process) semaphore set up by the Master JVM. These monitors will then be available for use in any member of a JVM Set via predetermined indices. and a mechanism for associating them to local monitors using a common s...