agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
From: Thomas Hallgren <thomas@tada.se>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Shared memory
Date: Fri, 24 Mar 2006 11:51:30 +0100
Message-ID: <4423CF32.3060406@tada.se> (raw)

Hi,
I'm currently investigating the feasibility of an alternative PL/Java implementation that 
would use shared memory to communicate between a JVM and the backend processes. I would very 
much like to make use of the routines provided in shmem.c but I'm a bit uncertain how to add 
a segment for my own use.

The flow I have in mind is:

Initialization:
Initialization takes place when the first PL/Java function (or validator) of the first 
session since the postmaster was started is called. The initialization process will create a 
small segment that represents the JVM. It will also start the JVM which in turn will attach 
to this segment. The JVM uses a small JNI library for this.

Session connect:
Connect takes place when the first PL/Java function (or validator) of a session is called 
(after initialization of course if its the first session).

The backend creates (or obtains, if I decide to pool them) a communication buffer of fixed 
size in shared memory. This buffer is can only be used by this backend and the JVM. The 
backend notifies the JVM of its presence using the global segment created during initialization.


My questions are:
1. Do you see something right away that invalidates this approach?
2. Is using the shared memory functionality that the backend provides a good idea (I'm 
thinking shmem functions, critical sections, semaphores, etc.). I'd rather depend on them 
then having conditional code for different operating systems.
3. Would it be better if the Postmaster allocated the global segment and started the JVM 
(based on some config parameter)?

All ideas and opinions are very welcome.

Kind Regards,
Thomas Hallgren



view thread (22+ messages)  latest in thread

Message-ID: <4423CF32.3060406@tada.se>
Permalink:  ../4423CF32.3060406@tada.se/
Also on:    postgresql.org/message-id/4423CF32.3060406@tada.se

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Cc: thomas@tada.se, pgsql-hackers@postgresql.org
  Subject: Re: Shared memory
  In-Reply-To: <4423CF32.3060406@tada.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox