Shared memory

Поиск
Список
Период
Сортировка
От Thomas Hallgren
Тема Shared memory
Дата
Msg-id 4423CF32.3060406@tada.se
обсуждение исходный текст
Ответы Re: Shared memory  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Worthwhile optimisation of position()?
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: pgNixInstaller: Making PostgreSQL relocatable