Access method for a device and related components

CN115712510BActive Publication Date: 2026-08-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211581426.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-09
Publication Date
2026-08-18
Estimated Expiration
2042-12-09

AI Technical Summary

Technical Problem

现在的AWG板卡均基于单进程的操控方式,也即AWG板卡在同一时间只能处理一个指令,若有两个及以上的进程同时访问AWG板卡时,则会导致AWG板卡失去控制,需要重新加载和初始化AWG板卡后才能恢复正常

Benefits of technology

[0039] This application provides a device access method and related components, relating to the field of device access, and applied to a processor in a server. The server connects to the device. When the server receives a device access command, it generates an access process corresponding to the command. It then determines whether other processes are currently accessing the device. If no other processes are accessing the device, the access process directly accesses the device. If other processes are accessing the device, they access the device after the first process finishes its access. When multiple processes need to access the device, another process can only access the device after the first process finishes its access, preventing multiple processes from accessing the device simultaneously and causing loss of control. Furthermore, by allowing the next process to access the device after the first process finishes its access, the method prevents other processes from accessing the device independently, further avoiding the occurrence of multiple processes accessing the device simultaneously.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115712510B_ABST
    Figure CN115712510B_ABST
Patent Text Reader

Abstract

The application discloses an access method of a device and related components thereof, and relates to the field of device access. A server is connected with a device. When the server receives an access device instruction, the server generates a corresponding access process, and then judges whether other processes in the server are accessing the device. If no other process is accessing the device at this time, the device is directly accessed through the access process. If other processes are accessing the device, the device is accessed through the access process after the other processes are accessed. When multiple processes need to access the device, only one process can access the device after another process is accessed, so that the phenomenon that the device is out of control due to the simultaneous access of multiple processes is avoided. In addition, after the process is accessed, the device is accessed through the next process, so that the phenomenon that other processes access the device is avoided, and the phenomenon that multiple processes simultaneously access the device is further avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of device access, and in particular to a method for accessing a device and related components thereof. Background Technology

[0002] An AMG (Arbitrary Waveform Generator) is a signal generation device capable of producing complex, time-varying, multi-channel signals, widely used in military and scientific research fields. Current AMG boards are based on a single-process control method, meaning that an AMG board can only process one instruction at a time. If two or more processes access the AMG board simultaneously, it will cause the AMG board to lose control, requiring reloading and initialization to restore normal operation. Therefore, it is necessary to ensure that the AMG board can only be controlled by one process at a time. Summary of the Invention

[0003] The purpose of this invention is to provide a device access method and related components, which can prevent the device from losing control due to multiple processes accessing the device at the same time, and can also prevent other processes from accessing the device on their own, ensuring that the device can only be controlled by one process at a time.

[0004] To address the aforementioned technical problems, this invention provides a device access method, applied to a processor in a server, wherein the server is connected to the device, and the device access method includes:

[0005] When an access device instruction is received, an access process corresponding to the access device instruction is generated;

[0006] Determine if any other processes on the server are accessing the device;

[0007] If no other process is accessing the device, then the device is accessed through the accessing process;

[0008] If another process is accessing the device, then after the other process finishes its access, the accessing process will connect to the other process to access the device.

[0009] Preferably, before accessing the device through the access process, the method further includes:

[0010] A first instance corresponding to the access process is generated, and the device is accessed through the first instance via the access process.

[0011] After accessing the device through the access process, the process further includes:

[0012] Once the access process is complete, the first instance is deleted.

[0013] Preferably, before deleting the first instance, the method further includes:

[0014] Determine if any other processes require access to the device.

[0015] If so, the device is accessed through the first instance via the new other process;

[0016] If not, proceed to the step of deleting the first instance.

[0017] Preferably, determining whether other processes on the server are accessing the device includes:

[0018] Determine if the first instance exists;

[0019] If not, it is determined that no other process is accessing the device;

[0020] If so, it is determined that another process is accessing the device.

[0021] Preferably, accessing the device by connecting to other processes through the access process includes:

[0022] Retain the second instance corresponding to the other processes;

[0023] The device is accessed through the second instance via the access process.

[0024] After accessing the device through the other processes via the access process, the method further includes:

[0025] Once the access process is complete, the second instance is deleted.

[0026] Preferably, before deleting the second instance, the method further includes:

[0027] Determine whether any new processes need to access the device;

[0028] If so, the device is accessed via the second instance through the new other process;

[0029] If not, proceed to the step of deleting the second instance.

[0030] Preferably, accessing the device by connecting to other processes through the access process includes:

[0031] Create static objects corresponding to the other processes;

[0032] The access process uses the static object to access other processes to access the device.

[0033] This application also provides a device access device, including:

[0034] Memory, used to store computer programs;

[0035] A processor, used to implement the steps of the device access method as described above when executing the computer program.

[0036] This application also provides a server, including a server body and an access device as described above;

[0037] The server body is connected to the access device of the device.

[0038] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the device access method described above.

[0039] This application provides a device access method and related components, relating to the field of device access, and applied to a processor in a server. The server connects to the device. When the server receives a device access command, it generates an access process corresponding to the command. It then determines whether other processes are currently accessing the device. If no other processes are accessing the device, the access process directly accesses the device. If other processes are accessing the device, they access the device after the first process finishes its access. When multiple processes need to access the device, another process can only access the device after the first process finishes its access, preventing multiple processes from accessing the device simultaneously and causing loss of control. Furthermore, by allowing the next process to access the device after the first process finishes its access, the method prevents other processes from accessing the device independently, further avoiding the occurrence of multiple processes accessing the device simultaneously. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 A flowchart of a device access method provided in this application;

[0042] Figure 2 A schematic diagram of the structure of an access device for a device provided in this application;

[0043] Figure 3 This is a schematic diagram of the structure of a server provided in this application. Detailed Implementation

[0044] The core of this invention is to provide a device access method and related components, which can prevent the device from losing control due to multiple processes accessing the device at the same time, and can also prevent other processes from accessing the device on their own, ensuring that the device can only be controlled by one process at a time.

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] An AWG (Automatic Gauge Controller) is a signal generating device capable of producing complex time-varying multichannel signals. In the military field, it measures the parameters of complex radar, electronic reconnaissance, and IFF (Identification Friend or Foe) equipment, providing various digital modulation signals. It also has wide applications in scientific research, particularly in quantum computing measurement and control systems, where AWGs play a crucial role in the measurement and control of quantum chips. Currently, AWG board control is based on a single-process control method. When two or more processes access an AWG board simultaneously, multiple device handles appear, causing board control failure and waveform data transmission failure. This necessitates reloading and initializing the board before normal operation can resume, significantly reducing research and development efficiency.

[0047] To solve the above technical problems, please refer to... Figure 1 , Figure 1 A flowchart of a device access method provided in this application is applied to a processor in a server. The server is connected to the device, and the device access method includes:

[0048] S1: When a device access command is received, an access process corresponding to the device access command is generated;

[0049] A process refers to a single instance of a program running on a specific set of data. It is the basic unit for resource allocation and scheduling in a system and forms the foundation of the operating system architecture. Essentially, it's a single instance of a program with a certain independent function running on a specific set of data. A process is the basic unit of dynamic execution in an operating system. Generally, a process includes a text region, a data region, and a stack region. The text region stores the code executed by the processor; the data region stores variables and dynamically allocated memory used during process execution; and the stack region stores instructions for active procedure calls and local variables. Furthermore, since programs on a server are not inherently active, they only become active entities when the server's processor runs them. This activity is achieved through processes.

[0050] Servers typically have multiple software programs installed. Once these programs are running, they rely on server processes to perform various actions. Therefore, the server needs to create corresponding processes to support these actions. Similarly, when a user wants to access an AWG board or other device, they interact with some software on the server, generating a device access command. When the processor detects this command, it determines that the user needs to access the device and generates a corresponding access process to allow subsequent access to the device.

[0051] S2: Determine if any other processes on the server are accessing the device;

[0052] Because the server contains multiple software programs, besides the one the user is currently using, other programs may also be accessing the device. These other programs might be accessing the device automatically for their own business needs, or they might have been continuously accessing the device through other programs during previous user interactions. Each of these other programs requires an access process to facilitate its own access. Considering that the device operates on a single-process basis, multiple processes accessing the device simultaneously would cause device control to fail. Therefore, we can determine whether the device is currently accessible by checking if it is being accessed by another process. If so, the currently generated access process cannot access the device, thus preventing multi-process access. Specifically, methods for determining if other processes are accessing the device on the server include checking if the device is currently idle, checking if any processes on the server have a connection to the device, and checking if data is being received from the device indicating that it is being controlled.

[0053] S3: If no other process is accessing the device, then access the device through the accessing process;

[0054] If no other process is accessing the device, it means that no other software on the server is accessing the device at this time, that is, the device is in an idle state and can be accessed directly through this access process. Since the server is only accessing the device through this one access process, there will be no situation where multiple processes access the device.

[0055] S4: If other processes are accessing the device, then after the other processes finish accessing the device, the accessing process will take over the access to other processes to access the device.

[0056] When other processes are accessing the device, to avoid multiple processes accessing the device simultaneously, it's necessary to prevent the current process from directly accessing the device. This ensures that other processes currently accessing the device can still access it normally, and that the device itself can function properly. After another process finishes its access, considering that while the current process is waiting for that process to finish, new processes might be created that also need to access the device, these new processes will also be waiting. To ensure access is possible through the current process, after the current process finishes its access, it doesn't directly access the device. Instead, it's integrated into the previously accessing process. Since the previously accessing process still exists, new processes, detecting that another process is still accessing the device, won't directly access it. Therefore, if new processes are constantly being created before older processes finish, the earliest created process can be integrated into the older process based on their creation time. After the older process finishes its original access task, the new process uses the older process to perform its new access task. As for the specific access method, one approach is to establish an external access interface in the class corresponding to the process to provide access for other processes.

[0057] In summary, when the processor receives a device access command, it generates a corresponding access process. It then determines if any other processes on the server are currently accessing the device. If no other processes are accessing the device, the processor accesses the device directly through the access process. If other processes are accessing the device, they access the device only after the first process has finished its access. When multiple processes need to access the device, another process can only access the device after the first process has finished, preventing the device from becoming uncontrollable due to multiple processes accessing it simultaneously. Furthermore, by allowing the next process to access the device after the first process has finished, the processor prevents other processes from accessing the device independently, further avoiding the possibility of multiple processes accessing the device simultaneously.

[0058] Based on the above embodiments:

[0059] As a preferred embodiment, before accessing the device via the access process, the following steps are further included:

[0060] The first instance corresponding to the access process is generated, and the device is accessed through the first instance via the access process.

[0061] After accessing the device via the access process, the following is also included:

[0062] Once the access process is complete, delete the first instance.

[0063] To further prevent multiple processes from accessing the device simultaneously, this application employs a singleton pattern. The singleton pattern ensures that only one object is created in memory. When any program or process on the server needs to access the device using this instance, it will only use the already created instance and will not create additional instances. Even if the processor cannot effectively prevent multiple processes from accessing the device simultaneously due to errors or other interference, the fact that there is only one instance of the device object and only one process can use it at a time guarantees that only one process accesses the device at a time. In practical applications, when it is determined that no process is currently accessing the device, a first instance can be created for the current accessing process. After the current access process finishes, to avoid affecting the access tasks of other processes, the first instance is deleted so that other processes can create a new instance to access the device. Therefore, using the singleton pattern to access the device further prevents situations where multiple processes access the device simultaneously, thus ensuring the stability of device operation.

[0064] As a preferred embodiment, before deleting the first instance, the method further includes:

[0065] Determine if any new processes need to access the device;

[0066] If so, the device is accessed through the first instance via a new, separate process;

[0067] If not, proceed to the step of deleting the first instance.

[0068] To avoid the simultaneous creation of multiple instances, this application considers the possibility that multiple other processes may be waiting for the accessing process to finish its access. After the accessing process finishes, other processes may create their own instances to access the device. If there are many other processes, unexpected additional instances may be created, leading to multiple processes accessing the device. Therefore, if other processes are waiting for the accessing process to finish its access, the accessing process will not delete its own first instance after finishing its access. Instead, it will hand over the first instance to other processes for use. That is, it will not allow other processes to create their own instances, but will use the first instance as its own instance. This is equivalent to treating the other process as a new accessing process to access the device. When there are multiple other processes, since there is only one instance at this time, other processes will not create their own instances, and it can be guaranteed that only one process uses this one instance to access the device. Only when there are no other processes waiting for the accessing process to finish its access will the accessing process delete its own first instance after finishing its access. Based on this, the simultaneous creation of multiple instances can be avoided.

[0069] The specific implementation process of determining whether a first instance exists, creating an instance if no first instance exists, and calling the first instance if a first instance exists can be implemented in the following code file:

[0070]

[0071]

[0072] As a preferred embodiment, determining whether other processes on the server are accessing the device includes:

[0073] Determine if a first instance exists;

[0074] If not, it is determined that no other process is accessing the device;

[0075] If so, it is determined that another process is accessing the device.

[0076] To easily determine whether a process is accessing the device, this application employs a singleton pattern. Each software or process on the server needs to access the device through a specific instance. Therefore, the first instance acts as a necessary medium for the process to access the device. Thus, by determining whether a first instance specifically for accessing the device exists on the server, its presence indicates that a process is accessing the device; its absence indicates that no process is accessing the device. Based on this, determining the existence of a first instance provides a simple way to determine whether a process is accessing the device.

[0077] As a preferred embodiment, accessing the device by connecting to other processes through the access process includes:

[0078] Retain the second instance corresponding to other processes;

[0079] Access the device via a second instance through the access process;

[0080] After accessing the device by connecting to other processes through the access process, it also includes:

[0081] Once the access process is complete, delete the second instance.

[0082] To ensure the uniqueness of instances, this application considers that multiple processes may be waiting for the accessing process to finish its access before other processes finish accessing the device. When other processes finish their access, the accessing process will create a first instance to access the device. However, if a short-term error or interference occurs, other processes may also create instances, leading to multiple processes accessing the device. Therefore, if other processes besides the accessing process are waiting for their access to finish, after their access ends, the second instance used by those other processes is retained, and the accessing process is prevented from creating a first instance, and other processes are prevented from creating their own corresponding instances. Instead, the existing second instance is used as its own instance. Since only one instance exists at this time, it ensures that only one process uses this single instance to access the device. After the accessing process finishes its access, if no other process needs to access the device, the second instance is deleted so that subsequent processes can create their own corresponding instances. Only if no other process besides the accessing process is waiting for other processes to finish their access will the second instance be deleted after other processes finish their access, so that the accessing process can create a first instance. This ensures the uniqueness of instances.

[0083] As a preferred embodiment, before deleting the second instance, the method further includes:

[0084] Determine if any new processes need to access the device;

[0085] If so, the device is accessed through a second instance via a new, separate process;

[0086] If not, proceed to the step of deleting the second instance.

[0087] To ensure the uniqueness of instances, this application considers that while the accessing process is using a second instance left by other processes to access the device, new processes may need to access the device. That is, before the accessing process finishes using the second instance, other processes that need to access the device may appear. Therefore, it is also necessary to prevent new processes from creating instances. After the accessing process finishes, the second instance is retained so that new processes can continue to use the second instance left by other processes to access the device, instead of creating their own instance. This ensures that there is only one instance at this point. Based on this, the uniqueness of instances can be guaranteed.

[0088] As a preferred embodiment, accessing the device by connecting to other processes through the access process includes:

[0089] Create static objects corresponding to other processes;

[0090] Accessing a device allows other processes to access it by using static objects.

[0091] To prevent process access errors, this application allows for the creation of a custom global variable within the server's class corresponding to the access device. This global variable serves as the method for processes to access other processes. It can be referenced by all objects within the class. Furthermore, adding the `static` keyword before the global variable makes it a static object, i.e., a static global variable. This static object is exclusively owned by the class that defines the variable, meaning it is exclusively owned by the class containing other processes. If a process uses the `extern` keyword to declare a static global variable existing in another process, that process cannot use this static object. Therefore, since the processes accessing the device reside in the same class, this static object can only be used by the process accessing the device; other unrelated processes on the server cannot use this static object, thus avoiding the problem of incorrect process access.

[0092] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of an access device for a device provided in this application includes:

[0093] Memory 21 is used to store computer programs;

[0094] Processor 22 is configured to implement the steps of the device access method as described above when executing a computer program.

[0095] For a detailed description of the device access apparatus provided in this application, please refer to the embodiments of the device access method described above; further details will not be repeated here.

[0096] When processor 22 receives a device access command, it generates an access process corresponding to the command. It then determines whether any other processes on the server where processor 22 resides are currently accessing the device. If no other processes are accessing the device, the access process directly accesses the device. If other processes are accessing the device, the access process takes over after the first process finishes its access. When multiple processes need to access the device, another process can only access the device after the first process has finished, preventing the device from becoming uncontrollable due to multiple processes accessing it simultaneously. Furthermore, by allowing the next process to take over after the first process finishes its access, the system prevents other processes from accessing the device independently, further avoiding the occurrence of multiple processes accessing the device simultaneously.

[0097] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a server provided in this application includes a server body 31 and an access device 32 as described above;

[0098] The server body 31 is connected to the access device 32 of the equipment.

[0099] For a detailed description of the server provided in this application, please refer to the embodiments of the access method of the above-mentioned device; this application will not repeat the details here.

[0100] When the server body 31 receives a device access command, it generates an access process corresponding to the command. Then, the device access device 32 determines whether any other processes in the server body 31 are currently accessing the device. If no other processes are accessing the device, the access process directly accesses the device. If other processes are accessing the device, the access process takes over after the first process finishes its access. When multiple processes need to access the device, another process can only access the device after the first process has finished its access, preventing the device from becoming uncontrollable due to multiple processes accessing it simultaneously. Furthermore, by allowing the next process to access the device after the first process has finished its access, the system prevents other processes from accessing the device on their own, further avoiding the occurrence of multiple processes accessing the device simultaneously.

[0101] This application also provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the steps of the device access method described above.

[0102] For a detailed description of the computer-readable storage medium provided in this application, please refer to the embodiments of the access method of the above-described device; further details will not be repeated here.

[0103] When the server, where the processor resides, receives a device access command, it generates a corresponding access process. It then determines if any other processes are currently accessing the device. If no other processes are accessing the device, the access process directly takes over. If other processes are accessing the device, they take over after the first process finishes its access. When multiple processes need to access the device, another process can only access the device after the first process has finished, preventing the device from becoming uncontrollable due to simultaneous access. Furthermore, by allowing the next process to take over after the first process finishes its access, the system prevents other processes from accessing the device independently, further avoiding the possibility of multiple processes accessing the device simultaneously.

[0104] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0105] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0106] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0107] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0108] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for accessing a device, characterized in that, A processor used in a server, the server being connected to a device, the device being accessed via a method comprising: When an access device instruction is received, an access process corresponding to the access device instruction is generated; Determine if any other processes on the server are accessing the device; If no other process is accessing the device, a first instance corresponding to the accessing process is generated, and the accessing process accesses the device through the first instance. If another process is accessing the device, after the other process finishes its access, the second instance corresponding to the other process is retained, and the accessing process accesses the device through the second instance.

2. The method for accessing the device as described in claim 1, characterized in that, After the access process accesses the device through the first instance, it further includes: Once the access process is complete, the first instance is deleted.

3. The method for accessing the device as described in claim 2, characterized in that, Before deleting the first instance, the following is also included: Determine if any other processes require access to the device. If so, the device is accessed through the first instance via the new other process; If not, proceed to the step of deleting the first instance.

4. The method for accessing the device as described in claim 2, characterized in that, Determining whether other processes on the server are accessing the device includes: Determine if the first instance exists; If not, it is determined that no other process is accessing the device; If so, it is determined that another process is accessing the device.

5. The method for accessing the device as described in claim 2, characterized in that, After the access process accesses the device through the second instance, it also includes: Once the access process is complete, the second instance is deleted.

6. The method for accessing the device as described in claim 5, characterized in that, Before deleting the second instance, the following is also included: Determine whether any new processes need to access the device; If so, the device is accessed via the second instance through the new other process; If not, proceed to the step of deleting the second instance.

7. The method for accessing the device as described in any one of claims 1 to 6, characterized in that, Accessing the device by connecting to other processes through the access process includes: Create static objects corresponding to the other processes; The access process uses the static object to access other processes to access the device.

8. A device access device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the device access method as claimed in any one of claims 1 to 7 when executing the computer program.

9. A server, characterized in that, It includes the server body and the access device of the device as described in claim 8; The server body is connected to the access device of the device.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the device access method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Process management method and device, computer equipment and storage medium

    CN112346879A

  • Storage space access method, system and device and medium

    CN114936105A