IP Library › Granted Patent US 9,658,879
Granted Patent B2
US 9,658,879 · App. 13/804,414 · Granted May 23, 2017

System and method for supporting buffer allocation in a shared memory queue

Inventors: Xianzheng Lv (Beijing, CN); Xiangdong Li (Beijing, CN); Pei Zhi Shi (Beijing, CN)
Assignee: ORACLE INTERNATIONAL CORPORATION
G06F9/466G06F3/0659G06F9/544G06F9/546G06F15/167G06F17/30289H04L67/02H04L67/10
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,658,879
App. No.
13/804,414
Granted
May 23, 2017
Kind
B2
Abstract

A system and method can support buffer allocation in a shared memory queue. The shared memory queue can be associated with a shared memory, to which one or more communication peers are attached. One or more processes can travel through a plurality of memory blocks in the shared memory, and can allocate one or more message buffers in the shared memory mutual exclusively. The allocated message buffers can be used to contain one or more messages for the one or more communication peers. Furthermore, a said process can allocate the message buffers based on an atomic operation on the memory block at the instruction level.

Claims (50)

1. A system for supporting lock free buffer allocation in a shared memory providing zero-copy message transfer between processes, the system comprising:

one or more microprocessors;

a plurality of processes running on the one or more microprocessors, the plurality of processes comprising an application client process and an application server process; and

a shared memory comprising a plurality of memory blocks and being operatively attached with the plurality of processes for sharing access to the shared memory by the plurality of processes, wherein each of the plurality of memory blocks stores a status word representative of an occupancy condition of the respective memory block;

wherein each of the application client and server processes operates concurrently with one or more other processes of the plurality of processes to:

using a lock free atomic operation:

find a free memory block of the plurality of memory blocks of the shared memory unoccupied by the one or more other processes of the plurality of processes by travelling through the shared memory and inspecting the status words of the memory blocks to locate, as the free memory block, a memory block having a status word representative of an unoccupied condition; and

allocate one or more shared memory message buffers in the shared memory for mutual-exclusive access relative to the one or more other processes of the plurality of processes by occupying the found free memory block and modifying the status word of the found free memory block to represent an occupied condition,

wherein the plurality of memory blocks are used to contain one or more shared memory messages for the plurality of processes to zero-copy communicate the one or more shared memory messages between the plurality of processes,

wherein the application client process zero-copy communicates a shared memory message received in an allocated shared memory message buffer with the application server process without copying the shared memory message outside of the shared memory by:

linking, by the application client process, the allocated shared memory message buffer storing the message with a request (RQ) shared memory queue (SHMQ) of the shared memory attached with the application server process; and

receiving the message by the application server process by delinkinq, by the application server process, the allocated shared memory message buffer from the RQ SHMQ.

2. The system according to claim 1 , wherein:

the allocated shared memory message buffer is configured to include a head structure and a linked list of messages.

3. The system according to claim 1 , wherein:

each of said one or more shared memory message buffers is pre-allocated with a fixed size, wherein at least one shared memory message buffer of said one or more shared memory message buffers can be shared by the plurality of processes.

4. The system according to claim 1 , wherein:

said plurality of processes operate to visit a second memory block in the shared memory, after detecting that the first memory block is occupied by another process.

5. The system according to claim 1 , wherein:

the atomic operation is a single instruction test-and-set (TAS) operation.

6. The system according to claim 5 , wherein:

the TAS operation checks a status word which indicates whether a memory block is free or occupied.

7. A method for supporting lock free buffer allocation in a shared memory providing zero-copy message transfer between processes, the method comprising:

attaching a plurality of processes comprising an application client process and an application serer process with a shared memory that comprises a plurality of memory blocks and is operatively attached with the plurality of processes for sharing access to the shared memory by the plurality of processes, wherein each of the plurality of memory blocks of the shared memory stores a status word representative of an occupancy condition of the respective memory block;

configuring each of the application client and server processes operated concurrently with one or more other processes of the plurality of processes to:

using a lock free atomic operation:

find a free memory block of the plurality of memory blocks of the shared memory unoccupied by the one or more other processes of the plurality of processes by travelling through the shared memory and inspecting the status words of the memory blocks to locate, as the free memory block, a memory block having a status word representative of an unoccupied condition; and

allocating, via the plurality of processes, one or more shared memory message buffers in the shared memory for mutual-exclusive access relative to the one or more other processes of the plurality of processes by occupying the found free memory block and modifying the status word of the found free memory block to represent an occupied condition,

wherein the plurality of memory blocks are used to contain one or more shared memory messages for the plurality of processes to zero-copy communicate the one or more shared memory messages between the plurality of processes,

wherein the application client process zero-copy communicates a shared memory message received in an allocated shared memory message buffer with the application server process without copying the shared memory message outside of the shared memory by:

linking, by the application client process, the allocated shared memory message buffer storing the message with a request (RQ) shared memory queue (SHMQ) of the shared memory attached with the application server process; and

receiving the message by the application server process by delinkinq, by the application server process, the allocated shared memory message buffer from the RQ SHMQ.

8. The method according to claim 7 , further comprising:

configuring the allocated shared memory message buffer to include a head structure and a linked list of messages.

9. The method according to claim 7 , further comprising:

pre-allocating each of said one or more shared memory message buffers is with a fixed size, wherein at least one shared memory message buffer of said one or more shared memory message buffers can be shared by the plurality of processes.

10. The method according to claim 7 , further comprising:

proceeding to visit a second memory block in the shared memory, after detecting that the first memory block is occupied by another process.

11. The method according to claim 7 , further comprising:

allowing the atomic operation to be a single instruction test-and-set (TAS) operation.

12. A non-transitory machine readable storage medium having instructions stored thereon that when executed cause a system to perform steps comprising:

attaching a plurality of processes comprising an application client process and an application serer process with a shared memory that comprises a plurality of memory blocks and is operatively attached with the plurality of processes for sharing access to the shared memory by the plurality of processes, wherein each of the plurality of memory blocks of the shared memory stores a status word representative of an occupancy condition of the respective memory block;

configuring each of the application client and server processes operated concurrently with one or more other processes of the plurality of processes to:

using a lock free atomic operation:

find a free memory block of the plurality of memory blocks of the shared memory unoccupied by the one or more other processes of the plurality of processes by travelling through the shared memory and inspecting the status words of the memory blocks to locate, as the free memory block, a memory block having a status word representative of an unoccupied condition; and

allocating, via the plurality of processes, one or more shared memory message buffers in the shared memory for mutual-exclusive access relative to the one or more other processes of the plurality of processes by occupying the found free memory block and modifying the status word of the found free memory block to represent an occupied condition,

wherein the plurality of memory blocks are used to contain one or more shared memory messages for the plurality of processes to zero-copy communicate the one or more shared memory messages between the plurality of processes,

wherein the application client process zero-copy communicates a shared memory message received in an allocated shared memory message buffer with the application server process without copying the shared memory message outside of the shared memory by:

linking, by the application client process, the allocated shared memory message buffer storing the message with a request (RQ) shared memory queue (SHMQ) of the shared memory attached with the application server process; and

receiving the message by the application server process by delinking, by the application server process, the allocated shared memory message buffer from the RQ SHMQ.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 17, 2013
From: LV, XIANZHENG; LI, XIANGDONG; SHI, PEI ZHI
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 030463/0146 →
Continuity (2)
Provisional Application 61612144 · Mar 16, 2012
Related Publication 20130246714A1 · Sep 19, 2013