IP Library Granted Patent US 11,216,320
Granted Patent B2
US 11,216,320 · App. 16/714,522 · Granted Jan 4, 2022

Method and apparatus for communication between processes

Inventors: Bin Wang (Hangzhou, CN); Liangliang Zhu (Hangzhou, CN); Xu Zeng (Hangzhou, CN); Lingjun Chen (Hangzhou, CN); Zilong Liu (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F9/546H04L49/90H04L69/22H04L67/12
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 11,216,320
App. No.
16/714,522
Granted
Jan 4, 2022
Kind
B2
Abstract

Methods and an apparatus for communication between processes are provided. A first process obtains an original message to be sent, where the original message includes a message header and a message body. The first process determines the length of the message header and the length of the message body of the original message to be sent. The first process compresses the length of the message header according to the length of the message header and the length of the message body to obtain a compressed message. The first process adds the compressed message to a message queue pre-created for a second process, where the second process is configured to obtain the compressed message from the message queue.

Claims (74)

1. A method, comprising:

obtaining, by a first process, an original message to be sent, the original message including a message header and a message body;

determining, by the first process, a length of the message header and a length of the message body of the original message to be sent;

compressing, by the first process, the length of the message header according to the length of the message header and the length of the message body to obtain a compressed message, wherein compressing, by the first process, the length of the message header to the target length includes:

setting, by the first process, the length of the message header to a target length; and

setting, by the first process, one or more values of one or more specific bits of the message header according to the target length, and using remaining bits excluding the one or more specific bits of the message header to indicate the length of the message body; and

adding, by the first process, the compressed message to a message queue pre-created for a second process, wherein the second process is configured to obtain the compressed message from the message queue.

2. The method of claim 1 , wherein compressing, by the first process, the length of the message header according to the length of the message header and the length of the message body to obtain the compressed message further includes:

determining, by the first process, a target bit number, wherein the target bit number is a number of bits of a target bit sequence, and the target bit sequence is a shortest bit sequence indicating the length of the message body;

determining, by the first process, the target length according to the target bit number; and

compressing, by the first process, the length of the message header to the target length.

3. The method of claim 2 , wherein the length of the message header is 4, and determining, by the first process, the target length according to the target bit number includes:

setting the target length to 1 if the target bit number is less than or equal to 7;

setting the target length to 2 if the target bit number is greater than 7 and less than or equal to 14;

setting the target length to 3 if the target bit number is greater than 14 and less than or equal to 21; and

setting the target length to 4 if the target bit number is greater than 21 and less than or equal to 29.

4. The method of claim 3 , wherein setting, by the first process, the one or more values of the one or more specific bits of the message header according to the target length, and using the remaining bits excluding the one or more specific bits of the message header to indicate the length of the message body includes:

setting a first bit of the message header to 0, and using last 7 bits of the message header to indicate the length of the message body, if the target length is 1;

setting a first bit of a first byte of the message header to 1 and setting a second bit of the first byte to 0, and using values of last 6 bits of the first byte and all bits of a second byte to indicate the length of the message body, if the target length is 2;

setting the first bit of the first byte of the message header to 1, setting the second bit of the first byte to 1, and setting a third bit of the first byte to 0, and using values of last 5 bits of the first byte and all bits of the second byte and the third byte to indicate the length of the message body, if the target length is 3; and

setting the first bit of the first byte of the message header to 1, setting the second bit of the first byte to 1, and setting the third bit of the first byte to 1, and using values of the last 5 bits of the first byte and all bits of the second byte, the third byte, and a fourth byte to indicate the length of the message body, if the target length is 4.

5. The method of claim 1 , wherein the length of the message header is a byte length of the message header, and the length of the message body is a byte length of the message body.

6. A computer-readable medium storing computer-readable instructions executable by one or more processors, that when executed by the one or more processors, causes the one or more processors to perform acts comprising:

determining, by a second process, a length of a message header of a compressed message, wherein the compressed message includes a message header and a message body, wherein determining, by the second process, the length of the message header of the compressed message includes:

reading, by the second process, one or more values of one or more bits one by one from the message queue until the one or more values of the read bits satisfy a preset condition; and

determining, by the second process, the length of the message header of the compressed message according to the one or more values of the read bits, when the one or more values of the read bits satisfy the preset condition;

reading, by the second process, the message header of the compressed message from a message queue pre-created by a first process for the second process, according to the length of the message header of the compressed message;

determining, by the second process, the length of the message body according to the message header of the compressed message; and

reading, by the second process, a content with a corresponding length from the message queue as the message body according to the length of the message body.

7. The computer-readable medium of claim 6 , wherein reading, by the second process, the message header of the compressed message from the message queue pre-created by the first process for the second process according to the length of the message header of the compressed message includes:

reading, by the second process, one or more values of a first number of bits from the message queue according to the length of the message header of the compressed message, wherein the first number is a number of bits corresponding to the length of the message header subtracting a number of bits read when the preset condition is satisfied; and

adding, by the second process, the one or more values of the first number of bits to one or more values of the bits read when the preset condition is satisfied as the message header of the compressed message.

8. The computer-readable medium of claim 6 , wherein determining, by the second process, the length of the message body according to the message header of the compressed message includes:

determining, by the second process, the length of the message body according to one or more values of one or more specific bits of the message header of the compressed message.

9. The computer-readable medium of claim 8 , wherein determining, by the second process, the length of the message header of the compressed message according to the one or more values of the read bits when the one or more values of the read bits satisfy the preset condition includes:

determining, by the second process, the length of the message header as 1, if a value of a first bit is 0;

determining, by the second process, the length of the message header as 2, if the value of the first bit is 1 and a value of a second bit is 0;

determining, by the second process, the length of the message header as 3, if the value of the first bit is 1, the value of the second bit is 1, and a value of a third bit is 0; and

determining, by the second process, the length of the message header as 4, if the value of the first bit is 1, the value of the second bit is 1, and the value of the third bit is 1.

10. The computer-readable medium of claim 9 , wherein determining, by the second process, the length of the message body according to the one or more values of the one or more specific bits of the message header of the compressed message includes:

determining, by the second process, the length of the message body using values of last 7 bits of the message header, if the length of the message header is 1;

determining, by the second process, the length of the message body using values of last 6 bits of a first byte of the message header and values of all bits of a second byte, if the length of the message header is 2;

determining, by the second process, the length of the message body using values of last 5 bits of the first byte of the message header and values of all bits of the second byte and a third byte of the message header, if the length of the message header is 3; and

determining, by the second process, the length of the message body using the values of the last 5 bits of the first byte of the message header and values of all bits of the second byte, the third byte, and a fourth byte of the message header, if the length of the message header is 4.

11. The computer-readable medium of claim 6 , wherein the length of the message header is a byte length of the message header, and the length of the message body is a byte length of the message body.

12. An apparatus, comprising:

one or more processors,

memory, coupled to the one or more processors, the memory storing thereon computer-executable modules, executable by the one or more processors, the executable modules including:

a first process module and a second process module;

wherein the first process module includes:

an original message obtaining sub-module, configured to obtain an original message to be sent, wherein the original message including a message header and a message body;

a length determining sub-module, configured to determine a length of the message header and a length of the message body of the original message to be sent;

a message compression sub-module, configured to compress the length of the message header according to the length of the message header and the length of the message body to obtain a compressed message; and

a compressed message adding sub-module, configured to add the compressed message to a message queue pre-created for the second process module, wherein the message compression sub-module includes:

a target bit number determining unit, configured to determine a target bit number, wherein the target bit number is a number of bits of a target bit sequence, and the target bit sequence is a shortest bit sequence indicating the length of the message body; and

a target length determining unit, configured to determine a target length according to the target bit number; and

a message compression unit, configured to compress the length of the message header to the target length; and

wherein the second process module includes:

a compressed message obtaining sub-module, configured to obtain the compressed message from the message queue.

13. The apparatus of claim 12 , wherein the message compression unit includes:

a length setting subunit, configured to set the length of the message header to the target length; and

a bit setting subunit, configured to set one or more values value of one or more specific bits of the message header according to the target length, and using remaining bits excluding the one or more specific bits of the message header to indicate the length of the message body.

14. The apparatus of claim 13 , wherein the length of the message header is 4, and the target length determining unit includes:

a first target length determining subunit, configured to set the target length to 1 if the target bit number is less than or equal to 7;

a second target length determining subunit, configured to set the target length to 2 if the target bit number is greater than 7 and less than or equal to 14;

a third target length determining subunit, configured to set the target length to 3 if the target bit number is greater than 14 and less than or equal to 21; and

a fourth target length determining subunit, configured to set the target length to 4 if the target bit number is greater than 21 and less than or equal to 29.

15. The apparatus of claim 14 , wherein the bit setting subunit includes:

a first bit setting component, configured to set a first bit of the message header to 0, and use last 7 bits of the message header to indicate the length of the message body, if the target length is 1;

a second bit setting component, configured to set a first bit of a first byte of the message header to 1 and set a second bit of the first byte to 0, and use values of last 6 bits of the first byte and all bits of a second byte to indicate the length of the message body, if the target length is 2;

a third bit setting component, configured to set the first bit of the first byte of the message header to 1, set the second bit of the first byte to 1, and set a third bit of the first byte to 0, and use values of last 5 bits of the first byte and all bits of the second byte and a third byte to indicate the length of the message body, if the target length is 3; and

a fourth bit setting component, configured to set the first bit of the first byte of the message header to 1, set the second bit of the first byte to 1, and set the third bit of the first byte to 1, and uses the values of the last 5 bits of the first byte and all bits of the second byte, the third byte, and a fourth byte to indicate the length of the message body, if the target length is 4.

16. The apparatus of claim 12 , wherein the length of the message header is a byte length of the message header.

17. The apparatus of claim 12 , wherein, the length of the message body is a byte length of the message body.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075499/0384 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 17, 2021
From: ZHU, LIANGLIANG; CHEN, LINGJUN; LIU, ZILONG; WANG, BIN; ZENG, XU
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 055300/0814 →
Priority Claims (1)
CN 201710449251.1 · Jun 14, 2017 · national
Continuity (2)
Continuation PCTCN2018089929 · Jun 5, 2018
Related Publication 20200125430A1 · Apr 23, 2020