Nothing Special   »   [go: up one dir, main page]

CN116521249A - Kernel state message distribution method based on process file descriptor - Google Patents

Kernel state message distribution method based on process file descriptor Download PDF

Info

Publication number
CN116521249A
CN116521249A CN202310801503.8A CN202310801503A CN116521249A CN 116521249 A CN116521249 A CN 116521249A CN 202310801503 A CN202310801503 A CN 202310801503A CN 116521249 A CN116521249 A CN 116521249A
Authority
CN
China
Prior art keywords
distribution
data block
driver
data
kernel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310801503.8A
Other languages
Chinese (zh)
Other versions
CN116521249B (en
Inventor
魏志峰
王存友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zuojiang Technology Co ltd
Original Assignee
Beijing Zuojiang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zuojiang Technology Co ltd filed Critical Beijing Zuojiang Technology Co ltd
Priority to CN202310801503.8A priority Critical patent/CN116521249B/en
Publication of CN116521249A publication Critical patent/CN116521249A/en
Application granted granted Critical
Publication of CN116521249B publication Critical patent/CN116521249B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to a kernel mode message distribution method based on a process file descriptor, belonging to the field of operating systems. In order to solve the problem that the processing method of a single service process is low in efficiency, and the working efficiency is affected by adopting a mode that one main process corresponds to a plurality of sub-processes, in a kernel mode, a device distribution driver distributes a unique distribution ID for each service process and stores the unique distribution ID in a service process file descriptor, and the distribution ID is bound with the service process; when a data block is transmitted, the device distribution driver encapsulates the distribution ID in the data block; after the special data processing FPGA processes the data blocks, keeping the distribution ID field unchanged, and returning the data blocks to the equipment distribution driver; the device distribution driver extracts the distribution ID in the data block, matches the file descriptor of the business process, and feeds the data block into the corresponding business process. The invention cancels the user state main process, avoids inter-process communication, shortens the data block transmission link and obviously improves the performance.

Description

Kernel state message distribution method based on process file descriptor
Technical Field
The invention belongs to the technical field of operating systems, and particularly relates to a kernel mode message distribution method based on a process file descriptor.
Background
The special data processing device operates in a calling mode and the service process starts data block transmission. After the service process is started, calling equipment drive, and sending the data block to be processed to a special data processing FPGA; the device driver acquires the processed data block and returns the data block to the service process, and the service process stores or checks the received data block. And after the business process finishes processing the data block, continuing to process the next data block until all the data are processed.
With the popularization of security devices, the performance requirements on special data processing devices are higher and higher; the single service process processing method can process the next data block only after one data block is processed, and has low efficiency and cannot meet the performance requirement.
In the prior art, a mode that one main process corresponds to a plurality of sub-processes is adopted, the main process is responsible for receiving a data block, and then the data block is distributed to each sub-process according to a preset distribution algorithm. The processing mode increases the communication data volume between the main process and the sub process, and all data blocks are distributed through the main process to have performance bottlenecks, so that the working efficiency of the special data processing equipment is affected.
Disclosure of Invention
First, the technical problem to be solved
The technical problem to be solved by the invention is how to provide a kernel mode message distribution method based on a process file descriptor, so as to solve the problems that the efficiency of a single service process processing method is low, performance requirements cannot be met, performance bottlenecks exist in a mode that one main process corresponds to a plurality of sub-processes, and the working efficiency of special data processing equipment is affected.
(II) technical scheme
In order to solve the technical problems, the invention provides a kernel mode message distribution method based on a process file descriptor, which comprises the following steps:
s1, service process initialization
Before data block transmission, a plurality of service processes are created according to actual service demands, when the service processes are started, equipment distribution drivers are opened, an operating system creates process control blocks, corresponding file descriptors are created to describe target equipment, and the file descriptors are stored in the process control blocks corresponding to the current service processes; the device distribution driver distributes available and unique distribution IDs for the current service process, and stores the distribution IDs in file descriptors of the service process, so that a binding relation between the distribution IDs and the service process is established;
s2, data transmission process
The service process reserves X bytes at the head of the data block and sends the data block to the equipment distribution driver, the equipment distribution driver acquires a corresponding file descriptor from a process control block of the current service process, extracts a distribution ID, encapsulates the distribution ID in a reserved field of the data block and sends the distribution ID to the special data processing FPGA; the FPGA processes the data blocks and returns the processed data blocks to the equipment for distributing and driving;
s3, data receiving and distributing process
After the device distribution driver receives the data block, extracting a distribution ID in the data block, searching a corresponding relation according to the distribution ID, matching a file descriptor of a corresponding service process, waking up the service process and sending the data into a service process user state storage space.
Further, the business process is in a user state.
Further, the device distribution driver is in kernel mode.
Further, the file descriptor is accessed by the device distribution driver and stores device driver private data.
Further, the distribution ID is unique and once assigned, is no longer used by other processes.
Further, the file descriptor exists only in the kernel mode, the device distribution drive can sense and can access, and the business process does not sense the existence of the distribution ID.
Further, when the device distribution driver distributes the distribution ID for the service process, a corresponding relation table of the distribution ID and the service process file descriptor is established and stored in a data structure of the device distribution driver.
Further, in step S3, after the device distribution driver receives the data block, the device distribution driver extracts the distribution ID in the data block, searches the corresponding relationship table according to the distribution ID, and matches the corresponding business process file descriptor.
Further, in the step S2, x=4.
Further, in the step S2, the distribution ID field is kept unchanged when the FPGA processes the data block.
(III) beneficial effects
The invention provides a kernel mode message distribution method based on a process file descriptor, in kernel mode, a device distribution driver distributes unique distribution ID for each service process and stores the unique distribution ID in the service process file descriptor, so that the distribution ID is bound with the service process; when a data block is transmitted, the device distribution driver encapsulates the distribution ID in the data block; after the special data processing FPGA processes the data blocks, keeping the distribution ID field unchanged, and returning the data blocks to the equipment distribution driver; the device distribution driver extracts the distribution ID in the data block, matches the file descriptor of the business process, and feeds the data block into the corresponding business process.
Compared with the prior art, the technical scheme provided by the invention has the advantages that the file descriptors of the service processes are used for storing the distribution IDs in the kernel state, the service processes are matched through the distribution IDs, the user state main process is canceled, the inter-process communication is avoided, the design is simplified, the data block transmission link is shortened, and the performance is obviously improved.
Drawings
FIG. 1 is a prior art block processing flow;
FIG. 2 is an initialization flow of the present invention;
FIG. 3 is a data transmission flow of the present invention;
fig. 4 is a data receiving flow of the present invention.
Detailed Description
To make the objects, contents and advantages of the present invention more apparent, the following detailed description of the present invention will be given with reference to the accompanying drawings and examples.
The invention provides a kernel state distribution mechanism based on a process file descriptor, which omits a user state main process, avoids performance loss caused by inter-process communication, simplifies design and improves the working efficiency of special data processing equipment.
S1, service process initialization
Before data block transmission, firstly, creating a plurality of business processes in a user mode according to actual business requirements. When the business process is started, the device distribution driver is opened, the operating system creates a process control block, and creates a corresponding file descriptor to describe the target device, wherein the file descriptor is stored in the process control block corresponding to the current business process. The device distribution driver distributes available and unique distribution IDs for the current service process in a kernel mode, and stores the distribution IDs in file descriptors of the service process, so that a binding relation between the distribution IDs and the service process is established.
As shown in fig. 1, when each business process opens a device distribution driver, the operating system creates a corresponding file descriptor, where the file descriptor corresponds to the business process of the device distribution driver one by one, and the file descriptor is accessible to the device distribution driver and can store private data of the device distribution driver.
The device distribution driver distributes available and unique distribution IDs for the current service process in a kernel mode, and stores the distribution IDs in file descriptors of the service process, so that a binding relation between the distribution IDs and the service process is established; the distribution ID is unique and once assigned, is no longer available to other processes. Because the file descriptor only exists in the kernel mode, the device distribution driver is perceivable and accessible, the user mode business process does not perceive the existence of the distribution ID, and when the device distribution driver is used, the business process does not need to be independently adapted.
When the device distribution driver distributes the distribution ID for the service process, a corresponding relation table of the distribution ID and the service process file descriptor is established and stored in a data structure of the device distribution driver.
S2, data transmission process
The business process reserves X bytes at the head of the data block and sends the data block to the device distribution driver; in one embodiment, x=4; the device distribution driver acquires a corresponding file descriptor from a process control block of the current service process, extracts a distribution ID, encapsulates the distribution ID in a reserved field of a data block, and sends the distribution ID to a special data processing FPGA. The distribution ID field is kept unchanged while the dedicated data processing FPGA processes the data block. And the special data processing FPGA processes the data blocks and returns the processed data blocks to the device distribution drive.
S3, data receiving and distributing process
After the device distribution driver receives the data block, the device distribution driver extracts the distribution ID in the data block, searches the corresponding relation table according to the distribution ID, matches the corresponding business process file descriptor, wakes up the business process and sends the data into the business process user state storage space.
In the kernel mode, the device distribution driver distributes a unique distribution ID for each service process and stores the unique distribution ID in the service process file descriptor, so that the distribution ID is bound with the service process; when a data block is transmitted, the device distribution driver encapsulates the distribution ID in the data block; after the special data processing FPGA processes the data blocks, keeping the distribution ID field unchanged, and returning the data blocks to the equipment distribution driver; the device distribution driver extracts the distribution ID in the data block, matches the file descriptor of the business process, and feeds the data block into the corresponding business process.
Compared with the prior art, the technical scheme provided by the invention has the advantages that the file descriptors of the service processes are used for storing the distribution IDs in the kernel state, the service processes are matched through the distribution IDs, the user state main process is canceled, the inter-process communication is avoided, the design is simplified, the data block transmission link is shortened, and the performance is obviously improved.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.

Claims (10)

1. The kernel mode message distribution method based on the process file descriptor is characterized by comprising the following steps:
s1, service process initialization
Before data block transmission, a plurality of service processes are created according to actual service demands, when the service processes are started, equipment distribution drivers are opened, an operating system creates process control blocks, corresponding file descriptors are created to describe target equipment, and the file descriptors are stored in the process control blocks corresponding to the current service processes; the device distribution driver distributes available and unique distribution IDs for the current service process, and stores the distribution IDs in file descriptors of the service process, so that a binding relation between the distribution IDs and the service process is established;
s2, data transmission process
The service process reserves X bytes at the head of the data block and sends the data block to the equipment distribution driver, the equipment distribution driver acquires a corresponding file descriptor from a process control block of the current service process, extracts a distribution ID, encapsulates the distribution ID in a reserved field of the data block and sends the distribution ID to the special data processing FPGA; the FPGA processes the data blocks and returns the processed data blocks to the equipment for distributing and driving;
s3, data receiving and distributing process
After the device distribution driver receives the data block, extracting a distribution ID in the data block, searching a corresponding relation according to the distribution ID, matching a file descriptor of a corresponding service process, waking up the service process and sending the data into a service process user state storage space.
2. The method for distributing kernel-mode messages based on process file descriptors according to claim 1, wherein the business process is located in a user mode.
3. The method for distributing a kernel-mode message based on a process file descriptor according to claim 1, wherein the device distribution driver is located in a kernel mode.
4. The method for distributing a kernel-mode message based on a process file descriptor according to claim 1, wherein the file descriptor is accessed by a device distribution driver and stores device driver private data.
5. The method for distributing a kernel-mode message based on a process file descriptor according to claim 1, wherein the distribution ID is unique and once assigned, the distribution ID is not used by other processes.
6. The method for distributing kernel-mode messages based on process file descriptors as claimed in claim 5, wherein the file descriptors are only in kernel mode, the device distribution drive is aware of and accessible, and the business process does not perceive the existence of the distribution ID.
7. The method for distributing kernel-mode messages based on process file descriptors as recited in claim 5, wherein when the device distribution driver distributes a distribution ID for the service process, a corresponding relation table of the distribution ID and the service process file descriptors is established and stored in a data structure of the device distribution driver.
8. The method for distributing kernel-mode messages based on process file descriptors as claimed in claim 7, wherein in said step S3, after the device distribution driver receives the data block, the device distribution driver extracts the distribution ID in the data block, searches the corresponding relation table according to the distribution ID, and matches the corresponding process file descriptors.
9. The method for distributing kernel-mode messages based on process file descriptors according to claim 1, wherein in said step S2, x=4.
10. The method for distributing a kernel-mode message based on a process file descriptor according to claim 1, wherein in step S2, the FPGA keeps the distribution ID field unchanged when processing the data block.
CN202310801503.8A 2023-07-03 2023-07-03 Kernel state message distribution method based on process file descriptor Active CN116521249B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310801503.8A CN116521249B (en) 2023-07-03 2023-07-03 Kernel state message distribution method based on process file descriptor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310801503.8A CN116521249B (en) 2023-07-03 2023-07-03 Kernel state message distribution method based on process file descriptor

Publications (2)

Publication Number Publication Date
CN116521249A true CN116521249A (en) 2023-08-01
CN116521249B CN116521249B (en) 2023-10-10

Family

ID=87390641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310801503.8A Active CN116521249B (en) 2023-07-03 2023-07-03 Kernel state message distribution method based on process file descriptor

Country Status (1)

Country Link
CN (1) CN116521249B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591448A (en) * 2023-11-21 2024-02-23 山东华翼微电子技术股份有限公司 FPGA xdma driving method supporting multiple processes

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106603376A (en) * 2016-12-14 2017-04-26 东软集团股份有限公司 Message processing method and virtual private network SSLVPN server
CN106850565A (en) * 2016-12-29 2017-06-13 河北远东通信系统工程有限公司 A kind of network data transmission method of high speed
CN107797848A (en) * 2016-08-29 2018-03-13 华为数字技术(苏州)有限公司 Process scheduling method, device and host device
US10915335B1 (en) * 2016-12-29 2021-02-09 Virtuozzo International Gmbh System and method for intercepting data flow between computer process and system resource
WO2021109275A1 (en) * 2019-12-05 2021-06-10 广东省新一代通信与网络创新研究院 Fpga device-based network-defined storage method, reading method and system
CN114691390A (en) * 2022-03-07 2022-07-01 阿里巴巴(中国)有限公司 User mode program processing method and device, storage medium and processor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797848A (en) * 2016-08-29 2018-03-13 华为数字技术(苏州)有限公司 Process scheduling method, device and host device
CN106603376A (en) * 2016-12-14 2017-04-26 东软集团股份有限公司 Message processing method and virtual private network SSLVPN server
CN106850565A (en) * 2016-12-29 2017-06-13 河北远东通信系统工程有限公司 A kind of network data transmission method of high speed
US10915335B1 (en) * 2016-12-29 2021-02-09 Virtuozzo International Gmbh System and method for intercepting data flow between computer process and system resource
WO2021109275A1 (en) * 2019-12-05 2021-06-10 广东省新一代通信与网络创新研究院 Fpga device-based network-defined storage method, reading method and system
CN114691390A (en) * 2022-03-07 2022-07-01 阿里巴巴(中国)有限公司 User mode program processing method and device, storage medium and processor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591448A (en) * 2023-11-21 2024-02-23 山东华翼微电子技术股份有限公司 FPGA xdma driving method supporting multiple processes

Also Published As

Publication number Publication date
CN116521249B (en) 2023-10-10

Similar Documents

Publication Publication Date Title
CN112788074B (en) Data transmitting method, processing method, receiving method, apparatus thereof, and storage medium
CN116521249B (en) Kernel state message distribution method based on process file descriptor
CN101222374B (en) System, device and method for implementing service upgrade
CN103338230B (en) A kind of processing method of business datum and system
CN108055311B (en) HTTP asynchronous request method, device, server, terminal and storage medium
CN102012899A (en) Method, system and equipment for updating data
US20030158883A1 (en) Message processing
CN107741884B (en) Method and device for realizing message pushing by hierarchical state machine
CN109918203A (en) Access server memory management optimization method, access server and communication system
CN110333916A (en) Request message processing method, device, computer system and readable storage medium storing program for executing
CN114465770A (en) Data processing method and related device
CN103581846A (en) User business card updating method and system
US11265807B2 (en) Method for network sharing on a terminal, apparatus, air conditioner and storage medium
CN112559223A (en) Message sending method, device, equipment and computer readable storage medium
CN101951361B (en) Method for accessing intelligent card and server
CN111782399B (en) UDP-based efficient realization method for configuration server
CN104333515A (en) Method and device for processing SWIFT messages
CN114430392A (en) Method and terminal for connecting Intel network card with Switch to expand internet access
CN114138895A (en) Data synchronization method and device for multiple data sources, computer equipment and storage medium
CN210005883U (en) Intelligent micro-grid communication module and intelligent micro-grid system
CN113852669A (en) Efficient container cluster deployment method suitable for various network environments
CN114598662A (en) Message queue cluster federal management system and method
CN102118256A (en) Method for acquiring simple network management protocol (SNMP) data and equipment-side device
CN113114737B (en) Information sending method and device and server
CN101651937A (en) Dynamic content distribution (DCD) service transfer method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant