Disclosure of Invention
The invention aims to solve the technical problem of providing a multi-level mapping table interrupt source optical fiber data transmission method and device, which can effectively analyze data, quickly find a matching item in the multi-level mapping table, timely generate an interrupt source of a corresponding level, and execute a corresponding interrupt processing instruction according to the level and type of the interrupt source, thereby improving the efficiency and instantaneity of data processing.
In order to solve the technical problems, the technical scheme of the invention is as follows:
In a first aspect, a method for transmitting source optical fiber data by using a multistage mapping table, the method comprising:
Acquiring data transmitted to the node through an optical fiber;
Analyzing the data to obtain an address corresponding to the data;
Traversing items in a first-level mapping table in a multi-level mapping table one by one according to the addresses to obtain matching items, and traversing a next-level mapping table one by one according to the sequence if the matching items are not obtained until the matching items are obtained or traversing all mapping tables;
And acquiring the level and the type of the interrupt source according to the interrupt source, and executing a corresponding interrupt processing instruction according to the level and the type of the interrupt source.
Further, obtaining data transmitted to the node through the optical fiber includes:
acquiring the number M of the data areas and the number N of the addresses contained in each data area;
Allocating a required storage space for each data area for storing at least one address and length information corresponding to each address;
And distributing fixed storage positions in each data area according to the numerical value of the storage address and the length corresponding to each address so as to form a multi-level mapping table with the length of N.
Further, the length information includes a start position, an end position of the address, and a length of an address area continuing from the start position to the end position.
Further, allocating a required storage space for each data area, for storing at least one address and length information corresponding to each address, including:
acquiring a storage space required by each piece of address information and length information;
According to the required storage space, corresponding storage space is allocated for each data area;
in the allocated memory space, corresponding length information is stored for each address.
Further, according to the address, traversing items in a first-level mapping table in the multi-level mapping table one by one in order to obtain matching items, if the matching items are not obtained, traversing a next-level mapping table one by one in order until the matching items are obtained or all mapping tables are traversed, including:
Traversing the whole metadata table or the state table in sequence to acquire the state of each data area;
If the state of the first data area is idle or partially occupied, writing new data into the first data area, and jumping to the next data area;
If the state of the first data area is displayed as occupied, skipping the first data area, and continuing to traverse the next data area.
Further, according to the interrupt source, acquiring the level and the type of the interrupt source, and executing a corresponding interrupt processing instruction according to the level and the type of the interrupt source, including:
traversing the mapping table again, finding a storage area corresponding to the data, and acquiring a physical address of the storage area;
Accessing a physical address, and reading the required data or writing the data into a target address according to the length and the format of a storage area;
and returning the read data to the requester, or after writing the data to the target address, updating the mapping table.
Further, after obtaining the level and the type of the interrupt source according to the interrupt source and executing the corresponding interrupt processing instruction according to the level and the type of the interrupt source, the method further comprises:
setting a priority for each interrupt source and mapping item;
Sequencing according to the priority of the interrupt sources and the mapping items to obtain an interrupt source and mapping item list in the order from high to low according to the priority;
interrupt sources or mapping items are selected from the ordered list one by one for processing.
In a second aspect, a multi-level mapping table interrupt source optical fiber data transmission apparatus includes:
the system comprises an acquisition module, a data analysis module, a data transmission module and a data transmission module, wherein the acquisition module is used for acquiring data transmitted to a node through an optical fiber;
the processing module is used for traversing items in a first-level mapping table in the multi-level mapping table one by one according to the addresses to obtain matching items, traversing a next-level mapping table one by one according to the sequence if the matching items are not obtained until the matching items are obtained or all mapping tables are traversed, generating interrupt sources of corresponding levels according to the traversing history and the levels of the matching items in the mapping tables if the matching items are obtained, wherein the multi-level mapping table comprises at least one group of data areas, each group of data areas comprises at least one address and one length, acquiring the levels and types of the interrupt sources according to the interrupt sources, and executing corresponding interrupt processing instructions according to the levels and types of the interrupt sources.
In a third aspect, a computing device includes:
One or more processors;
And a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the above-described methods.
In a fourth aspect, a computer readable storage medium stores a program that when executed by a processor implements the above method.
The scheme of the invention at least comprises the following beneficial effects:
according to the scheme, the data can be effectively analyzed, the matching item can be quickly found in the multi-stage mapping table, the interrupt source with the corresponding level can be timely generated, and the corresponding interrupt processing instruction can be executed according to the level and the type of the interrupt source, so that the data processing efficiency and the real-time performance are improved. In addition, the method can also effectively construct and use a multi-level mapping table, and improve the storage efficiency of data addresses and lengths.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As shown in fig. 1, an embodiment of the present invention proposes a method for transmitting data of a multi-stage mapping table interrupt source optical fiber, where the method includes:
step 11, obtaining data transmitted to the node through an optical fiber;
step 12, analyzing the data to obtain an address corresponding to the data;
Step 13, traversing items in a first-level mapping table in a multi-level mapping table one by one according to the addresses to obtain matching items, and traversing a next-level mapping table one by one according to the sequence if the matching items are not obtained until the matching items are obtained or traversing all mapping tables;
And step 14, acquiring the level and the type of the interrupt source according to the interrupt source, and executing a corresponding interrupt processing instruction according to the level and the type of the interrupt source.
In the embodiment of the invention, the data transmitted to the node through the optical fiber is obtained. The optical fiber is a channel for transmitting data, has the characteristics of high transmission speed, less data loss and the like, and can transmit a large amount of data to the node in real time. The data is analyzed to obtain the address corresponding to the data, and the purpose of analyzing the data is to find out the address information contained in the data so as to facilitate the subsequent data processing. According to the addresses, the items in the first-level mapping table in the multi-level mapping table are traversed one by one in sequence to obtain matching items, and interrupt sources of corresponding levels are generated. According to the interrupt sources, the levels and types of the interrupt sources are obtained, and corresponding interrupt processing instructions are executed, and the operation can be executed according to different interrupt sources, so that data processing is more targeted.
In a preferred embodiment of the present invention, the step 11 may include:
Step 111, obtaining the number M of data areas and the number N of addresses contained in each data area;
Step 112, allocating a required storage space for each data area, wherein the storage space is used for storing at least one address and length information corresponding to each address, and the length information comprises a starting position and an ending position of the address and the length of an address area which is continuous from the starting position to the ending position;
and step 113, allocating fixed storage positions in each data area according to the value of the storage address and the length corresponding to each address to form a multi-level mapping table with the length of N.
In the embodiment of the invention, the number M of the data areas and the address number N contained in each data area are acquired, so that the overall structure and the scale of the mapping table can be understood, and the conditions are created for subsequent data storage and retrieval. And the required storage space is allocated for each data area and is used for storing at least one address and the length information corresponding to each address, so that each data area can be ensured to have enough space to store the address and the length information, and the loss or confusion of data is avoided. According to the numerical value of the storage address, a fixed storage position is allocated in each data area for each address and the length corresponding to each address, so that a multi-stage mapping table with the length of N is formed, each address and length information can have a fixed position in the mapping table, subsequent data retrieval and use are facilitated, and meanwhile, the efficiency of data retrieval can be further improved through the design of the multi-stage mapping table.
In a preferred embodiment of the present invention, the step 112 may include:
step 1121, obtaining the storage space required by each piece of address information and length information;
step 1122, allocating a corresponding storage space for each data area according to the required storage space;
in step 1123, corresponding length information is stored for each address in the allocated memory space.
In the embodiment of the invention, the storage space required by each piece of address information and length information is acquired. This step will determine the storage space required based on the size and type of data, helping to reasonably allocate and utilize storage resources. According to the required storage space, corresponding storage space is allocated for each data area, and the step is to allocate appropriate storage space for each data area based on the storage space requirement required by each piece of address information and length information obtained in step 1121, so as to ensure safe storage of data. In the allocated storage space, corresponding length information is stored for each address, and in the storage space determined by each data area, corresponding length information is stored for each address information, so that complete data information is provided, and subsequent data retrieval and use are facilitated.
In a preferred embodiment of the present invention, the step 13 may include:
Step 131, traversing the whole metadata table or the state table in turn to obtain the state of each data area;
step 132, if the state of the first data area is idle or partially occupied, writing new data into the first data area, and jumping to the next data area;
step 133, if the status of the first data area is displayed as occupied, skipping the first data area, and continuing to traverse the next data area.
In the embodiment of the invention, the metadata table or the state table is traversed to acquire the state of each data area, so that the use condition of each data area can be known to make better data management decisions, if the state of a first data area is idle or partially occupied, new data can be written into the area, then a program can jump to the next data area, thus realizing the efficient utilization of the storage space and avoiding the waste of the space, and if the state of the first data area is occupied, the program can jump over the area and continue traversing the next data area. Thus, unnecessary operation on occupied data area can be avoided, and efficiency of data management is improved.
In a preferred embodiment of the present invention, the step 14 may include:
Step 141, traversing the mapping table again, finding a storage area corresponding to the data, and obtaining a physical address of the storage area;
step 142, accessing the physical address, and reading the required data or writing the data into the target address according to the length and format of the storage area;
Step 143, the read data is returned to the requester, or after the data is written to the target address, the mapping table is updated.
In the embodiment of the invention, the mapping table is traversed again, the storage area corresponding to the data is found, and the physical address of the storage area is obtained, so that the actual storage position of the data can be determined, and a basis is provided for the subsequent data read-write operation. After the physical address is obtained, the system will access the physical address according to the length and format of the storage area, read the required data or write the data to the target address. This step ensures the correct reading or writing of data. The read data can be returned to the requester, or after the data is written into the target address, the system can update the mapping table, which is very important for data management and tracking, can ensure the accuracy and consistency of the data, and simultaneously, can make the data access more efficient.
In a preferred embodiment of the present invention, after the step 14, it may include:
Step 15, setting priority for each interrupt source and mapping item;
step 16, sorting according to the priority of the interrupt sources and the mapping items to obtain an interrupt source and a mapping item list according to the order of the priority from high to low;
and step 17, selecting interrupt sources or mapping items from the ordered list one by one for processing.
In the embodiment of the invention, the priority is set for each interrupt source and each mapping item, so that the interrupt source and the mapping item can be subjected to priority management. When the system processes a plurality of interrupt sources and mapping items, the system can process according to the priority, and the interrupt sources and the mapping items with high priority are ensured to be processed preferentially. According to the priority of the interrupt sources and the mapping items, the system performs sequencing to obtain an interrupt source and mapping item list according to the order from high priority to low priority, so as to effectively manage and schedule the resources when a plurality of interrupt sources and mapping items exist, and ensure the stable operation of the system. The interrupt sources or the mapping items are selected from the ordered list one by one for processing, and the interrupt sources and the mapping items can be processed sequentially according to the priority, so that the tasks with high priority can be processed preferentially, and the response speed and the processing efficiency of the system are improved.
As shown in fig. 2, an embodiment of the present invention further provides a multi-stage mapping table interrupt source optical fiber data transmission device 20, including:
the acquisition module 21 is used for acquiring the data transmitted to the node through the optical fiber, analyzing the data and obtaining an address corresponding to the data;
the processing module 22 is configured to sequentially traverse items in a first-level mapping table in a multi-level mapping table one by one according to the address to obtain a matching item, if the matching item is not obtained, sequentially traverse a next-level mapping table one by one until the matching item is obtained or all mapping tables are traversed, if the matching item is obtained, generate an interrupt source of a corresponding level according to the traversal history and the level of the matching item in the mapping table, where the multi-level mapping table includes at least one set of data areas, each set of data areas includes at least one address and length, obtain the level and type of the interrupt source according to the interrupt source, and execute a corresponding interrupt processing instruction according to the level and type of the interrupt source.
Optionally, acquiring data transmitted to the node through the optical fiber includes:
acquiring the number M of the data areas and the number N of the addresses contained in each data area;
Allocating a required storage space for each data area for storing at least one address and length information corresponding to each address;
And distributing fixed storage positions in each data area according to the numerical value of the storage address and the length corresponding to each address so as to form a multi-level mapping table with the length of N.
Optionally, the length information includes a start position, an end position of the address, and a length of an address area continuing from the start position to the end position.
Optionally, a required storage space is allocated for each data area, for storing at least one address and length information corresponding to each address, including:
acquiring a storage space required by each piece of address information and length information;
According to the required storage space, corresponding storage space is allocated for each data area;
in the allocated memory space, corresponding length information is stored for each address.
Optionally, according to the address, traversing items in a first-level mapping table in the multi-level mapping table one by one in order to obtain a matching item, if the matching item is not obtained, traversing a next-level mapping table one by one in order until the matching item is obtained or traversing all mapping tables, including:
Traversing the whole metadata table or the state table in sequence to acquire the state of each data area;
If the state of the first data area is idle or partially occupied, writing new data into the first data area, and jumping to the next data area;
If the state of the first data area is displayed as occupied, skipping the first data area, and continuing to traverse the next data area.
Optionally, according to the interrupt source, acquiring a level and a type of the interrupt source, and executing a corresponding interrupt processing instruction according to the level and the type of the interrupt source, including:
traversing the mapping table again, finding a storage area corresponding to the data, and acquiring a physical address of the storage area;
Accessing a physical address, and reading the required data or writing the data into a target address according to the length and the format of a storage area;
and returning the read data to the requester, or after writing the data to the target address, updating the mapping table.
Optionally, after obtaining the level and the type of the interrupt source according to the interrupt source and executing the corresponding interrupt processing instruction according to the level and the type of the interrupt source, the method further includes:
setting a priority for each interrupt source and mapping item;
Sequencing according to the priority of the interrupt sources and the mapping items to obtain an interrupt source and mapping item list in the order from high to low according to the priority;
interrupt sources or mapping items are selected from the ordered list one by one for processing.
It should be noted that the apparatus is an apparatus corresponding to the above method, and all implementation manners in the above method embodiment are applicable to this embodiment, so that the same technical effects can be achieved.
Embodiments of the invention also provide a computing device comprising a processor, a memory storing a computer program which, when executed by the processor, performs a method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes various media capable of storing program codes such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.
Furthermore, it should be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. Also, the steps of performing the series of processes described above may naturally be performed in chronological order in the order of description, but are not necessarily performed in chronological order, and some steps may be performed in parallel or independently of each other. It will be appreciated by those of ordinary skill in the art that all or any of the steps or components of the methods and apparatus of the present invention may be implemented in hardware, firmware, software, or a combination thereof in any computing device (including processors, storage media, etc.) or network of computing devices, as would be apparent to one of ordinary skill in the art after reading this description of the invention.
The object of the invention can thus also be achieved by running a program or a set of programs on any computing device. The computing device may be a well-known general purpose device. The object of the invention can thus also be achieved by merely providing a program product containing program code for implementing said method or apparatus. That is, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. It is apparent that the storage medium may be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. The steps of executing the series of processes may naturally be executed in chronological order in the order described, but are not necessarily executed in chronological order. Some steps may be performed in parallel or independently of each other.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.