CN114428673A - Method for concurrently applying resource state - Google Patents

Method for concurrently applying resource state Download PDF

Info

Publication number
CN114428673A
CN114428673A CN202111637311.5A CN202111637311A CN114428673A CN 114428673 A CN114428673 A CN 114428673A CN 202111637311 A CN202111637311 A CN 202111637311A CN 114428673 A CN114428673 A CN 114428673A
Authority
CN
China
Prior art keywords
state
resource
tasks
task
blocking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111637311.5A
Other languages
Chinese (zh)
Inventor
李伟
宋卿
吴孟圆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gw Delight Communication Technology Co ltd
Gw Delight Technology Co ltd
Beijing Gw Technologies Co ltd
Original Assignee
Beijing Gw Delight Communication Technology Co ltd
Gw Delight Technology Co ltd
Beijing Gw Technologies Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gw Delight Communication Technology Co ltd, Gw Delight Technology Co ltd, Beijing Gw Technologies Co ltd filed Critical Beijing Gw Delight Communication Technology Co ltd
Priority to CN202111637311.5A priority Critical patent/CN114428673A/en
Publication of CN114428673A publication Critical patent/CN114428673A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method for concurrently applying resource states. The method comprises the following steps: receiving a first task applying for a first state of a first resource; querying that the second state of the first resource is being used by other tasks; blocking the first task, and releasing the blocking of all tasks applying for the first resource in all states when detecting that all tasks aiming at the second state of the first resource are executed completely; wherein the first resource supports a plurality of mutually exclusive states including a first state and a second state. The embodiment of the application improves the efficiency of concurrent access to the resource state.

Description

Method for concurrently applying resource state
Technical Field
The embodiment of the application relates to the technical field of data communication, in particular to a method for concurrently applying resource states.
Background
The existing multi-task competition protection lock can be divided into a basic lock and a high-level lock according to the application complexity, wherein:
a basic lock, generally provided directly by an operating system, commonly includes: atomic operations (atomic), mutexes (mutex), semaphores (semaphores), condition quantities (conditions), and the like.
Two, high-level locks, typically provided by development language compiler packages, are used to protect shared resources with certain application characteristics. An advanced protection scheme is defined by encapsulating protection logic, typically by combining application-based locks. For example, the read-write lock is suitable for a shared resource with more reads and less writes, and when a plurality of tasks simultaneously read and access the resource, the sharing efficiency is far higher than that of the common mutual exclusion lock.
There is no standard solution for protection and switching of resource states. The following three general implementation methods are available:
method 1, in a single task environment, the state of the resource does not need to be protected, and the resource can be accessed and switched according to the requirement at any time.
And 2, in a multi-task environment, resources are maintained by one task full right. The concurrent access of other tasks to the resource is queued in the queue of the task and processed serially in turn.
And 3, in a multitask environment, the state of the resource is protected by using a mutual exclusion lock. All concurrent accesses to the resource are locked by the mutual exclusion lock, queued in a queue of the mutual exclusion lock, and serially processed in sequence.
The method 1 is obviously only suitable for simple application environments, and common systems and software are usually multi-task.
The concurrent access efficiency of the method 2 and the method 3 is not very different, but the method 2 is more complex to implement, involves interaction among tasks, and usually needs to be used in cooperation with a message queue, a condition quantity and the like. Compared with the prior art, the method 3 is simpler and can achieve the same effect only by the access of the mutual exclusion lock. Therefore, method 3 is the most commonly used state protection method at present.
Method 3 uses mutual exclusion locks to protect the state of resources, although the scheme is feasible; however, concurrent access efficiency is greatly reduced. If a state of the resource is protected by the read-write lock, the concurrency rate of a large number of read accesses in the state can be at least improved. However, read-write locks do not satisfy all the requirements for resource state protection and switching. Each state of a resource requires a read-write lock to protect, and the switching of states requires additional mutex lock protection.
Disclosure of Invention
The embodiment of the application provides a method for concurrently applying a resource state, a readable storage medium and an electronic device, so as to improve the efficiency of concurrently accessing the resource state.
The technical scheme of the embodiment of the application is realized as follows:
a method of concurrently applying for resource status, the method comprising:
receiving a first task applying for a first state of a first resource;
if the second state of the first resource is inquired to be used by other tasks;
blocking the first task, and releasing the blocking of all tasks applying for all states of the first resource when detecting that all tasks aiming at the second state of the first resource are completely executed;
the first resource comprises a plurality of mutually exclusive states including a first state and a second state.
The querying to a second state of the first resource being used by other tasks includes:
judging whether the reference count of the second state of the first resource is 0 or not, and if not, determining that the second state of the first resource is being used by other tasks;
when it is detected that all tasks in the second state for the first resource are executed, the method includes:
the reference count of the second state of the first resource is detected to be 0.
The querying to the second state of the first resource after being used by other tasks and before the blocking the first task further comprises:
judging whether the current physical state of the first resource is a second state;
and if the current physical state of the first resource is not the second state, switching the current physical state of the first resource to the second state.
The blocking of the first task comprises:
adding 1 to the blocked task count for the first resource;
and, the releasing the blocking of all tasks applying for all states of the first resource includes:
and clearing the blocking task count of the first resource.
While the increasing the blocked task count of the first resource by 1, the method further includes:
subtracting 1 from the state switching signal value of the first resource;
when the blocking task count of the first resource is cleared, the method further includes:
and restoring the state switching signal value of the first resource to the initial value 1.
After releasing the blocking of all tasks applying for all states of the first resource, the method further comprises:
A. b, judging whether the current physical state of the first resource is a first state or not, if so, executing the step B; if not, changing the current physical state of the first resource into the first state, and then executing the step B;
B. and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 2, if so, subtracting 1 from the state switching signal value of the first resource, adding 1 to the blocking task count of the first resource, and determining that the first state is successfully applied.
After receiving the first task applying for the first state of the first resource, the method further includes:
and if the first state of the first resource is inquired to be used by other tasks, determining to directly acquire the first state of the first resource.
The querying to a first state of a first resource being used by other tasks includes:
and inquiring that the current physical state of the first resource is the first state.
After querying that the first state of the first resource is being used by other tasks, the method further includes:
and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 1, if so, subtracting 1 from the state switching signal value of the first resource, and adding 1 to the blocking task count of the first resource.
The first resource is a PHY chip;
and, the first state is an electrical port medium, the second state is an optical port medium, or the first state is an optical port medium, the second state is an electrical port medium.
When receiving a first task applying for a first state of a first resource, if a second state of the first resource is inquired to be used by the task, blocking the first task, and when detecting that all tasks of the second state of the first resource are completely executed, releasing the blocking of all tasks of all states applying for the first resource; the first resource supports a plurality of mutually exclusive states including a first state and a second state, so that the efficiency of concurrent access to the resource state is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a flowchart of a method for concurrently applying for a resource status according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for concurrently applying for resource status according to another embodiment of the present application;
fig. 3 is a flowchart of a method for concurrently applying for media of PHY chips according to another embodiment of the present disclosure;
fig. 4 is a flowchart of a method for releasing media of a PHY chip according to an embodiment of the present disclosure;
fig. 5 is an exemplary structural schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present application will be described in detail with specific examples. Several of the following embodiments may be combined with each other and some details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 1 is a flowchart of a method for concurrently applying for a resource status according to an embodiment of the present application, which includes the following specific steps:
step 101: a first task is received that applies for a first state of a first resource.
Step 102: if the second state of the first resource is being used by other tasks.
Step 103: blocking the first task, and releasing the blocking of all tasks applying for all states of the first resource when detecting that all tasks aiming at the second state of the first resource are completely executed; wherein the first resource supports a plurality of mutually exclusive states including a first state and a second state.
In an alternative embodiment, the querying 102 that the second state of the first resource is being used by other tasks includes: judging whether the reference count of the second state of the first resource is 0 or not, and if not, determining that the second state of the first resource is being used by other tasks;
in step 103, when it is detected that all tasks in the second state for the first resource are executed, the method includes: the reference count of the second state of the first resource is detected to be 0.
In an alternative embodiment, after step 102 and before step 103, the method further includes: judging whether the current physical state of the first resource is a second state; and if the current physical state of the first resource is not the second state, switching the current physical state of the first resource to the second state.
In an alternative embodiment, blocking the first task in step 103 includes: adding 1 to the blocked task count of the first resource;
and, in step 103, releasing the blocking of all tasks applying for all states of the first resource, including: and clearing the blocking task count of the first resource.
In an optional embodiment, in step 103, while adding 1 to the blocked task count of the first resource, the method further includes: subtracting 1 from the state switching signal value of the first resource;
in step 103, while clearing the blocking task count of the first resource, the method further includes: and restoring the state switching signal value of the first resource to the initial value 1.
In an optional embodiment, in step 103, after releasing the blocking for all tasks applying for all states of the first resource, the method further includes:
A. b, judging whether the current physical state of the first resource is a first state or not, if so, executing the step B; if not, changing the current physical state of the first resource into the first state, and then executing the step B;
B. and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 2, if so, subtracting 1 from the state switching signal value of the first resource, adding 1 to the blocking task count of the first resource, and determining that the first state is successfully applied.
In an optional embodiment, in step 101, after receiving the first task applying for the first state of the first resource, the method further includes: and if the first state of the first resource is inquired to be used by other tasks, determining to directly acquire the first state of the first resource.
In an alternative embodiment, querying that the first state of the first resource is being used by other tasks includes: and inquiring that the current physical state of the first resource is the first state.
In an optional embodiment, after querying that the first state of the first resource is being used by other tasks, the method further includes: and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 1, if so, subtracting 1 from the state switching signal value of the first resource, and adding 1 to the blocking task count of the first resource.
In an optional embodiment, the first resource is a PHY chip; and the first state is an electrical interface medium and the second state is an optical interface medium, or the first state is an optical interface medium and the second state is an electrical interface medium.
Fig. 2 is a flowchart of a method for concurrently applying for a resource status according to another embodiment of the present application, which includes the following specific steps:
step 201: the method comprises the steps of receiving a first task applying for a first state of a first resource, and placing the first task into a task queue aiming at the first state.
The first task refers to a read task or a write task of a register for a first state of the first resource.
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.
Step 203: judging whether the current physical state of the first resource is the second state, if yes, executing step 205; otherwise, step 204 is performed.
Step 204: the current physical state of the first resource is switched to a second state.
Step 205: the blocking task count of the first resource is incremented by 1 and the state switch signal value of the first resource is decremented by 1.
Step 206: and when the reference count of the second state of the first resource is detected to be 0, clearing the blocking task count of the first resource, and restoring the state switching signal value of the first resource to an initial value of 1.
A reference count of 0 for the second state of the first resource indicates that all tasks for the second state of the first resource have been performed.
Step 207: judging whether the current physical state of the first resource is the first state, if yes, executing step 209; if not, go to step 208.
Step 208: the current physical state of the first resource is changed to the first state.
Step 209: the reference count for the first state is incremented by 1.
Step 210: determining whether the reference count of the first state is equal to 1, if yes, go to step 211; otherwise, step 212 is performed.
Step 211: the state switch signal value of the first resource is decremented by 1 and the blocking task count of the first resource is incremented by 1.
The initial value of the reference count of the first state is 0, so if the reference count of the first state is equal to 1, it indicates that the first task received in step 201 is the first task for the first state.
Step 212: and taking out the tasks from the task queue aiming at the first state in sequence, and executing the operation aiming at the first state.
The embodiment realizes the concurrent application protection and the automatic switching of multiple states of one resource, greatly improves the efficiency and the throughput of the concurrent access resource state, does not increase the realization complexity, hides all protection logics and has excellent encapsulation. By: and 1 state switching signal with an initial value of 1 is used as a state lock, the reference count of each state is respectively used as 1 atomic lock, 1 blocking task count is used for counting the locking number of tasks, and the 3 basic elements are combined to realize a multi-state lock.
The execution subject of step 201-213 may be a control module.
The PHY chip supporting COMBO (optical-electrical multiplexing) port can work on two media, i.e., electrical port and optical port, but can work on only one medium at the same time.
The state protection of 2 media of a PHY chip at least needs to satisfy the following three requirements:
firstly, the medium state of the electrical port or the optical port of the PHY chip can be obtained only by applying. If the current physical medium state (electric port or optical port) of the PHY chip is exactly consistent with the applied medium (electric port or optical port), the state can be obtained immediately; if not, it will wait until the current medium is released.
When the current medium (electric port or optical port) is released, only if the reference count of the current medium is 0, the medium state is allowed to be switched, and the waiting task queue applying for the medium is awakened.
And thirdly, if the PHY chip automatically switches the physical medium state due to restart and other reasons, the physical medium state of the PHY chip needs to be immediately recovered to be the current software medium state which is being quoted.
It is clear that the above three requirements are not met by a single basic lock or a read-write lock. The multi-state lock provided by the application can meet the concurrent access and switching requirements of state protection required by the PHY chip.
The following describes the present application in detail by taking the first resource as a PHY chip as an example:
fig. 3 is a flowchart of a method for concurrently applying for a PHY chip medium according to another embodiment of the present disclosure, where the embodiment takes an electrical port medium of a PHY chip as an example, and the specific steps are as follows:
step 300: the reference count of the electric port medium of the initialization PHY chip is 0, the reference count of the optical port medium of the initialization PHY chip is 0, the medium state switching signal value of the initialization PHY chip is 1, and the blocking task count of the initialization PHY chip is 0.
Step 301: the first task of the electric port medium of the PHY chip is received and put into a task queue aiming at the electric port medium.
Step 302: judging whether the reference count of the optical port medium of the PHY chip is 0, if so, executing step 307; otherwise, step 303 is performed.
Step 303: judging whether the current physical medium state of the PHY chip is an optical port, if so, executing step 305; otherwise, step 304 is performed.
Step 304: and switching the current physical medium state of the PHY chip into an optical port.
Step 305: the blocked task count of the PHY chip is increased by 1, and the medium state switching signal value of the PHY chip is decreased by 1.
Step 306: if the blocking task count of the PHY chip is detected to be cleared and the media state switching signal value of the PHY chip is restored to 1, step 307 is executed.
Step 307: judging whether the current physical medium state of the PHY chip is an electrical port, if so, executing step 309; otherwise, step 308 is performed.
Step 308: and switching the current physical medium state of the PHY chip into an electric port.
Step 309: the reference count of the electrical interface media of the PHY chip is incremented by 1.
Step 310: determining whether the reference count of the electrical interface medium of the PHY chip is equal to 1, if yes, go to step 312; otherwise, step 313 is performed.
Step 312: and adding 1 to the blocking task count of the PHY chip, and subtracting 1 from the medium state switching signal value of the PHY chip.
Step 313: and determining that the electric port medium of the PHY chip is successfully applied, sequentially taking out tasks from the task queue aiming at the electric port medium, and executing the operation aiming at the electric port medium.
The above embodiments provide a method flow for applying for an electrical interface medium of a PHY chip, and the method flow for applying for an optical interface medium of a PHY chip is similar and will not be described again.
Fig. 4 is a flowchart of a method for releasing media of a PHY chip according to an embodiment of the present disclosure, where the embodiment takes an optical port medium for releasing a PHY chip as an example, and the specific steps are as follows:
step 401: detecting that the task releases the optical interface medium of the PHY chip, and subtracting 1 from the reference count of the optical interface medium of the PHY chip.
Step 402: judging whether the reference count of the optical port medium of the PHY chip is 0, if so, executing step 403; otherwise, return to step 401.
Step 403: and clearing the blocking task count of the PHY chip, and restoring the medium state switching signal value of the PHY chip to 1 until the optical port medium of the PHY chip is released completely.
If the reference count of the optical interface medium of the PHY chip is 0, it indicates that all tasks of the optical interface medium of the PHY chip have been executed.
The method flow for releasing the interface medium of the PHY chip in the above embodiments is similar to the method flow for releasing the electro-optical interface medium of the PHY chip, and is not described again.
Embodiments of the present application also provide a computer-readable storage medium storing instructions, which when executed by a processor, may perform the steps in the method for concurrently applying for a resource status as described above. In practical applications, the computer readable medium may be included in each device/apparatus/system of the above embodiments, or may exist separately and not be assembled into the device/apparatus/system. Wherein instructions are stored in a computer readable storage medium, which stored instructions, when executed by a processor, may perform the steps in the method of concurrently applying for resource status as above.
According to embodiments disclosed herein, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example and without limitation: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing, without limiting the scope of the present disclosure. In the embodiments disclosed herein, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
As shown in fig. 5, an embodiment of the present application further provides an electronic device. As shown in fig. 5, a schematic structural diagram of an electronic device according to an embodiment of the present application is shown, specifically:
the electronic device may include a processor 51 of one or more processing cores, memory 52 of one or more computer-readable storage media, and a computer program stored on the memory and executable on the processor. The above-described method of concurrently applying for resource status may be implemented when executing the program of the memory 52.
Specifically, in practical applications, the electronic device may further include a power supply 53, an input/output unit 54, and the like. Those skilled in the art will appreciate that the configuration of the electronic device shown in fig. 5 is not intended to be limiting of the electronic device and may include more or fewer components than shown, or some components in combination, or a different arrangement of components. Wherein:
the processor 51 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 52 and calling data stored in the memory 52, thereby performing overall monitoring of the electronic device.
The memory 52 may be used to store software programs and modules, i.e., the computer-readable storage media described above. The processor 51 executes various functional applications and data processing by executing software programs and modules stored in the memory 52. The memory 52 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the server, and the like. Further, the memory 52 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic 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 access to the memory 52.
The electronic device further comprises a power supply 53 for supplying power to the various components, which can be logically connected to the processor 51 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The power supply 53 may also include any component including one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The electronic device may also include an input-output unit 54, the input unit output 54 operable to receive input numeric 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 may also be used to display information input by or provided to the user as well as various graphical user interfaces, which may be composed of graphics, text, icons, video, and any combination thereof.
There is also provided in yet another embodiment of the present application a computer program product comprising a computer program or instructions which, when executed by a processor, implement the steps of the method of concurrently applying for resource status as described in the previous embodiments.
The flowchart and block diagrams in the figures of the present application illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments disclosed herein. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not explicitly recited in the present application. In particular, the features recited in the various embodiments and/or claims of the present application may be combined and/or coupled in various ways, all of which fall within the scope of the present disclosure, without departing from the spirit and teachings of the present application.
The principles and embodiments of the present application are explained herein using specific examples, which are provided only for the purpose of facilitating understanding of the method and the core idea of the present application and are not intended to limit the present application. It will be appreciated by those skilled in the art that changes may be made in this embodiment and its broader aspects and without departing from the principles, spirit and scope of the invention, and that all such modifications, equivalents, improvements and equivalents as may be included within the scope of the invention are intended to be protected by the claims.

Claims (10)

1. A method for concurrently applying for resource status, the method comprising:
receiving a first task applying for a first state of a first resource;
if the second state of the first resource is inquired to be used by other tasks;
blocking the first task, and releasing the blocking of all tasks applying for the first resource in all states when detecting that all tasks aiming at the second state of the first resource are executed completely;
the first resource comprises a plurality of mutually exclusive states including a first state and a second state.
2. The method of claim 1, wherein querying that the second state of the first resource is being used by other tasks comprises:
judging whether the reference count of the second state of the first resource is 0 or not, and if not, determining that the second state of the first resource is being used by other tasks;
when it is detected that all tasks in the second state for the first resource are executed, the method includes:
the reference count of the second state of the first resource is detected to be 0.
3. The method of claim 1, wherein querying the second state of the first resource after being used by the other tasks and before blocking the first task further comprises:
judging whether the current physical state of the first resource is a second state;
and if the current physical state of the first resource is not the second state, switching the current physical state of the first resource to the second state.
4. The method of claim 1, wherein blocking the first task comprises:
adding 1 to the blocked task count for the first resource;
and, the releasing the blocking of all tasks applying for all states of the first resource includes:
and clearing the blocking task count of the first resource.
5. The method of claim 4, wherein adding 1 to the blocked task count of the first resource further comprises:
subtracting 1 from the state switching signal value of the first resource;
when the blocking task count of the first resource is cleared, the method further includes:
and restoring the state switching signal value of the first resource to the initial value 1.
6. The method of claim 1, 4 or 5, wherein after releasing the blocking of all tasks applying for all states of the first resource, further comprising:
A. b, judging whether the current physical state of the first resource is a first state or not, if so, executing the step B; if not, changing the current physical state of the first resource into the first state, and then executing the step B;
B. and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 2, if so, subtracting 1 from the state switching signal value of the first resource, adding 1 to the blocking task count of the first resource, and determining that the first state is successfully applied.
7. The method of claim 1, wherein after receiving a first task applying for a first state of a first resource, further comprising:
and if the first state of the first resource is inquired to be used by other tasks, determining to directly acquire the first state of the first resource.
8. The method of claim 7, wherein querying that the first state of the first resource is being used by other tasks comprises:
and inquiring that the current physical state of the first resource is the first state.
9. The method according to claim 7 or 8, wherein if the first state of the first resource is being used by other tasks, the method further comprises:
and adding 1 to the reference count of the first state, judging whether the reference count of the first state is equal to 1, if so, subtracting 1 from the state switching signal value of the first resource, and adding 1 to the blocking task count of the first resource.
10. The method of claim 1, wherein the first resource is a PHY chip;
and, the first state is an electrical port medium, the second state is an optical port medium, or the first state is an optical port medium, the second state is an electrical port medium.
CN202111637311.5A 2021-12-29 2021-12-29 Method for concurrently applying resource state Pending CN114428673A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111637311.5A CN114428673A (en) 2021-12-29 2021-12-29 Method for concurrently applying resource state

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111637311.5A CN114428673A (en) 2021-12-29 2021-12-29 Method for concurrently applying resource state

Publications (1)

Publication Number Publication Date
CN114428673A true CN114428673A (en) 2022-05-03

Family

ID=81312081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111637311.5A Pending CN114428673A (en) 2021-12-29 2021-12-29 Method for concurrently applying resource state

Country Status (1)

Country Link
CN (1) CN114428673A (en)

Similar Documents

Publication Publication Date Title
CN102567090B (en) The method and system of execution thread is created in computer processor
CN103761182A (en) Method and device for deadlock detection
JPS5983249A (en) Control of queue
EP2972852B1 (en) System management interrupt handling for multi-core processors
WO2013041366A1 (en) Concurrent processing of queued messages
CN107368367B (en) Resource allocation processing method and device and electronic equipment
US10318456B2 (en) Validation of correctness of interrupt triggers and delivery
CN114168271B (en) Task scheduling method, electronic device and storage medium
CN105045632A (en) Method and device for implementing lock free queue in multi-core environment
CN105550029A (en) Process scheduling method and device
EP1760580B1 (en) Processing operation information transfer control system and method
CN112434092A (en) Data processing method and device, electronic equipment and readable storage medium
CN100440153C (en) Processor
EP3516515B1 (en) Scheduling of tasks in a multiprocessor device
CN105474174A (en) Handling time intensive instructions
US20170192790A1 (en) Providing task-triggered determinisitic operational mode for simultaneous multi-threaded superscalar processor
CN114428673A (en) Method for concurrently applying resource state
CN114791854B (en) Scheduling method, device, equipment and storage medium of user-state virtual machine task
US7603673B2 (en) Method and system for reducing context switch times
CN113961364B (en) Large-scale lock system implementation method and device, storage medium and server
CN112988355B (en) Program task scheduling method and device, terminal equipment and readable storage medium
CN113220495B (en) Method and device for processing process abnormal event, electronic equipment and storage medium
CN117407054A (en) Interrupt processing method, electronic device, and storage medium
CN115904644A (en) Task scheduling method, electronic device and computer program product
CN109375990B (en) Ring linked list method based on atomic operation

Legal Events

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