Method for concurrent resource state

CN114428673BActive Publication Date: 2026-09-22BEIJING GW TECH +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111637311.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2026-09-22
Estimated Expiration
2041-12-29

AI Technical Summary

Benefits of technology

[0045]本申请实施例在接收到申请第一资源的第一状态的第一任务时,若查询到第一资源的第二状态正在被任务使用,则阻塞第一任务,且,当检测到针对第一资源的第二状态的所有任务都执行完毕时,释放对申请第一资源的所有状态的所有任务的阻塞;其中,第一资源支持包括第一状态和第二状态在内的多种互斥的状态,从而提高了并发访问资源状态的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114428673B_ABST
    Figure CN114428673B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method for concurrently applying for resource states. The method comprises: receiving a first task applying for a first state of a first resource; querying that a second state of the first resource is being used by other tasks; blocking the first task, and when detecting that all tasks applying for all states of the first resource have been executed, releasing the blocking of all tasks applying for all states of the first resource; wherein the first resource supports mutually exclusive multiple states including the first state and the second state. Embodiments of the present application improve the efficiency of concurrent access to resource states.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data communication technology, and in particular to a method for concurrently requesting resource status. Background Technology

[0002] Existing multi-task contention protection locks can be divided into two main categories based on application complexity: basic locks and advanced locks.

[0003] I. Basic locks, which are generally provided directly by the operating system, commonly include: atomic operations, mutexes, semaphores, and condition variables.

[0004] II. Advanced locks, typically provided by the programming language compiler, are used to protect shared resources with certain application characteristics. They are generally extended by combining application-based locks and encapsulating protection logic to define a more advanced protection scheme. For example, read-write locks are suitable for read-heavy, write-light shared resources; when multiple tasks access the resource simultaneously, their sharing efficiency is far higher than that of ordinary mutex locks.

[0005] There is no standard solution for protecting and switching resource states. Common implementation methods include the following three:

[0006] Method 1: In a single-task environment, the state of resources does not need to be protected and can be accessed and switched on demand at any time.

[0007] Method 2: In a multi-tasking environment, the resource is maintained entirely by one task. Concurrent accesses to this resource by other tasks are queued in this task's queue and processed sequentially.

[0008] Method 3: In a multi-tasking environment, the state of resources is protected using mutex locks. All concurrent accesses to this resource are locked by the mutex lock, queued in the mutex lock's queue, and processed sequentially.

[0009] Method 1 is obviously only suitable for simple application environments. Common systems and software are usually multi-tasking.

[0010] Method 2 and Method 3 have similar concurrent access efficiency; however, Method 2 is more complex to implement, involving inter-task interaction and typically requiring message queues and condition variables. In contrast, Method 3 is simpler, achieving the same effect with only mutex lock access. Therefore, Method 3 is currently the most commonly used state protection method.

[0011] Method 3 uses mutex locks to protect the resource state, which is feasible; however, it significantly reduces the efficiency of concurrent access. Using read-write locks to protect a resource's state can at least improve the concurrency of a large number of read accesses in that state. However, read-write locks cannot meet all the needs of resource state protection and switching. Each state of a resource requires a read-write lock for protection, and state switching requires additional mutex locks. Summary of the Invention

[0012] This application provides a method for concurrently requesting resource states, as well as a readable storage medium and an electronic device, to improve the efficiency of concurrent access to resource states.

[0013] The technical solution of this application embodiment is implemented as follows:

[0014] A method for concurrently requesting resource states, the method comprising:

[0015] The first task upon receiving the first request for the first resource, in its first state;

[0016] If the query finds that the second state of the first resource is being used by other tasks;

[0017] Block the first task, and when it is detected that all tasks for the second state of the first resource have been completed, release the block on all tasks for all states that requested the first resource.

[0018] The first resource includes multiple mutually exclusive states, including the first state and the second state.

[0019] The second state that the first resource is found to be in use by other tasks includes:

[0020] Determine if the reference count of the second state of the first resource is 0. If it is not 0, then determine that the second state of the first resource is being used by other tasks.

[0021] The step of detecting that all tasks for the second state of the first resource have been completed includes:

[0022] When the reference count of the second state of the first resource is detected to be 0.

[0023] After the query finds that the second state of the first resource is being used by other tasks and before the first task is blocked, the process further includes:

[0024] Determine whether the current physical state of the first resource is the second state;

[0025] If it is not in the second state, then switch the current physical state of the first resource to the second state.

[0026] The blocking of the first task includes:

[0027] Increment the blocked task count of the first resource by 1;

[0028] Furthermore, the release of the block on all tasks in all states that have requested the first resource includes:

[0029] Clear the blocked task count for the first resource to zero.

[0030] Increasing the blocked task count of the first resource by 1 further includes:

[0031] Decrease the state switching signal value of the first resource by 1;

[0032] While resetting the blocked task count of the first resource to zero, the method further includes:

[0033] Restore the state switching signal value of the first resource to its initial value of 1.

[0034] After releasing the blockade on all tasks in all states that requested the first resource, the process further includes:

[0035] A. Determine if the current physical state of the first resource is the first state. If yes, proceed to step B; otherwise, change the current physical state of the first resource to the first state and then proceed to step B.

[0036] B. Increment the reference count of the first state by 1, check if the reference count of the first state is equal to 2. If so, decrement the state switching signal value of the first resource by 1, and increment the blocking task count of the first resource by 1 to confirm that the application for the first state was successful.

[0037] After receiving the first task of the first state of the request for the first resource, the process further includes:

[0038] If the query finds that the first state of the first resource is being used by other tasks, then the first state of the first resource will be obtained directly.

[0039] The first state of the first resource being found to be in use by other tasks includes:

[0040] The query shows that the current physical state of the first resource is the first state.

[0041] If it is found that the first state of the first resource is being used by other tasks, the process further includes:

[0042] Increment the reference count of the first state by 1. Check if the reference count of the first state is equal to 1. If it is, decrement the state switching signal value of the first resource by 1 and increment the blocking task count of the first resource by 1.

[0043] The first resource is a PHY chip;

[0044] Furthermore, the first state is an electrical port medium and the second state is an optical port medium, or the first state is an optical port medium and the second state is an electrical port medium.

[0045] In this embodiment of the application, when a first task requests a first state of a first resource is received, if it is found that a second state of the first resource is being used by a task, the first task is blocked. Furthermore, when it is detected that all tasks requesting the second state of the first resource have been completed, the blocking of all tasks requesting all states of the first resource is released. The first resource supports multiple mutually exclusive states, including the first state and the second state, thereby improving the efficiency of concurrent access to resource states. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 A flowchart illustrating a method for concurrently requesting resource status according to an embodiment of this application;

[0048] Figure 2 A flowchart illustrating a method for concurrently requesting resource status, as provided in another embodiment of this application;

[0049] Figure 3 A flowchart illustrating a method for concurrently requesting a PHY chip as provided in yet another embodiment of this application;

[0050] Figure 4 A flowchart illustrating a method for releasing a PHY chip according to an embodiment of this application;

[0051] Figure 5 This is an exemplary structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0054] The technical solution of this application will be described in detail below with reference to specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0055] Figure 1 A flowchart illustrating a method for concurrently requesting resource status according to an embodiment of this application is provided, and its specific steps are as follows:

[0056] Step 101: Receive the first task of the first state of requesting the first resource.

[0057] Step 102: If the query finds that the second state of the first resource is being used by other tasks.

[0058] Step 103: Block the first task, and when it is detected that all tasks for the second state of the first resource have been completed, release the block on all tasks for all states that requested the first resource; wherein, the first resource supports multiple mutually exclusive states including the first state and the second state.

[0059] In one optional embodiment, step 102, which involves querying whether the second state of the first resource is being used by other tasks, includes: determining whether the reference count of the second state of the first resource is 0; if it is not 0, then determining that the second state of the first resource is being used by other tasks.

[0060] In step 103, when it is detected that all tasks for the second state of the first resource have been completed, including when it is detected that the reference count of the second state of the first resource is 0.

[0061] In one optional embodiment, after step 102 and before step 103, the method further includes: determining whether the current physical state of the first resource is the second state; if it is not the second state, then switching the current physical state of the first resource to the second state.

[0062] In one optional embodiment, step 103, blocking the first task includes: incrementing the blocking task count of the first resource by 1;

[0063] Furthermore, in step 103, releasing the blocking of all tasks in all states that request the first resource includes: clearing the blocking task count for the first resource to zero.

[0064] In one optional embodiment, step 103, while incrementing the blocking task count of the first resource by 1, further includes: decrementing the state switching signal value of the first resource by 1.

[0065] Furthermore, in step 103, while clearing the blocking task count of the first resource to zero, it further includes restoring the state switching signal value of the first resource to the initial value of 1.

[0066] In an optional embodiment, after releasing the blocking of all tasks in all states that have requested the first resource in step 103, the method further includes:

[0067] A. Determine if the current physical state of the first resource is the first state. If yes, proceed to step B; otherwise, change the current physical state of the first resource to the first state and then proceed to step B.

[0068] B. Increment the reference count of the first state by 1, check if the reference count of the first state is equal to 2. If so, decrement the state switching signal value of the first resource by 1, and increment the blocking task count of the first resource by 1 to confirm that the application for the first state was successful.

[0069] In one optional embodiment, after receiving the first task requesting the first state of the first resource in step 101, the method further includes: if it is found that the first state of the first resource is being used by other tasks, then it is determined that the first state of the first resource can be directly obtained.

[0070] In one optional embodiment, querying that the first state of the first resource is being used by other tasks includes: querying that the current physical state of the first resource is the first state.

[0071] In one optional embodiment, if it is found that the first state of the first resource is being used by other tasks, the method further includes: incrementing the reference count of the first state by 1, determining whether the reference count of the first state is equal to 1, and if so, decrementing the state switching signal value of the first resource by 1 and incrementing the blocking task count of the first resource by 1.

[0072] In one optional embodiment, the first resource is a PHY chip; and the first state is an electrical port medium and the second state is an optical port medium, or the first state is an optical port medium and the second state is an electrical port medium.

[0073] Figure 2A flowchart illustrating a method for concurrently requesting resource status according to another embodiment of this application is provided, and the specific steps are as follows:

[0074] Step 201: Upon receiving the first task in the first state of requesting the first resource, place the first task into the task queue for the first state.

[0075] The first task refers to the read or write task of the register of the first resource in the first state.

[0076] Step 202: If the reference count of the second state of the first resource is not 0, it is determined that the second state of the first resource is being used by other tasks.

[0077] Step 203: Determine whether the current physical state of the first resource is the second state. If yes, proceed to step 205; otherwise, proceed to step 204.

[0078] Step 204: Switch the current physical state of the first resource to the second state.

[0079] Step 205: Increment the blocking task count of the first resource by 1, and decrement the state switching signal value of the first resource by 1.

[0080] Step 206: When the reference count of the second state of the first resource is detected to be 0, the blocking task count of the first resource is cleared to zero, and the state switching signal value of the first resource is restored to the initial value of 1.

[0081] The fact that the reference count for the second state of the first resource is 0 indicates that all tasks for the second state of the first resource have been completed.

[0082] Step 207: Determine whether the current physical state of the first resource is the first state. If yes, proceed to step 209; otherwise, proceed to step 208.

[0083] Step 208: Change the current physical state of the first resource to the first state.

[0084] Step 209: Increment the reference count of the first state by 1.

[0085] Step 210: Determine if the reference count of the first state is equal to 1. If yes, proceed to step 211; otherwise, proceed to step 212.

[0086] Step 211: Decrement the state switching signal value of the first resource by 1, and increment the blocking task count of the first resource by 1.

[0087] The initial value of the reference count in the first state is 0. Therefore, if the reference count in the first state is equal to 1, it means that the first task received in step 201 is the first task for the first state.

[0088] Step 212: Take tasks sequentially from the task queue for the first state and execute the operations for the first state.

[0089] The above embodiments implement concurrent request protection and automatic switching of multiple states of a resource, greatly improving the efficiency and throughput of concurrent access to resource states, without increasing implementation complexity. All protection logic is hidden, resulting in excellent encapsulation. A polymorphic lock can be implemented by combining three basic elements: a state transition signal with an initial value of 1 as a state lock, the reference count of each state as an atomic lock, and a blocking task counter to count the number of task locks.

[0090] The execution entity for steps 201-213 can be the control module.

[0091] A PHY chip that supports COMBO (optical-electrical multiplexing) ports can operate on both electrical and optical media, but can only operate on one medium at a time.

[0092] For a PHY chip to provide state protection for two media, it must at least meet the following three requirements:

[0093] 1. The electrical or optical port media status of the PHY chip needs to be applied for before it can be obtained. If the current physical media status (electrical or optical port) of the PHY chip matches the applied media (electrical or optical port), the status can be obtained immediately; otherwise, it is necessary to wait until the current media is released.

[0094] 2. When releasing the current medium (electrical or optical port), the medium state can only be switched and the waiting task queue that requested the medium can be woken up if the current medium's reference count is 0.

[0095] 3. If the PHY chip automatically switches its physical media state due to reasons such as restart, it is necessary to immediately restore its physical media state to the currently referenced software media state.

[0096] Clearly, the above three requirements cannot be met by a single basic lock or read-write lock. The polymorphic lock provided in this application, however, can meet the concurrent access and switching requirements for state protection needed by the PHY chip.

[0097] The following uses the PHY chip as an example to illustrate this application in detail:

[0098] Figure 3 This is a flowchart illustrating a method for concurrently applying for a PHY chip medium, as provided in another embodiment of this application. This embodiment takes the application for the electrical port medium of a PHY chip as an example, and the specific steps are as follows:

[0099] Step 300: Initialize the reference count of the electrical port medium of the PHY chip to 0, initialize the reference count of the optical port medium of the PHY chip to 0, initialize the medium state switching signal value of the PHY chip to 1, and initialize the blocking task count of the PHY chip to 0.

[0100] Step 301: Receive the first task for requesting the electrical port medium of the PHY chip, and put the first task into the task queue for the electrical port medium.

[0101] Step 302: Determine whether the reference count of the optical port medium of the PHY chip is 0. If yes, proceed to step 307; otherwise, proceed to step 303.

[0102] Step 303: Determine whether the current physical medium state of the PHY chip is an optical port. If yes, proceed to step 305; otherwise, proceed to step 304.

[0103] Step 304: Switch the current physical medium state of the PHY chip to optical port.

[0104] Step 305: Increment the blocking task count of the PHY chip by 1, and decrement the media state switching signal value of the PHY chip by 1.

[0105] Step 306: If the blocking task count of the PHY chip is cleared to zero and the media state switching signal value of the PHY chip is restored to 1, then proceed to step 307.

[0106] Step 307: Determine whether the current physical medium state of the PHY chip is an electrical port. If yes, proceed to step 309; otherwise, proceed to step 308.

[0107] Step 308: Switch the current physical medium state of the PHY chip to electrical port.

[0108] Step 309: Increment the reference count of the electrical port medium of the PHY chip by 1.

[0109] Step 310: Determine whether the reference count of the electrical port medium of the PHY chip is equal to 1. If yes, proceed to step 312; otherwise, proceed to step 313.

[0110] Step 312: Increment the blocking task count of the PHY chip by 1, and decrement the media state switching signal value of the PHY chip by 1.

[0111] Step 313: Confirm that the application for the PHY chip's electrical port medium was successful, retrieve tasks sequentially from the task queue for the electrical port medium, and execute the operations for the electrical port medium.

[0112] The above embodiments provide a method flow for applying for the electrical port medium of the PHY chip. The method flow for applying for the optical port medium of the PHY chip is similar and will not be described again.

[0113] Figure 4 This is a flowchart of a method for releasing the medium of a PHY chip according to an embodiment of this application. This embodiment takes releasing the optical port medium of a PHY chip as an example, and the specific steps are as follows:

[0114] Step 401: If a task is detected to release the optical port medium of the PHY chip, decrement the reference count of the optical port medium of the PHY chip by 1.

[0115] Step 402: Determine whether the reference count of the optical port medium of the PHY chip is 0. If yes, proceed to step 403; otherwise, return to step 401.

[0116] Step 403: Clear the blocking task count of the PHY chip to zero and restore the medium state switching signal value of the PHY chip to 1. At this point, the optical port medium release of the PHY chip is complete.

[0117] If the reference count of the optical port medium of the PHY chip is 0, it means that all tasks for the optical port medium of the PHY chip have been completed.

[0118] The above embodiments provide a method flow for releasing the port medium of the PHY chip. The method flow for releasing the electro-optical port medium of the PHY chip is similar and will not be described again.

[0119] This application also provides a computer-readable storage medium that stores instructions, which, when executed by a processor, can perform the steps in the method for concurrently requesting resource states as described above. In practical applications, the computer-readable medium may be included in the devices / apparatus / systems described above, or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium stores instructions, which, when executed by a processor, can perform the steps in the method for concurrently requesting resource states as described above.

[0120] According to the embodiments disclosed in this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof, but not intended to limit the scope of protection of this application. In the embodiments disclosed in this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0121] like Figure 5 As shown, this application also provides an electronic device. Figure 5 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:

[0122] The electronic device may include a processor 51 with one or more processing cores, a memory 52 with one or more computer-readable storage media, and a computer program stored in the memory and executable on the processor. When the program in the memory 52 is executed, the method for concurrently requesting resource states described above can be implemented.

[0123] Specifically, in practical applications, this electronic device may also include components such as a power supply 53 and an input / output unit 54. Those skilled in the art will understand that... Figure 5 The structure of the electronic device shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0124] The processor 51 is the control center of the electronic device. It connects various parts of the electronic device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 52, and calling data stored in the memory 52, it performs various functions of the server and processes data, thereby monitoring the electronic device as a whole.

[0125] The memory 52 can be used to store software programs and modules, i.e., the aforementioned computer-readable storage medium. The processor 51 executes various functional applications and data processing by running the software programs and modules stored in the memory 52. ​​The memory 52 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on server usage, etc. Furthermore, the memory 52 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 52 may also include a memory controller to provide the processor 51 with access to the memory 52.

[0126] The electronic device also includes a power supply 53 that supplies power to the various components. This power supply can be logically connected to the processor 51 via a power management system, enabling functions such as charging, discharging, and power consumption management. The power supply 53 may also include one or more DC or AC power supplies, a recharging system, a power fault detection circuit, a power converter or inverter, a power status indicator, or any other components.

[0127] The electronic device may also include an input / output unit 54, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. The input unit output 54 can also be used to display information input by the user or information provided to the user, as well as various graphical user interfaces, which can be composed of graphics, text, icons, video, and any combination thereof.

[0128] In yet another embodiment of this application, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the method for concurrently requesting resource states as described in the foregoing embodiments.

[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments disclosed in this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings. For example, two blocks shown connectedly may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0130] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application can be combined and / or combined in various ways, and all such combinations and / or combinations fall within the scope of this application.

[0131] This document uses specific embodiments to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this application, and are not intended to limit this application. For those skilled in the art, changes can be made to the specific implementation methods and application scope based on the ideas, spirit and principles of this application. Any modifications, equivalent substitutions, improvements, etc., made should be included within the scope of protection of this application.

Claims

1. A method for concurrently requesting resource states, characterized in that, The method includes: Upon receiving the first task for the first state of the request for the first resource, the first task is placed in the task queue for the first state, wherein the first task is a read task or a write task for the register of the first state of the first resource. If the query finds that the second state of the first resource is being used by other tasks; wherein the first resource is a PHY chip that supports optoelectronic multiplexing ports, the PHY chip can work on both electrical and optical media, but can only work on one medium at a time, and the electrical or optical media state of the PHY chip needs to be applied for; and the first state is electrical media and the second state is optical media, or the first state is optical media and the second state is electrical media; Block the first task, and when it is detected that all tasks for the second state of the first resource have been completed, release the block on all tasks for all states that requested the first resource, take out tasks from the task queue for the first state in sequence, and execute the operation for the first state. The first resource includes multiple mutually exclusive states, including the first state and the second state. The blocking of the first task includes: incrementing the blocking task count of the first resource by 1; and the release of the blocking of all tasks in all states of requesting the first resource includes: clearing the blocking task count of the first resource to zero.

2. The method according to claim 1, characterized in that, The second state that the first resource is found to be in use by other tasks includes: Determine if the reference count of the second state of the first resource is 0. If it is not 0, then determine that the second state of the first resource is being used by other tasks. The step of detecting that all tasks for the second state of the first resource have been completed includes: When the reference count of the second state of the first resource is detected to be 0.

3. The method according to claim 1, characterized in that, After the query finds that the second state of the first resource is being used by other tasks and before the first task is blocked, the process further includes: Determine whether the current physical state of the first resource is the second state; If it is not in the second state, then switch the current physical state of the first resource to the second state.

4. The method according to claim 1, characterized in that, Increasing the blocked task count of the first resource by 1 further includes: Decrease the state switching signal value of the first resource by 1; While resetting the blocked task count of the first resource to zero, the method further includes: Restore the state switching signal value of the first resource to its initial value of 1.

5. The method according to claim 1 or 4, characterized in that, After releasing the blockade on all tasks in all states that requested the first resource, the process further includes: A. Determine if the current physical state of the first resource is the first state. If yes, proceed to step B; otherwise, change the current physical state of the first resource to the first state and then proceed to step B. B. Increment the reference count of the first state by 1, check if the reference count of the first state is equal to 2. If so, decrement the state switching signal value of the first resource by 1, and increment the blocking task count of the first resource by 1 to confirm that the application for the first state was successful.

6. The method according to claim 1, characterized in that, After receiving the first task of the first state of the request for the first resource, the process further includes: If the query finds that the first state of the first resource is being used by other tasks, then the first state of the first resource will be obtained directly.

7. The method according to claim 6, characterized in that, The first state of the first resource being found to be in use by other tasks includes: The query shows that the current physical state of the first resource is the first state.

8. The method according to claim 6 or 7, characterized in that, If it is found that the first state of the first resource is being used by other tasks, the process further includes: Increment the reference count of the first state by 1. Check if the reference count of the first state is equal to 1. If it is, decrement the state switching signal value of the first resource by 1 and increment the blocking task count of the first resource by 1.

Citation Information

Patent Citations

  • Communication method and device

    CN109165182A

  • Server internet interface management method and system and baseboard management controller

    CN110413322A

  • Lockless execution in read-mostly workloads for efficient concurrent process execution on shared resources

    US20180074865A1