Disclosure of Invention
The embodiment of the application provides a process communication method, a process communication device and electronic equipment, which are used for solving the problem of low communication efficiency of the existing shared memory communication method.
Based on the above-mentioned problems, in a first aspect, there is provided a process communication method, including:
The method comprises the steps that an active process obtains access qualification of an allocated shared memory according to the current access state of the allocated shared memory;
Determining an array member variable corresponding to the target shared memory from the process lock array variables corresponding to the allocated shared memory;
determining a data bit corresponding to the active process from the array member variables, setting a value stored by the data bit as a value representing a lock state corresponding to access made by the active process, locking the target shared memory, and accessing the target shared memory;
The process lock array variable is an atomic variable and is arranged in the shared memory core area, the allocated shared memory is pre-allocated by the shared memory core area and is arranged in the shared memory user area, and the shared memory core area and the shared memory user area are both arranged in the user space.
With reference to the first aspect, in one possible implementation manner, the active process obtains access qualification to the allocated shared memory according to the current access state of the allocated shared memory, and the method includes sequentially traversing each array member of a memory access state array variable, modifying a value corresponding to a stored value of any one array member to represent that the corresponding access qualification is occupied if the value is determined to represent that the corresponding access qualification is unoccupied, determining that the active process obtains the access qualification to the allocated shared memory if the modification is successful, continuing traversing the array members of the memory access state array variable if the modification is unsuccessful, wherein the memory access state array variable is used for storing the allocation situation of the access qualification to the allocated shared memory, the memory access state array variable is an atomic variable and is set in the shared memory core area, and the array member number representation of the memory access state array variable allows the maximum number of processes accessing the allocated shared memory in parallel.
With reference to the first aspect, in a possible implementation manner, after the active process obtains the access qualification to the allocated shared memory, the method further includes modifying a value to be a sequence number of an array member with occupied corresponding access qualification in the memory access state array variable, and determining the sequence number as an identification number of the active process.
In combination with the first aspect, in one possible implementation manner, the active process includes a write process, after the write process obtains the access qualification, the method further includes the steps of obtaining the authority of executing the write operation on the target shared memory, including obtaining a first process number stored by a member corresponding to the target shared memory from a read-write authority array variable, determining whether the first process number is a second process number of the write process, if yes, determining that the authority of executing the write operation on the target shared memory is obtained, if not, replacing the first process number with the second process number, and returning to obtain the first process number stored by the member corresponding to the target shared memory if replacing the first process number with the second process number is unsuccessful, wherein the read-write authority array variable is used for storing the process number of the process having the write authority on the corresponding shared memory, the read-write authority array variable is an atomic variable and is set in the shared memory core area, and the number of the member of the shared memory can represent the maximum number of the shared memory.
With reference to the first aspect, in one possible implementation manner, the active process includes a writing process, before locking the target shared memory, the method further includes reading a current value of an array member variable corresponding to the target shared memory in the process lock array variable, and determining that no process is reading the target shared memory according to the current value, wherein the number of members of the process lock array variable represents the maximum number of allowed shared memories, the maximum number of parallel access processes supported by each shared memory is determined according to the maximum number of supported by an operating system where the active process operates, and the number of data bits required by representing a plurality of lock states.
With reference to the first aspect, in one possible implementation manner, it is determined whether a process is currently reading the target shared memory, and the current value of the array member variable and a preset mask are subjected to bitwise and operation, wherein the preset mask is obtained by setting a value of each data bit in the array member variable of the process lock array variable to be a value of a read lock, and if the phase result is zero, it is determined that no process is reading the target shared memory.
With reference to the first aspect, in one possible implementation manner, determining an array member variable corresponding to a target shared memory from process lock array variables corresponding to the allocated shared memory includes determining an array member variable having an identification sequence number allocated to the target shared memory as an array member sequence number from the process lock array variables, the active process including a write process, determining a data bit corresponding to the active process from the array member variables, setting a value stored in the data bit to a value representing an access corresponding lock state made by the active process to lock the target shared memory and access the target shared memory, including determining an offset of the data bit corresponding to the active process in the array member variable according to an identification number allocated to the active process and a bit number representing a lock state data bit, determining a data bit corresponding to the active process according to the offset, and setting a value stored in the data bit to a value representing a lock state to a write lock, to write the target shared memory and write the shared data to the target shared memory, and/or write the target shared data to the target shared memory
The method comprises the steps of determining data bits corresponding to an active process from an array member variable, setting a value stored by the data bits as a value representing a lock state corresponding to access made by the active process, locking the target shared memory, accessing the target shared memory, determining an offset of the data bits corresponding to the active process in the array member variable according to an identification number allocated to the active process and a bit number representing the lock state data bits, determining the data bits corresponding to the active process according to the offset, setting the value stored by the data bits as a value representing the lock state as a read lock, reading the lock on the target shared memory, and reading the target shared memory.
With reference to the first aspect, in one possible implementation manner, the active process includes a read process, the read process includes a plurality of threads, determining an array member variable corresponding to the target shared memory from process lock array variables corresponding to the allocated shared memory, where a first thread of the plurality of threads needs to perform a read operation, determining an array member variable corresponding to the target shared memory from the process lock array variables, determining a data bit corresponding to the active process from the array member variables, setting a value stored by the data bit as a value representing a state of access corresponding to the active process, locking the target shared memory, and accessing the target shared memory, including determining a data bit corresponding to the active process from the array member variables, setting the value stored by the data bit as a value representing a lock state as a read lock, reading the lock for the target shared memory, and reading the target shared memory;
The method further comprises the steps of determining a counting array member for performing reading lock counting for the reading process in a reading lock counting array variable, recording a unit value in the counting array member, accumulating the number of threads for reading the target shared memory according to the unit value by the counting array member under the condition that a non-first thread in the plurality of threads needs to perform reading operation, subtracting the unit value from the counting of the counting array member after any thread in the plurality of threads finishes reading, setting a value stored in a corresponding data bit in the process lock array variable to be a value indicating that the lock state is unlocked under the condition that the counting of the counting array member is reduced to zero, wherein the reading lock counting array variable indicates the number of threads for each process with access qualification to the corresponding shared memory currently accessing the corresponding shared memory, and the member number of the reading lock counting array variable indicates the maximum number of allowed shared memory.
In combination with the first aspect, in a possible implementation manner, the method further includes performing self-increment counting on the values stored by the members which are successfully modified according to a preset time interval, cleaning an inactive process by sequentially traversing each member of the memory access state array variable, determining whether the values stored by each member are the same as those of the previous traversal in each traversal, accumulating the numbers of times that the corresponding member is judged to be the same as those of the previous traversal if the values are the same, determining whether the accumulated numbers reach the preset numbers or not, if so, modifying the values stored by the corresponding member to represent that the corresponding access qualification is unoccupied, determining a target process represented by the values stored by the corresponding member in the case of successful modification, setting the corresponding lock state of the target process in the process lock array variable to be unlocked, and cleaning the corresponding process number stored by the target process in the read-write permission array variable in the case that the target process is a write process.
With reference to the first aspect, in one possible implementation manner, the active process comprises a writing process, wherein the writing process writes shared data into a target shared memory in a manner of determining a writing offset of the shared data in the target shared memory, writing the shared data into the target shared memory according to the writing offset, updating the current writing offset, assigning a writing index variable according to the unit number of the writing shared data, and storing the writing offset, the writing data size and the writing index in a user area of the shared memory;
The active process comprises a reading process, wherein the reading process reads a target shared memory in a mode of acquiring the value of a current write index variable and the value of a read index variable, reads the shared data according to the write offset and the unit data quantity represented by the write index variable under the condition that the value of the write index variable is inconsistent with the value of the read index variable and the value of the read index variable is effective, and updates the value of the read index variable.
With reference to the first aspect, in one possible implementation manner, the active process includes a control end process as a writing process and a plurality of monitoring end processes as reading processes.
In a second aspect, there is provided a process communication apparatus comprising:
the access qualification acquisition module is used for acquiring access qualification of the allocated shared memory according to the current access state of the allocated shared memory by the active process;
The locking module is used for determining an array member variable corresponding to a target shared memory from process lock array variables corresponding to the allocated shared memory, determining a data bit corresponding to the active process from the array member variable, setting a value stored by the data bit as a value representing an access corresponding lock state made by the active process, locking the target shared memory, and accessing the target shared memory;
The process lock array variable is an atomic variable and is arranged in the shared memory core area, the allocated shared memory is pre-allocated by the shared memory core area and is arranged in the shared memory user area, and the shared memory core area and the shared memory user area are both arranged in the user space.
In a third aspect, there is provided an electronic device comprising a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is in operation, the machine-readable instructions when executed by the processor performing the steps of the process communication method as in the first aspect, or in combination with any one of the possible implementations of the first aspect.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the process communication method as described in the first aspect, or in connection with any possible implementation of the first aspect.
The beneficial effects of the embodiment of the application include:
the embodiment of the application provides a process communication method, a process communication device and electronic equipment. The process communication method provided by the embodiment of the application sets the process lock array variable for locking for the access of the shared memory, sets the process lock array variable in the shared memory core area, sets the shared memory in the shared memory user area, and sets the shared memory core area and the shared memory user area in the user space, so that the regional function division is realized, the active process can set the process lock in the user space through the process lock array variable without interaction with a system kernel, and compared with the prior art that the shared memory does not support the process lock or the supported process lock substantially adopts the semaphore, the communication time is shortened, and the communication efficiency is improved.
Detailed Description
The embodiment of the application provides a process communication method, a process communication device and an electronic device, and the following description is made with reference to the accompanying drawings, which should be understood that the preferred embodiments described herein are for illustrating and explaining the application, and are not limited to the embodiments. And embodiments of the application and features of the embodiments may be combined with each other without conflict.
An embodiment of the present application provides a process communication method, as shown in fig. 1, including:
s101, the active process acquires access qualification of the allocated shared memory according to the current access state of the allocated shared memory;
s102, determining an array member variable corresponding to a target shared memory from process lock array variables corresponding to the allocated shared memory;
S103, determining a data bit corresponding to the active process from the array member variables, setting a value stored in the data bit as a value representing a lock state corresponding to access made by the active process, locking the target shared memory, and accessing the target shared memory;
The method comprises the steps of storing the lock states of access processes of all allocated shared memories by array member variables of process lock array variables, wherein the array member variables of the process lock array variables are used for storing the lock states of the access processes of all allocated shared memories respectively, the process lock array variables are atomic variables and are arranged in a shared memory core area, the allocated shared memories are allocated in the shared memory core area in advance and are arranged in a shared memory user area, and the shared memory core area and the shared memory user area are arranged in a user space.
In the embodiment of the application, the user can apply for the shared memory and create the shared memory by adopting the related technology, and the shared memory can be divided into two types, namely a core area of the shared memory and a user area of the shared memory in the use of the shared memory. The core area of the shared memory is mainly used for memory management, including allocation and recovery of shared memory resources, management and recovery of process locks, access authority management of the shared memory user area and the like. The user area of the shared memory is mainly used for users to realize data transmission or message queues. When the shared memory core area is used, a user cannot directly access the shared memory core area, but an application programming interface (API, application Programming Interface) can be provided for the user to operate related variables of the shared memory core area so as to avoid memory management abnormality caused by misoperation of the user. In implementation, the core area and the user area of the shared memory may be divided by different address spaces, or the core area and the user area of the shared memory may be divided by setting different access rights, which is not limited herein.
Further, in the embodiment of the present application, both the core area of the shared memory and the user area of the shared memory are disposed in the user space. In order to improve stability and security, an operating system generally sets a kernel space and a user space, wherein the kernel space is a core of the operating system, and the user space is an operating environment of an application program. As mentioned above, in the related art, the process read-write lock for the shared memory actually adopts the semaphore, and the use of the semaphore requires the application program to access the kernel space, which is more complex than the access procedure for the user space, which consumes more time and causes low communication efficiency. Therefore, the embodiment of the application sets the core area of the shared memory and the user area of the shared memory in the user space, thereby realizing the function division of the shared memory area, avoiding the access to the kernel space when the shared memory is locked, and improving the communication efficiency between processes.
In addition, in the embodiment of the application, a process lock array variable can be set for the corresponding allocated shared memory, and each shared memory corresponds to one of the group member variables so as to store the process lock of the corresponding shared memory. The process lock array variable may be set to a data type of the array when implemented (e.g., an integer array, an array member variable is integer, and is not limited herein), and the number of array member variables may be set according to the maximum number of allowed shared memory allocation, so that each of the array member variables may store a process lock state value set for a process accessing the corresponding shared memory, i.e., store a lock state value for the process accessed through a data bit of the array member variable. When the active process locks the array variable corresponding to the array member variable as the target shared memory through the process, only the array member variable is required to be read, the data bit corresponding to the active process in the array member variable is determined, and the value representing the lock state is set for the data bit, so that the locking operation is completed. Therefore, the process lock array variable is an atomic variable, and the operation of the active process on the process lock array variable belongs to the atomic operation (reading the array variable and assigning the value to the member), so that the execution efficiency and the safety of the locking operation are further improved.
In the implementation, an identification sequence number can be allocated to a target shared memory when the target shared memory is allocated, and an array member variable with the same array member sequence number as the identification sequence number in the process lock array variable is allocated to the target shared memory to store a lock state value of a process accessing the target shared memory for locking the target shared memory, that is, step S102 is implemented by determining the identification sequence number allocated to the target shared memory as the array member variable of the array member sequence number from the process lock array variable, or directly determining the array member variable which does not correspond to the shared memory in the current process lock array variable when the shared memory is allocated, corresponding to the allocated shared memory, and recording the corresponding relation, and step S102 can be implemented by determining the array member variable corresponding to the target shared memory according to the corresponding relation between the target shared memory established when the target shared memory is allocated and the array member variable of the process lock array variable.
Further, before performing read/write operations on the process lock array variables, access qualifications for accessing the shared memory user area are also required. The process communication method provided by the embodiment of the application aims to realize efficient access of the shared memory user area by multiple processes in parallel, and in order to facilitate management, the access qualification of the allocated shared memory needs to be limited according to the access state of the current allocated shared memory. The current access status of the allocated shared memory may be evaluated by the number of current access processes, the ratio of the number of allocated shared memory to the number of current access processes, etc., without limitation.
Fig. 2 is a schematic diagram of dividing a shared memory area according to an embodiment of the present application. As shown in fig. 2, the shared memory is divided into a shared memory core area 201 and a shared memory user area 202. The user may apply for the shared memory to the shared memory core area 201 when needed, and in fig. 2, N pieces of shared memory are applied for example. Processes 1 through N may perform read and write operations on the shared memory in the shared memory user area 202, and perform preset atomic operations on the shared memory core area (e.g., locking the shared memory to be accessed by a process lock array variable, etc.). In addition, the upper limit of the number of shared memories may be set according to practical situations (for example, 32 blocks), which is not limited herein.
Taking Win 10X 64& Ubuntu 64 development environment, the application is implemented by adopting basic API: boost:: interprocess, the boost provides some basic interfaces of shared memory, such as shared memory creation, shared memory variable creation, shared memory deletion, etc. In addition, the boost also provides the shared memory atomic operation, so that an atomic variable can be applied to the shared memory, the atomic variable can be safely shared and operated under the condition of multiple processes, no extra process lock or semaphore is needed, the problems of data competition and deadlock under the multiple processes can be effectively reduced, and the execution speed of functions can be further improved.
In still another embodiment of the present application, as shown in fig. 3, the step S101 "the active process obtains the access qualification to the allocated shared memory according to the current access status of the allocated shared memory" may be implemented as the following steps:
s301, traversing all array members of the memory access state array variable in sequence;
S302, judging whether any of the array members is unoccupied by the corresponding access qualification of the stored numerical representation, if yes, entering step S303, otherwise, entering step S301;
s303, under the condition that the corresponding access qualification of the numerical representation stored corresponding to any array member is not occupied, modifying the numerical representation into the representation that the corresponding access qualification is occupied;
S304, judging whether the modification is successful, if so, entering a step S305, and if not, entering a step S306;
S305, under the condition that the modification is successful, determining that the active process obtains the access qualification of the allocated shared memory, and ending the process.
S306, under the condition that the modification is unsuccessful, continuing to traverse the array members of the memory access state array variables.
The memory access state array variable is used for storing the allocation condition of the access qualification of the allocated shared memory, is an atomic variable and is arranged in a shared memory core area, and the number of array members of the memory access state array variable represents the maximum number of processes allowed to access the allocated shared memory in parallel.
In the embodiment of the application, the shared memory core area adopts the atomic variable to manage the access of the allocated shared memory for each process. The method mainly comprises the process lock array variable for managing the process lock, the memory access state array variable for managing the access qualification and the read-write permission array variable for managing the write permission, which are described later.
The memory access state array variable is mainly used for storing the allocation condition of the access qualification of the allocated shared memory. An active process needs to first acquire access credentials for an allocated shared memory before accessing any shared memory. In practice, each array member of the memory access state array variable may be traversed sequentially, and if any of the array members has a corresponding stored value (e.g., value 0) indicating that the corresponding access qualification is unoccupied, the value may be modified to a value (e.g., value 1) indicating that the corresponding access qualification is occupied. Since there may be multiple active processes preempting access qualifications at the same time, while the operation on the memory access state array variables is an atomic operation, there may be instances where the value modification is unsuccessful. In the case that the modification is unsuccessful, the active process needs to continue to traverse the array members of the memory access state array variable, and in the case that access qualification is not yet obtained after traversing the remaining array members, it may also return to step S301 to loop through the array members of the memory access state array variable until an array member indicating that the corresponding access qualification is unoccupied is found, and modify its value successfully. Steps S302 and S303 described above are atomic operations.
The number of array members of the memory access state array variable may characterize the maximum number of processes allowed to access the allocated shared memory in parallel. The process for obtaining the access qualification can access the appointed shared memory, can also access all the shared memories which are allocated, and can be set according to actual needs. For convenience in management, efficient parallel access is realized, and the number of processes for accessing the allocated shared memory in parallel can be limited by setting the number of array members of the memory access state array variable.
In yet another embodiment of the present application, after the step S305, that is, after the active process gains access to the allocated shared memory, the method may further include the following steps:
The number is modified to characterize the corresponding access-eligible array member, the sequence number in the memory access state array variable, and is determined as the active process identification number.
In the embodiment of the application, in order to facilitate management of the process for obtaining the shared memory access qualification, the serial number of the corresponding array member in the memory access state array variable can be determined as the identification number of the active process when the active process obtains the access qualification. The execution subject of this step may be an active process or a management process of the shared memory core area, which is not limited herein.
In yet another embodiment of the present application, after the step S305, that is, after the active process gains access to the allocated shared memory, the method may further include the following steps:
and performing self-increment counting on the numerical value stored by the member successfully modified according to a preset time interval.
In the embodiment of the application, the memory access state array variable can also represent the active state of the current access shared memory. After the active process obtains the access qualification, and modifies the value of the corresponding array member to a value (e.g., value 1) representing that the corresponding access qualification is occupied, in order to represent the subsequent active state of the active process, the active process may be enabled to perform self-increment counting on the value stored by the member successfully modified according to a preset time interval. For example, a unit number (such as 1) is self-increased every 1s, and then the activity state of the corresponding activity process can be known by checking the self-increase condition of the storage value of each array member.
FIG. 4 is a schematic diagram illustrating the use of memory access state array variables according to an embodiment of the present application. As shown in fig. 4, it is assumed that the type of the memory access status array variable is set to an atomic variable (atomic) 32-bit integer (int 32) array, including 32 array members (array member numbers from 0 to 31). Process a (process number (PID, process Identification) 1456) is given access by the array member with sequence number 0, then sequence number 0 is assigned to process a as the identification number. Process B (process number PID 1578) gains access through the array member with sequence number 1, then sequence number 1 is assigned to process B as the identification number. Similarly, process C (process number PID 1264) gains access by the array member with number 2, then process C is assigned number 2 as the identification number. Taking the example of the value 0 to represent unoccupied access qualification, the array member values 0, 0 and 0 corresponding to the process A, the process B and the process C respectively represent that the process is being allocated with an identification number, the array member values 23, 43 and 87 respectively represent the active state of the process using the shared memory, and the 6 th to 31 th array member 0 represents the array member which is not allocated yet. The solid arrows in FIG. 4 represent the allocation of currently available identification number resources for a process, and the dashed arrows represent the periodic self-increment of the array member storage value.
In yet another embodiment of the present application, the active process includes a writing process, and after the writing process completes the step S305, the following steps may be further executed after the access qualification is obtained:
Acquiring the authority of executing the writing operation on the target shared memory;
as shown in fig. 5, the step of "obtaining the right to perform the write operation on the target shared memory" may be implemented as the following steps:
s501, acquiring a first process number stored by a member corresponding to a target shared memory from a read-write permission array variable;
s502, determining whether the first process number is a second process number of the writing process, if so, entering step S503, otherwise, entering step S504;
s503, determining that the permission of executing the writing operation on the target shared memory is obtained;
s504, replacing the first process number with a second process number;
s505, judging whether the replacement is successful, if so, proceeding to step S503, and if not, proceeding to step S501.
The method comprises the steps of storing a read-write permission array variable, wherein the read-write permission array variable is used for storing a process number of a process with write permission to a corresponding shared memory, the read-write permission array variable is an atomic variable and is arranged in a shared memory core area, and the number of array members of the read-write permission array variable represents the maximum number of the shared memory which can be applied for.
In the embodiment of the application, after the access qualification is acquired for the writing process, the authority of the writing operation is also required to be acquired, so that the writing lock can be performed on the process lock array variable. Therefore, in order to manage the read-write permission of the shared memory, the embodiment of the application sets the read-write permission array variable. The read-write permission array variable represents a current process having write permission to the shared memory, i.e., the array members of the read-write permission array variable may respectively correspond to a block of the shared memory and store a process number having write permission to the corresponding shared memory. In actual use, there may be a process that has write rights to multiple shared memories (i.e., multiple array members store the process numbers of the same process), while some processes have read rights to multiple processes.
Fig. 6 is a schematic view of a read-write permission array variable provided in an embodiment of the present application, as shown in fig. 6, taking a maximum allowable application for 32 blocks of shared memory as an example, array serial numbers 0-31 respectively identify 32 blocks of memory, process a has write permission for the 0 th block and the 1 st block of shared memory, process number PID (1345) of process a is stored at the corresponding array member (array member serial numbers 0 and 1 respectively), process B has write permission for the 2 nd block of shared memory, PID (576) of process B is stored at the corresponding array member (array member serial number 2), process C has write permission for the 3 rd block of shared memory, PID (345) of process C is stored at the corresponding array member (array member serial number 3), and no process on the shared memory is represented by the representation of the storage value 0 of the array member.
Further, when a process needs to acquire the write permission of a shared memory, the process number stored in the corresponding array member of the array variable with the read-write permission in the shared memory needs to be modified to its own process number, that is, the steps S501 to S505 are executed. If a plurality of processes acquire the write-in permission, only one process can modify the originally stored process number into the current own process number according to the atomic operation characteristic. I.e. steps S501, S502 and S504 described above are atomic operations. In case the modification is unsuccessful, the step of obtaining the first process number needs to be repeated until the first process number is successfully replaced.
In order to facilitate the realization that an identification sequence number can be allocated to the shared memory when the shared memory is allocated, and the number of the array members with the same number as the identification sequence number in the read-write permission number array variable are stored, the process number with the write permission corresponding to the shared memory is stored. In addition, the number of array members of the read-write permission array variable characterizes the maximum number of shared memory that can be applied for (e.g., 32 blocks).
In yet another embodiment of the present application, the active process includes a write process, and the following steps may be performed before locking the target shared memory:
step one, reading the current value of the array member variable corresponding to the target shared memory in the process lock array variable and
Step two, determining that no process is reading the target shared memory according to the current value;
The maximum number of processes which are supported by each shared memory and access the shared memory in parallel is determined according to the maximum number of supported bits of an operating system where an active process operates and the number of data bits required for representing a plurality of lock states.
In the embodiment of the present application, for the writing process, before locking, it is required to ensure that there is no process currently reading the target shared memory, and if other processes are reading the target shared memory, the writing process modifies the content of the target shared memory, which may cause a reading error of the reading process. Because the process lock array variable is allocated to the allocated shared memory, the array member variable of the process lock array variable is used for representing the lock state of the corresponding shared memory, i.e. the values representing the access corresponding lock states made by the process, such as read lock and write lock, are stored, and the corresponding values of different lock states are different. Therefore, the lock state of each process accessing the target shared memory can be determined by reading the current value of the corresponding array member variable of the process lock array variable, i.e. whether no process is reading the target shared memory is determined by the current value.
In addition, the number of members of the process lock array variable characterizes the maximum number of allowed shared memory, and the maximum number of processes which are supported by each shared memory and access the shared memory in parallel can be determined according to the maximum number of supported bits of an operating system where an active process operates and the number of data bits required for characterizing a plurality of lock states. Taking a process lock as a read-write lock, 3 lock states are needed as an example, and the representation of the lock states requires 2 data bits (bits), assuming that 0 represents unlocked (corresponding to binary 00), 1 represents read lock (corresponding to binary 01), and 2 represents write lock (corresponding to binary 10). According to the maximum number of bits supported by the operating system, the type of the maximum atomic variable is uint64_t, and one atomic variable corresponds to one shared memory, so that 32 processes can be supported to perform read-write access operation on the same block of shared memory at most.
FIG. 7 is a schematic diagram of a process lock array variable according to an embodiment of the present application. As shown in fig. 7, taking the maximum number of bits supported by the operating system as 64 bits, the lock state representation requires 2 bits as an example, and a maximum of 32 processes are supported for parallel access. In the embodiment shown in fig. 7, taking the maximum number of application blocks of the shared memory as 32 blocks as an example, the process lock array variable includes 32 uint64_t atom variable type array member variables (array serial numbers 0-31) with 64 bits of each number group member variable, and a lock state value is stored in each two bits, so that the process lock states of 32 processes can be stored for the corresponding shared memory.
In yet another embodiment provided by the present application, the following steps may be employed to determine whether a process is currently reading the target shared memory:
the method comprises the steps of firstly, performing bit-wise operation on the current value of the array member variable and a preset mask, wherein the preset mask is obtained by setting the value of each data bit in the array member variable of the process lock array variable as the value of a read lock;
and step two, under the condition that the phase and the result are zero, determining that no process is reading the target shared memory.
In the embodiment of the present application, in order to facilitate determining whether a process is reading the target shared memory, a preset mask may be set. The preset mask may be set based on an array member variable of the process lock array variable, setting a value of each data bit to a value of the read lock. Taking the array member variable of the process lock array variable as 64 bits, and taking the read lock value as 1 (corresponding to binary 01), the mask can be set to 0x5555555555555555 (16 decimal 5 corresponding to 32 binary 01), i.e. the process locks of 32 processes are all set as read locks. In this way, when the phase result is 0, it indicates that there is no process of setting a read lock on the target shared memory, and when the phase result is not 0, it indicates that there is a process of reading the target shared memory, and it is necessary to wait for reading to complete and then write the lock.
In still another embodiment of the present application, the step S102 "determining the array member variable corresponding to the target shared memory from the process lock array variables corresponding to the allocated shared memory" may be implemented as the following steps:
Determining the identification number allocated for the target shared memory as the array member of the array member number from the process lock array variable, or
Determining an array member variable corresponding to the target shared memory according to the corresponding relation between the target shared memory and the array member variable in the process lock array variable, which is established when the target shared memory is allocated;
the step S103 'determining the data bit corresponding to the active process from the array member variables and setting the value stored in the data bit as the value representing the access corresponding lock state of the active process to lock the target shared memory and access the target shared memory' can be implemented as follows:
Step 1, determining the offset of data bits corresponding to an active process in an array member variable according to an identification number allocated to the active process and the bit number of data bits representing a lock state;
And 2, determining a data bit corresponding to the active process according to the offset, setting a value stored in the data bit as a value representing that the lock state is a write lock, writing the lock on the target shared memory, and writing the shared data into the target shared memory.
Correspondingly, the step S103 'determining the data bit corresponding to the active process from the array member variables and setting the value stored in the data bit as the value representing the access corresponding lock state of the active process to lock the target shared memory and access the target shared memory', can be implemented as follows:
Step 1, determining the offset of data bits corresponding to an active process in an array member variable according to an identification number allocated to the active process and the bit number of data bits representing a lock state;
and 2, determining a data bit corresponding to the active process according to the offset, setting a value stored in the data bit as a value representing that the lock state is a read lock, reading the read lock on the target shared memory, and reading the target shared memory.
In the embodiment of the application, in order to facilitate the search of the array member variable corresponding to the target shared memory from the process lock array variable, an identification sequence number can be allocated to the target shared memory when the target shared memory is allocated, and the array member variable with the same array member sequence number as the identification sequence number in the process lock array variable is allocated to the target shared memory to store the lock state value of the process accessing the target shared memory for locking the target shared memory. Thus, the positioning of the array member variables in the process lock array variable is realized according to the identification sequence number of the target shared memory. Or when the target shared memory is allocated, determining that the array member variable of the shared memory is not corresponding to the current process lock array variable, corresponding to the allocated shared memory, and recording the corresponding relation so as to search the array member variable corresponding to the shared memory according to the corresponding relation.
Further, the data bits corresponding to the active process need to be determined from the array member variables. To facilitate the lookup of the active process corresponding data bits from the array member variables, the offset of the active process corresponding data bits in the array member variables may be determined based on the identification number of the active process (allocated to the active process after access is granted by the active process). Because the lock states of a plurality of processes accessing the target shared memory are stored in the array member variables, and the number of bits of data bits used by each process for storing the lock states is fixed, the number of bits of the data bits can be used as a unit, the identification number of the process is used as offset times, and the offset of the offset times is carried out according to the number of bits of each cheap unit, so that the position of the data bit corresponding to the process in the array member variables is obtained. Thus, the corresponding data bit in the array member variable corresponding to the target shared memory can be rapidly determined according to the identification number of the process, the setting of the write lock is completed by storing the value representing the write lock in the data bit, and the setting of the read lock is completed by storing the value representing the read lock.
Further, because of the limitation of the maximum number of bits supported by the system (e.g., 64 bits) and the limitation of the number of data bits (e.g., 2 bits) needed to characterize the lock state, the number of processes accessing the shared memory in parallel for the same block of shared memory is essentially determinable (e.g., 64/2=32). Then the number of data bits of the array member variable for the memory access state array variable limits the maximum number of processes that are allowed to access the allocated shared memory in parallel, which is substantially consistent (e.g., 32) with the number of processes accessing the shared memory in parallel herein.
FIG. 8 is a process lock array variable schematic diagram according to an embodiment of the present application. As shown in FIG. 8, for the array member variable with the array number 0 in the process lock array variable corresponding to the first block shared memory (with the identification number 0), continuing to take the maximum number of bits supported by the operating system as 64 bits, wherein the lock state indicates that 2 data bits (bits) are needed as an example, for the process A with the identification number 0, the offset in the array member variable is the data bit at the position with the offset of 2 bits as a unit, namely, bit0 and bit1, the process A can store the corresponding lock state value at the position of bit0 and bit1 if the write operation is needed to be performed on the first block shared memory, for the process B with the identification number 1, the offset in the array member variable is the data bit at the position with the offset of 2 bits as a unit, namely, bit2 and bit3, the corresponding lock state value can be stored at the position of bit2 and bit3 if the write operation is needed to be performed on the first block shared memory, for the process C with the identification number 2, the offset in the array member variable is the offset of 2bit 2 as a unit, namely, the lock state value can be stored at the position of 5 and the position of bit2 and the second block 4, namely, if the write operation is not needed to be performed on the second block 4.
In yet another embodiment provided by the present application, the active process comprises a read process, the read process comprising a plurality of threads;
Step S102 "determining the array member variable corresponding to the target shared memory from the process lock array variables corresponding to the allocated shared memory" may be implemented as the following step one:
step one, under the condition that a first thread in a plurality of threads needs to perform read operation, determining an array member variable corresponding to a target shared memory from process lock array variables;
step S103 "determining a data bit corresponding to the active process from the array member variables, and setting a value stored in the data bit to a value representing a lock state corresponding to the access made by the active process, so as to lock the target shared memory and access the target shared memory", which may be implemented as the following step two;
Step two, determining data bits corresponding to the active process from the array member variables, setting the numerical value stored in the data bits as the numerical value representing that the lock state is the read lock, reading the read lock on the target shared memory, and reading the target shared memory;
the method may further comprise the steps of:
step three, determining a counting array member for reading lock counting for a reading process in a reading lock counting array variable, and recording a unit value in the counting array member;
step four, under the condition that a non-first thread in the plurality of threads needs to perform read operation, accumulating the number of threads for reading the target shared memory according to the unit value by the count array member;
Step five, after any one of the threads finishes reading, the count of the count array members is reduced by a unit value;
step six, under the condition that the count of the count array members is reduced to zero, setting the value stored by the corresponding data bit in the process lock array variable to represent the lock state as an unlocked value;
The method comprises the steps of determining a read lock count array variable, wherein the read lock count array variable represents the number of threads which are accessed by each process with access qualification to a corresponding shared memory and currently accesses the corresponding shared memory, and the member number of the read lock count array variable represents the maximum number of the allowed shared memories.
In the embodiment of the application, since the process can comprise a plurality of threads, the process can start the threads to access after acquiring the access qualification of the shared memory, and the plurality of threads can access the same shared memory, the plurality of threads are required to read the locks on the shared memory, but the plurality of threads use the access qualification of the same process, the lock state value representing the read locks cannot reflect the number of the read locks, if a certain thread finishes data reading, the lock state value of the read locks is cleared, other threads which still perform data reading cannot know that the threads still read the data, and once the write process writes the data, the error of the read data of other threads can be caused.
To solve this problem, the embodiment of the present application provides a read lock count array variable, which may be set for an allocated shared memory, where the read lock count array variable may indicate the number of threads currently accessing the shared memory by each process having access to each shared memory, and then the number of members of the read lock count array variable may indicate the maximum number of allowable shared memories (e.g., 32 in the previous example), and each count array member may count the number of threads accessing the corresponding shared memory.
When the first thread of the process needs to perform a read operation, a read-lock value can be written into a corresponding data bit of a corresponding array member variable of the process lock array variable, the subsequent non-first thread does not need to assign a value to the data bit again when the same shared memory needs to be read, and accumulated counting is performed on the corresponding count array member of the read lock count array variable, and similarly, when any thread completes the read operation, the corresponding count array member of the read lock count array variable is subtracted by a unit value (for example, 1), and when the count of the corresponding count array member of the read lock count array variable is subtracted by zero, all threads are illustrated to complete the read operation, and a value stored in the corresponding data bit of the process lock array variable can be set to represent a lock state as an unlocked value.
FIG. 9 is a schematic diagram of accessing a shared memory by multiple threads according to an embodiment of the present application. As shown in fig. 9, for an array member variable with an array number of 0 in a process lock array variable corresponding to a shared memory (with an identification number of 0), continuing to take the maximum number of bits supported by the operating system as 64 bits, the lock state indicates that 2 bits are needed as an example, multiple threads (threads a-C) of process 1 with an identification number of 0 are reading the shared memory, then the read lock (with a read lock value of 1 as an example) is stored in the corresponding data bits (i.e., bit0 and bit 1) of the corresponding array member variable of the process lock array variable (i.e., the array member with an identification number of 0), and the thread that is performing the read operation is counted in the read lock count array variable (i.e., the array member with an identification number of 0), and for process 1, three threads are performing the read operation, so the count array member value is 3. In addition, thread D needs to perform a write operation, and can only wait for the three A-C threads to complete a read operation.
In yet another embodiment, as shown in fig. 10, the method further includes the step of cleaning the inactive process:
s1001, sequentially traversing each member of the memory access state array variable, and executing the following operation in each traversal:
S1002, determining whether the numerical values stored by each member are the same as those of the previous traversal, if so, entering a step S1003, otherwise, entering a step S1001;
S1003, accumulating the times of the corresponding members judged to be the same, determining whether the accumulated times reach the preset times, if so, proceeding to step S1004, otherwise, proceeding to step S1001;
S1004, modifying the value stored by the corresponding member to represent that the corresponding access qualification is unoccupied;
S1005, under the condition that the modification is successful, determining a target process of which the corresponding member storage value represents, and setting a corresponding lock state of the target process in a process lock array variable to be unlocked;
s1006, under the condition that the target process is a writing process, the process number correspondingly stored in the read-write permission array variable by the target process is cleared.
In the embodiment of the application, corresponding resources should be released by a process after completing read-write operation under normal conditions, for example, a process should clear a write lock when completing write operation, and the like, in order to avoid incapability of releasing the corresponding resources caused by abnormal termination of the process, a mode of cleaning an inactive process is provided in the embodiment of the application. As described above, after the process acquires the access qualification, the number stored by the member that is successfully modified is counted up automatically according to the preset time interval, which characterizes that the process is still in an active state, and the active state of the process can be determined by detecting the counted up automatically, that is, if the counted up automatically is normally performed, the process is in an active state, and if the counted up automatically stops, the process is in an inactive state or is abnormally terminated, and then the resources occupied by the inactive process need to be cleaned through the process. In implementation, after the process acquires the access qualification, the process starts a thread (the thread may be managed by the shared memory core area) in the background to traverse each member of the memory access state array variable with a preset period as a period (for example, 100 ms), and detects whether the process performs the self-increment operation in a preset number of times (for example, 20 times), if so, the value in the memory access state array variable, the process lock array variable and the read-write permission array variable corresponding to the process (in the case that the target process is a write process) is cleared.
In addition, in the case where the modification of the value stored by the corresponding member to characterize that the corresponding access qualification is unoccupied is unsuccessful, there may already be a process releasing the resource, and the execution may return to step S1001. Steps S1002, S1004, and S1005 are all atomic operations.
In yet another embodiment of the present application, the active process includes a write process, wherein the write process writes the shared data to the target shared memory in the following manner:
Step one, determining the writing offset of shared data in a target shared memory;
Step two, writing the shared data into a target shared memory according to the writing offset, and updating the current writing offset;
Step three, assigning values to the write index variable according to the unit quantity of the write shared data;
the write offset, the write data size and the write index are stored in the shared memory user area;
the active process comprises a reading process, wherein the reading process reads the target shared memory in the following mode:
step one, acquiring the value of a current index writing variable and the value of a read index variable;
Step two, under the condition that the value of the writing index variable is inconsistent with the value of the reading index variable and the reading index variable is effective, reading the shared data according to the writing offset and the unit data quantity represented by the writing index variable;
And step three, updating the numerical value of the read index variable.
In the embodiment of the application, when the user shares the memory, data can be received and transmitted through the lock-free message queue (the lock-free refers to the lock provided by the related technology is not used). In one embodiment of accessing the shared memory by multiple processes, there is one write process and multiple read processes, i.e., one write process performs data synchronization, filling data into the shared memory, and the other read processes perform data reading from the shared memory.
The members of the lock-free message queue mainly include a write offset, a unit data size (e.g., in frames, current frame size), a unit data amount (frame number), a data type (frame type), a write index variable, a read index variable, and the like. It should be noted that, the read index variable may be set as a private variable of the read process, and the write index variable requires all read processes to read data with reference to it, so it may be set as a global variable. After the writing process writes data into the shared memory, the writing index variable can be modified into a value corresponding to the written unit data quantity (such as the number of frames), because the writing index variable is a global variable, each reading process can acquire the updated value of the writing index variable, the value of the writing index variable is compared with the value of the self reading index variable, and because the writing offset and the writing data size are also stored in the shared memory user area, under the condition that the value of the writing index variable is inconsistent with the value of the self reading index variable and the reading index variable is effective, the shared data can be read, and the reading index value is updated to indicate that the acquisition of new shared data is completed. In addition, the writing of the writing index variable by the writing process and the obtaining of the writing index variable by the reading process are all atomic operations.
If the value of the read index variable is invalid, the value of the write index variable is assigned to the read index variable. In addition, how the read process knows the shared memory in which the write process writes data can be notified when the read process is invoked, and details are not repeated here.
In yet another embodiment of the present application, in a usage scenario of an instrument, the active process includes a control end process as a writing process and a plurality of monitoring end processes as a reading process. That is, one control end process performs data synchronization, fills data into the shared memory, and the other monitoring end processes perform data reading from the shared memory.
Based on the same application conception, the embodiment of the application also provides a process communication device, and because the principle of the problems solved by the devices is similar to that of the process communication method, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
The embodiment of the application provides a process communication device, as shown in fig. 11, comprising the following modules:
An access qualification obtaining module 1101, configured to obtain, by an active process, access qualification for an allocated shared memory according to a current access state of the allocated shared memory;
A locking module 1102, configured to determine an array member variable corresponding to a target shared memory from process lock array variables corresponding to the allocated shared memory, determine a data bit corresponding to the active process from the array member variable, and set a value stored in the data bit to a value representing a lock state corresponding to access made by the active process, so as to lock the target shared memory and access the target shared memory;
The process lock array variable is an atomic variable and is arranged in the shared memory core area, the allocated shared memory is pre-allocated by the shared memory core area and is arranged in the shared memory user area, and the shared memory core area and the shared memory user area are both arranged in the user space.
In yet another embodiment of the present application, the access qualification obtaining module 1101 is configured to sequentially traverse each array member of the memory access state array variable, modify a value corresponding to a stored value token corresponding to any one of the array members to be token corresponding to the access qualification being occupied if the value token is not occupied, determine that the active process obtains the access qualification for the allocated shared memory if the modification is successful, continuously traverse the array members of the memory access state array variable if the modification is unsuccessful, wherein the memory access state array variable is used for storing an allocation situation of the access qualification for the allocated shared memory, the memory access state array variable is an atomic variable and is set in the shared memory core area, and the number of the array members of the memory access state array variable is a maximum number of processes allowed to access the allocated shared memory in parallel.
In yet another embodiment of the present application, the access qualification obtaining module 1101 is further configured to, after the active process obtains the access qualification for the allocated shared memory, modify a value to be a sequence number in the memory access state array variable representing an array member whose corresponding access qualification is occupied, and determine the sequence number as the identification number of the active process.
In yet another embodiment provided by the present application, as shown in FIG. 12, the active process comprises a write process, the apparatus further comprises a write permission acquisition module 1103;
A write permission obtaining module 1103, configured to obtain permission to perform a write operation on the target shared memory after the write process obtains the access qualification;
The write permission obtaining module 1103 is configured to obtain a first process number stored in a member corresponding to the target shared memory from a read-write permission array variable, determine whether the first process number is a second process number of the write process, if yes, determine that permission to perform a write operation on the target shared memory is obtained, if no, replace the first process number with the second process number, and return to a step of obtaining the first process number stored in the member corresponding to the target shared memory if replacing the first process number with the second process number is unsuccessful, wherein the read-write permission array variable is used for storing a process number of a process having write permission on the corresponding shared memory, the read-write permission array variable is an atomic variable and is set in the shared memory core area, and the number of array members of the read-write permission array variable represents the maximum number of the shared memory that can be applied.
In another embodiment of the present application, the active process includes a write process, a locking module 1102 is further configured to read a current value of an array member variable corresponding to the target shared memory in the process lock array variable before locking the target shared memory, and determine that no process is reading the target shared memory according to the current value, where the number of members of the process lock array variable indicates a maximum number of allowable shared memories, and the maximum number of parallel processes that each shared memory supports to access the shared memory is determined according to a maximum number of supported bits of an operating system where the active process operates, and a number of data bits required to indicate a plurality of locking states.
In yet another embodiment of the present application, the locking module 1102 is configured to determine whether a process is currently reading the target shared memory by performing a bit-wise operation on a current value of the array member variable and a preset mask, where the preset mask is obtained by setting a value of each data bit in the array member variable of the process lock array variable to a value of a read lock, and if the phase-wise result is zero, determining that no process is reading the target shared memory.
In yet another embodiment of the present application, a locking module 1102 is configured to determine, from the process lock array variables, an array member variable having an identification number allocated for the target shared memory as an array member number;
the active process includes a write process, a locking module 1102 for determining an offset of a data bit corresponding to the active process in the array member variable according to an identification number allocated to the active process and a bit number representing a lock state data bit, determining a data bit corresponding to the active process according to the offset, setting a value stored in the data bit as a value representing a lock state as a write lock, writing a lock to the target shared memory and writing shared data to the target shared memory, and/or
The active process includes a read process, a locking module 1102, configured to determine an offset of a data bit corresponding to the active process in the array member variable according to an identification number allocated to the active process and a bit number representing a lock state data bit, determine a data bit corresponding to the active process according to the offset, and set a value stored in the data bit to a value representing that a lock state is a read lock, so as to read a lock on the target shared memory, and read the target shared memory.
In yet another embodiment of the present application, the active process includes a read process, the read process includes a plurality of threads, a lock module 1102 configured to determine an array member variable corresponding to the target shared memory from the process lock array variable when a first thread of the plurality of threads needs to perform a read operation, and determine a data bit corresponding to the active process from the array member variable, and set a value stored in the data bit to a value representing that a lock state is a read lock, so as to read the lock on the target shared memory and read the target shared memory;
The locking module 1102 is further configured to determine a count array member for performing a read lock count for the read process in a read lock count array variable, and record a unit value in the count array member, accumulate the number of threads for reading the target shared memory according to the unit value when a non-first thread of the plurality of threads needs to perform a read operation, subtract the count of the count array member by the unit value after any thread of the plurality of threads finishes reading, and set a value stored in a corresponding data bit in the process lock array variable to be a value indicating that the lock is unlocked when the count of the count array member is reduced to zero, where the read lock count array variable indicates the number of threads currently accessing the corresponding shared memory by each process having access qualification to the corresponding shared memory, and the member number of the read lock count array variable indicates a maximum number of allowable shared memories.
In yet another embodiment of the present application, the access qualification module 1101 is further configured to count the number stored by the member that is successfully modified by self-increment at a preset time interval, and
In a further embodiment of the application, the inactive process is cleaned by traversing the members of the memory access state array variable in turn, determining whether the values stored by the members are the same as those of the previous traversal, if so, accumulating the numbers of times the corresponding members are judged to be the same, determining whether the accumulated numbers of times reach a preset number of times, if so, modifying the values stored by the corresponding members to represent that the corresponding access qualification is unoccupied, if the modification is successful, determining a target process represented by the values stored by the corresponding members, setting the corresponding lock state of the target process in the process lock array variable to be unlocked, and if the target process is a writing process, cleaning the process numbers stored by the target process in the read-write permission array variable.
The application further provides another embodiment, which also comprises a writing module 1104 and a reading module 1105, wherein the writing module 1104 is used for writing the shared data into a target shared memory in a manner of determining the writing offset of the shared data in the target shared memory, writing the shared data into the target shared memory according to the writing offset and updating the current writing offset, assigning a writing index variable according to the unit number of the writing shared data, and storing the writing offset, the writing data size and the writing index in a user area of the shared memory;
The reading module 1105 is configured to obtain a current value of a write index variable and a current value of a read index variable, read the shared data according to the write offset and a unit data quantity represented by the write index variable when the value of the write index variable is inconsistent with the value of the read index variable and the read index variable is valid, and update the value of the read index variable.
In yet another embodiment of the present application, the active process includes a control side process that is a write process and a plurality of monitor side processes that are read processes.
Based on the same technical conception, the embodiment of the application also provides electronic equipment. Referring to fig. 13, a schematic structural diagram of an electronic device 1300 according to an embodiment of the present application includes a processor 1301, a memory 1302, and a bus 1303. The memory 1302 is configured to store execution instructions, including a memory 13021 and an external memory 13022, where the memory 13021 is also referred to as an internal memory, and is configured to temporarily store operation data in the processor 1301 and data exchanged with the external memory 13022, such as a hard disk, where the processor 1301 exchanges data with the external memory 13022 through the memory 13021, and when the electronic device 1300 is running, the processor 1301 and the memory 1302 communicate with each other through the bus 1303, so that the processor 1301 executes the following instructions:
The method comprises the steps that an active process obtains access qualification of an allocated shared memory according to the current access state of the allocated shared memory;
Determining an array member variable corresponding to the target shared memory from the process lock array variables corresponding to the allocated shared memory;
determining a data bit corresponding to the active process from the array member variables, setting a value stored by the data bit as a value representing a lock state corresponding to access made by the active process, locking the target shared memory, and accessing the target shared memory;
The process lock array variable is an atomic variable and is arranged in the shared memory core area, the allocated shared memory is pre-allocated by the shared memory core area and is arranged in the shared memory user area, and the shared memory core area and the shared memory user area are both arranged in the user space.
The embodiment of the present application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor performs the steps of the process communication method described in the above method embodiment. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
From the foregoing description of the embodiments, those skilled in the art will readily appreciate that embodiments of the present application may be implemented in hardware, or by means of software plus a necessary general purpose hardware platform. Based on such understanding, the technical solution of the embodiments of the present application may be embodied in the form of a software product, where the software product may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
Those skilled in the art will appreciate that the drawing is merely a schematic representation of one preferred embodiment and that the modules or processes in the drawing are not necessarily required to practice the application.
Those skilled in the art will appreciate that modules in an apparatus of an embodiment may be distributed in an apparatus of an embodiment as described in the embodiments, and that corresponding changes may be made in one or more apparatuses different from the present embodiment. The modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.