Quick access processing method, system and equipment for state data of main and standby machines of electric power automation system and storage medium

By setting read and write rules in the power automation system, using the writer queue and write lock to build a mechanism of reader concurrency and writer mutual exclusion, the mutual exclusion problem between readers and writers is solved, and the system efficiency is improved and writers are avoided starvation.

CN119536646APending Publication Date: 2025-02-28NARI TECH CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411617274.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the power automation system, the lack of an effective mutual exclusion mechanism between readers and writers, which leads to readers being unable to obtain complete data in time when data is written, which reduces system efficiency.

Method used

By setting rules for reading and writing the status data of the master and spare machine, the writer queue and write lock are used to build the ability of readers to concurrently and mutually exclusive access between readers and writers, and priority writer access through the writer queue to prevent writers from starving to death.

Benefits of technology

It realizes concurrent reader reading and mutually exclusive writing between writers, improves system efficiency, avoids the situation where writers starve to death, and significantly improves the efficiency of parallel system with more reads and fewer writes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536646A_ABST
    Figure CN119536646A_ABST
Patent Text Reader

Abstract

The invention discloses a quick access processing method for state data of main and standby machines of an electric power automation system, which is characterized by comprising the following steps of: setting a rule for reading and writing the state data of the main and standby machines according to the storage condition of the state data of the main and standby machines; according to the rule of reading and writing the state data of the main and standby machines, the ability of concurrence of readers and mutual exclusion access to the state data of the main and standby machines between readers and writers is constructed through a writer queue, the ability of mutual exclusion writing in the state data of the main and standby machines between writers is constructed through a write lock, and the ability of preferential writing of the writers is constructed through the writer queue; the ability of avoiding starvation of the writers is achieved, and the ability of mutual exclusion access to host and standby state data between the writers and the readers is built through the reader queue; rapid data access processing is realized according to the constructed four capabilities; according to the method, the efficiency of a parallel processing system is improved, read operations can be carried out concurrently and simultaneously, and the efficiency of the parallel system with more reads and less writes is obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of parallel computing technology, and in particular to a method, system, device and storage medium for quickly accessing and processing status data of a master and standby machine of an electric power automation system. Background Art

[0002] At present, the power automation system is composed of multiple servers, and multiple power applications are running on each server. In order to improve reliability, the application deploys a master instance and multiple backup instances, which are distributed on different servers. The master and backup status of each application instance can also be changed in real time. The application generally queries whether the server is the host of a certain application. If it is the host, it will perform a series of calculations and processing. If it is a backup machine, it will generally run idle to save resources. Therefore, there will be a large number of readers accessing the application master and backup machine status information from the shared memory. At the same time, the program that manages the master and backup machines will change the master and backup machine status in real time when receiving a switching instruction or finding abnormal situations such as other host disconnection failures. The master and backup machine status data needs to be written into the shared memory. When the writer writes the master and backup machine status data, the reader of the upper-level application cannot read it, otherwise it will read incomplete intermediate data. Therefore, there needs to be a mutual exclusion method between the reader and the writer to ensure the fast reading and correct writing of data.

[0003] The common inter-process mutual exclusion method used in current computer industry program development is the semaphore provided by the Linux operating system. The semaphore supports mutual exclusion between multiple processes and threads. The mutual exclusion operation itself takes up less resources and has high execution efficiency. However, the disadvantage is that it cannot distinguish between readers and writers, that is, it cannot provide reader concurrency and writer mutual exclusion functions. It can only perform mutual exclusion waiting for each semaphore access, and only one process or thread is allowed to enter the critical section. Such a mechanism will reduce the efficiency of large distributed systems. In general, the read operations of application systems are far more than the write operations. The use of semaphores will cause all read operations to wait for each other. Summary of the invention

[0004] Purpose of the invention: The purpose of the present invention is to provide a method, system, device and storage medium for quickly accessing and processing the status data of the main and standby machines of an electric power automation system, so as to solve the problems existing in the background technology.

[0005] Technical solution: The method for fast access processing of master-standby machine status data of an electric power automation system described in the present invention comprises the following steps: setting rules for reading and writing master-standby machine status data according to the storage conditions of master-standby machine status data; constructing reader concurrency through writer queues according to the rules for reading and writing master-standby machine status data, the ability for readers and writers to mutually exclusively access master-standby machine status data, the ability for writers to mutually exclusively write master-standby machine status data through write locks, the ability for writer priority to avoid writer starvation through writer queues, and the ability for writers and readers to mutually exclusively access master-standby machine status data through reader queues; and realizing fast data access processing according to the four constructed capabilities.

[0006] Furthermore, the rules for reading and writing the master-slave status data are set as follows: when the writer enters the critical section to write the master-slave status data, readers are not allowed to read the data, and other writers are not allowed to write data; when the reader enters the critical section to read the master-slave status data, other readers can read at the same time; when the reader enters or leaves the critical section, the reader queue value is increased by 1 or decreased by 1, and when the writer enters the critical section, the writer queue value is first increased by 1, and then the write lock is competed; when the writer leaves the critical section, the write lock is first released, and then the writer queue value is decreased by 1.

[0007] Furthermore, the operations of adding or subtracting 1 from the value of the reader / writer queue and the operations of grabbing or releasing the write lock are implemented based on the value addition or subtraction operations of the semaphore.

[0008] Furthermore, the writer queue is used to build reader concurrency and the ability for readers and writers to mutually exclusive access to the master and standby machine status data. The specific details are as follows: before entering the critical section to read the master and standby machine status data, the reader first checks whether the writer queue is empty. If it is not empty, it waits until the writer completes writing. If it is empty, it increments the reader queue by 1 and reads. If other readers enter the critical section to read the master and standby machine data at the same time, the reader queue continues to increment by 1, and when the reader completes reading, the reader queue is decremented by 1. Furthermore, the write lock is used to build the ability for writers to mutually exclusively write to the master-slave status data, as follows: before a writer reads the master-slave status data, it first adds 1 to the writer queue, then competes for the write lock. If successful, it queries whether the reader queue is empty. If not, it waits until it is empty before starting to write the master-slave status data. If the write lock competition fails, it waits for other writers to complete writing and release the write lock before continuing to compete for the write lock. When the writer completes writing, it first releases the write lock, and then reduces the writer queue by 1.

[0009] Furthermore, the writer queue is used to build writer priority and avoid writer starvation as follows: when the reader queue is not empty, if a writer tries to write the master-slave status data, the writer queue is incremented by 1 and then the write lock is competed for. By preventing other new readers from reading the master-slave status data due to the writer queue not being empty, only a limited number of readers in the reader queue need to complete the reading, thus avoiding writer starvation.

[0010] Furthermore, the capability of mutually exclusive access between writers and readers to the master-slave status data is established through the reader queue as follows: when a reader is reading the master-slave status data and a writer is trying to write the master-slave status data, the writer first waits because the reader queue is not empty. While waiting for the reader queue to become empty, the writer holds a write lock to prevent other writers from writing the master-slave status data.

[0011] The present invention provides a system for quickly accessing and processing the status data of a master and standby machine of an electric power automation system, comprising the following: Read and write rule module: used to set the rules for reading and writing the master and standby machine status data according to the storage conditions of the master and standby machine status data; 4 capability modules: used to build reader concurrency through writer queues according to the rules for reading and writing master and standby status data, the ability for readers and writers to mutually exclusive access to master and standby status data, the ability for writers to mutually exclusive write to master and standby status data through write locks, the ability to build writer priority through writer queues to avoid writer starvation, and the ability for writers and readers to mutually exclusive access to master and standby status data through reader queues; Access module: used to implement fast data access processing based on the four built capabilities.

[0012] Furthermore, in the read-write rule module, the rules for reading and writing the master-slave status data are set as follows: when the writer enters the critical section to write the master-slave status data, readers are not allowed to read the data, and other writers are not allowed to write data; when the reader enters the critical section to read the master-slave status data, other readers can read at the same time; when the reader enters or leaves the critical section, the reader queue value is increased by 1 or decreased by 1, and when the writer enters the critical section, the writer queue value is first increased by 1, and then the write lock is competed; when the writer leaves the critical section, the write lock is first released, and then the writer queue value is decreased by 1.

[0013] Furthermore, in the read / write rule module, the operations of adding or subtracting 1 from the value of the reader / writer queue and the operations of grabbing or releasing the write lock are implemented based on the value addition or subtraction operations of the semaphore.

[0014] Furthermore, in the four capability modules, the capabilities of building reader concurrency and mutually exclusive access between readers and writers to the master-slave status data through the writer queue are as follows: before the reader enters the critical section to read the master-slave status data, it first checks whether the writer queue is empty. If not, it waits for the writer to complete writing; if it is empty, it increases the reader queue by 1 and reads; if other readers enter the critical section to read the master-slave data at the same time, the reader queue continues to increase by 1, and the reader queue is reduced by 1 when the reader completes reading. Furthermore, in the four capability modules, the ability for writers to mutually exclusively write to the master-slave status data is constructed through write locks, as follows: before a writer reads the master-slave status data, it first adds 1 to the writer queue, and then competes for the write lock. If successful, it queries whether the reader queue is empty. If not, it waits until it is empty before starting to write the master-slave status data. If the write lock competition fails, it waits for other writers to complete writing and release the write lock before continuing to compete for the write lock. When the writer completes writing, it first releases the write lock, and then reduces the writer queue by 1.

[0015] Furthermore, among the four capability modules, the ability to build writer priority through the writer queue to avoid writer starvation is as follows: when the reader queue is not empty, if a writer tries to write the master-slave status data, the writer queue will be incremented by 1 and then the write lock will be competed for. By preventing other new readers from reading the master-slave status data through the writer queue not being empty, at the same time, it only needs to wait for the limited number of readers in the reader queue to complete the reading, thus avoiding writer starvation.

[0016] Furthermore, in the four capability modules, the capability of mutually exclusive access between writers and readers to the master-slave status data is constructed through the reader queue as follows: when a reader is reading the master-slave status data and a writer is trying to write the master-slave status data, the writer first waits because the reader queue is not empty. While waiting for the reader queue to become empty, the writer will hold a write lock to prevent other writers from writing the master-slave status data.

[0017] An electronic device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, any one of the methods for quickly accessing and processing the status data of a master and standby machine of an electric power automation system is implemented.

[0018] A storage medium described in the present invention stores a computer program, and when the computer program is executed by a processor, the method for quickly accessing and processing the status data of a master and standby machine of a power automation system described in any one of the items is implemented.

[0019] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: providing a read-write semaphore that supports concurrent reading by readers, exclusive writing between writers, and exclusive access by writers and readers. At the same time, the possibility of writer starvation is fully considered, and the priority of writers is improved. Once a writer appears, readers stop joining the queue, avoiding writer starvation; improving the efficiency of the parallel processing system, so that read operations can be performed concurrently and simultaneously, and the efficiency improvement is particularly obvious for parallel systems with more reading and less writing. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a schematic diagram of the reader's application for entering the critical area of ​​the present invention; Figure 2 It is a schematic diagram of the present invention writer's application for entering the critical area; Figure 3 It is a schematic diagram of mutual exclusion between the present invention writers; Figure 4 It is a schematic diagram of the present invention for preventing the writer from starving to death. DETAILED DESCRIPTION

[0021] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0022] like Figure 1 As shown, an embodiment of the present invention provides a method for quickly accessing and processing status data of a master and standby machine of an electric power automation system, comprising the following steps: Figure 1 This is a schematic diagram of the reader applying to read the master and standby machine status data of the present invention. In the figure, the reader queue shows that there are already 2 readers reading the master and standby machine status data. Before the reader starts reading, it first checks whether the writer queue is empty. If it is found that no writer is writing, the value of the reader queue is +1, and then starts reading.

[0023] Figure 2 This is a schematic diagram of the writer applying to write the master-slave status data of the present invention. First, the writer adds 1 to the writer queue value, and then competes for the write lock. At this moment, there are no other writers in the system, so the writer obtains the write lock, and the write lock value decreases from 1 to 0. Finally, the writer checks whether the reader queue is empty, and then finds that the queue is not empty, indicating that a reader is reading the master-slave status data. At this time, the writer waits until the reader queue is empty and starts writing data.

[0024] Figure 3 This is a schematic diagram of mutual exclusion between writers in the present invention. At this moment, the writer applies to write the status data of the master and standby machines. First, it adds 1 to the writer queue value, and then competes for the write lock. It finds that the write lock value is 0, indicating that the write lock has been seized by other writers, so the writer waits. After the write lock is seized, it checks whether the reader queue is empty, and only when the reader queue is empty can it start writing data.

[0025] Figure 4 This is a schematic diagram of the present invention for preventing writers from starving to death. The initial state shown in the figure is that there are 2 readers reading data. At this time, the writer arrives and starts to apply to write data. It adds 1 to the writer queue value and obtains the write lock, and then waits for the reader queue to become empty. At this time, the reader also arrives and applies to read data. But if the reader finds that the writer queue is not empty, it can only wait and cannot add itself to the reader queue. At this time, the system will wait for all current readers to complete reading, and then the writer starts to write data. After the writer completes writing, the reader can start reading.

[0026] It can be seen from the above embodiments that the present invention can improve the efficiency of the parallel processing system so that read operations can be performed concurrently. The mechanism relied on by the present invention is simple and reliable, and only relies on the standard semaphore mechanism provided by the operating system, without requiring a large amount of memory or disk occupancy. The present invention itself has high operating efficiency, and each application for reading or writing only requires at least one and at most three semaphore value operations or judgments, without requiring network communication or disk IO.

[0027] In addition, the present invention is simple to use, and only needs to use the dynamic library interface implemented by the present invention in programming, and no additional process needs to be run in the operating system. The present invention has strong self-recovery ability, and the semaphores used in the present invention are all set with undo operations. If the process using the present invention exits abnormally, the operations done on the semaphore system can be automatically undone.

[0028] The embodiment of the present invention also provides a system for quickly accessing and processing the status data of a master and standby machine of an electric power automation system, comprising the following: Read-write rule module: used to set the rules for reading and writing the master-standby status data according to the storage of master-standby status data; the rules for reading and writing the master-standby status data are as follows: when the writer enters the critical area to write the master-standby status data, the reader is not allowed to read the data, and other writers are not allowed to write data; when the reader enters the critical area to read the master-standby status data, other readers can read at the same time; when the reader enters or leaves the critical area, the reader queue value is increased or decreased by 1, and when the writer enters the critical area, the writer queue value is first increased by 1, and then the write lock is competed; when the writer leaves the critical area, the write lock is first released, and then the writer queue value is decreased by 1. Among them, the operations of adding and subtracting 1 to the reader / writer queue value and competing / releasing the write lock are implemented based on the value addition and subtraction operations of the semaphore.

[0029] 4 capability modules: used to build reader concurrency through writer queues according to the rules of reading and writing master and standby machine status data, the ability of readers and writers to mutually exclusive access to master and standby machine status data, the ability of writers to mutually exclusive write master and standby machine status data through write locks, the ability of writer priority to avoid writer starvation through writer queues, and the ability of writers and readers to mutually exclusive access to master and standby machine status data through reader queues; the ability of building reader concurrency and readers and writers to mutually exclusive access to master and standby machine status data through writer queues is as follows: before entering the critical section to read the master and standby machine status data, the reader first checks whether the writer queue is empty. If it is not empty, it waits for the writer to complete writing; if it is empty, it increments the reader queue by 1 and reads; if other readers enter the critical section to read the master and standby machine data at the same time, the reader queue continues to increment by 1, and when the reader completes reading, the reader queue is decremented by 1. Furthermore, in the four capability modules, the ability for writers to mutually exclusively write to the master-slave status data is constructed through write locks, as follows: before a writer reads the master-slave status data, it first adds 1 to the writer queue, and then competes for the write lock. If successful, it queries whether the reader queue is empty. If not, it waits until it is empty before starting to write the master-slave status data. If the write lock competition fails, it waits for other writers to complete writing and release the write lock before continuing to compete for the write lock. When the writer completes writing, it first releases the write lock, and then reduces the writer queue by 1.

[0030] The ability to build writer priority through the writer queue and avoid writer starvation is as follows: when the reader queue is not empty, if a writer tries to write the master-slave status data, the writer queue is incremented by 1 and then the write lock is competed for. By making the writer queue not empty, other new readers are prevented from reading the master-slave status data. At the same time, they only need to wait for the limited number of readers in the reader queue to complete the reading, thus avoiding writer starvation.

[0031] The ability to mutually exclusive access to the master and standby status data between writers and readers through the reader queue is as follows: When a reader is reading the master and standby status data and a writer is trying to write the master and standby status data, the writer first waits because the reader queue is not empty. While waiting for the reader queue to become empty, the writer holds the write lock to prevent other writers from writing the master and standby status data.

[0032] Access module: used to implement fast data access processing based on the four built capabilities.

[0033] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is loaded into the processor, the computer program implements any one of the methods for quickly accessing and processing the status data of a master and standby machine of an electric power automation system.

[0034] An embodiment of the present invention further provides a storage medium storing a computer program, wherein the computer program, when executed by a processor, implements a method for quickly accessing and processing status data of a master and standby machine of a power automation system according to any one of the items.

Claims

1. A method for quickly accessing and processing the status data of the main and standby machines of an electric power automation system, characterized in that: The following steps are involved: Set the rules for reading and writing the master and standby status data according to the master and standby status data storage situation; according to the rules for reading and writing the master and standby status data, build reader concurrency through writer queues, the ability for readers and writers to mutually exclusive access to the master and standby status data, the ability for writers to mutually exclusive write to the master and standby status data through write locks, the ability to prioritize writers and avoid writer starvation through writer queues, and the ability for writers and readers to mutually exclusive access to the master and standby status data through reader queues; The four built capabilities enable fast data access and processing.

2. A method for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 1, characterized in that: The rules for setting the reading and writing of the master and standby status data are as follows: when the writer enters the critical section to write the master and standby status data, readers are not allowed to read the data, and other writers are not allowed to write data; when the reader enters the critical section to read the master and standby status data, other readers can read at the same time; when the reader enters or leaves the critical section, the reader queue value is increased by 1 or decreased by 1, and when the writer enters the critical section, the writer queue value is first increased by 1, and then the write lock is competed; when the writer leaves the critical section, the write lock is first released, and then the writer queue value is decreased by 1.

3. A method for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 2, characterized in that: The operations of adding or subtracting 1 from the reader / writer queue value and the operations of grabbing or releasing the write lock are implemented based on the semaphore value addition or subtraction operations.

4. A method for quickly accessing and processing the status data of a master and standby machine in a power automation system according to claim 1, characterized in that: The ability to build reader concurrency and mutually exclusive access between readers and writers to the master and standby machine status data through the writer queue is as follows: before entering the critical section to read the master and standby machine status data, the reader first checks whether the writer queue is empty. If it is not empty, it waits for the writer to complete writing; if it is empty, the reader queue is incremented by 1 and reads; if other readers enter the critical section to read the master and standby machine data at the same time, the reader queue continues to increase by 1, and the reader queue is decremented by 1 when the reader completes reading.

5. A method for quickly accessing and processing the status data of a master and standby machine in a power automation system according to claim 1, characterized in that: The write lock is used to build the ability for writers to mutually exclusive write the status data of the master and standby machines. The details are as follows: before a writer reads the status data of the master and standby machines, it first increases the writer queue by 1, and then competes for the write lock. If successful, it checks whether the reader queue is empty. If not, it waits until it is empty and then starts writing the status data of the master and standby machines. If the write lock competition fails, it waits for other writers to complete writing and release the write lock before continuing to compete for the write lock. When the writer completes writing, it first releases the write lock and then reduces the writer queue by 1.

6. A method for quickly accessing and processing the status data of a main and standby machine in an electric power automation system as claimed in claim 1, characterized in that: The ability to build writer priority through the writer queue and avoid writer starvation is as follows: when the reader queue is not empty, if a writer tries to write the master-slave status data, the writer queue is incremented by 1 and then the write lock is competed for. By making the writer queue not empty, other new readers are prevented from reading the master-slave status data. At the same time, they only need to wait for the limited number of readers in the reader queue to complete the reading, thus avoiding writer starvation.

7. A method for quickly accessing and processing the status data of a main and standby machine in a power automation system according to claim 1, characterized in that: The ability to mutually exclusive access to the master and standby status data between writers and readers through the reader queue is as follows: When a reader is reading the master and standby status data and a writer is trying to write the master and standby status data, the writer first waits because the reader queue is not empty. While waiting for the reader queue to become empty, the writer holds the write lock to prevent other writers from writing the master and standby status data.

8. A system for quickly accessing and processing the status data of the main and standby machines of an electric power automation system, characterized in that: Includes the following: Read and write rule module: used to set the rules for reading and writing the master and standby machine status data according to the storage conditions of the master and standby machine status data; 4 capability modules: used to build reader concurrency through writer queues according to the rules for reading and writing master and standby status data, the ability for readers and writers to mutually exclusive access to master and standby status data, the ability for writers to mutually exclusive write to master and standby status data through write locks, the ability to build writer priority through writer queues to avoid writer starvation, and the ability for writers and readers to mutually exclusive access to master and standby status data through reader queues; Access module: used to implement fast data access processing based on the four built capabilities.

9. A system for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 8, characterized in that: In the read-write rule module, the rules for reading and writing the master-slave status data are set as follows: when the writer enters the critical section to write the master-slave status data, readers are not allowed to read the data, and other writers are not allowed to write data; when the reader enters the critical section to read the master-slave status data, other readers can read at the same time; when the reader enters or leaves the critical section, the reader queue value is increased or decreased by 1, and when the writer enters the critical section, the writer queue value is first increased by 1, and then the write lock is competed; when the writer leaves the critical section, the write lock is first released, and then the writer queue value is decreased by 1.

10. A system for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 9, characterized in that: In the read-write rule module, the operations of adding or subtracting 1 from the reader / writer queue value and the operations of grabbing or releasing the write lock are implemented based on the semaphore value addition or subtraction operations.

11. A system for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 8, characterized in that: Among the four capability modules, the capabilities of building reader concurrency and mutually exclusive access to the master-slave status data between readers and writers through the writer queue are as follows: before entering the critical section to read the master-slave status data, the reader first checks whether the writer queue is empty. If not, it waits for the writer to complete writing; if it is empty, the reader queue is incremented by 1 and reads; if other readers enter the critical section to read the master-slave data at the same time, the reader queue continues to increase by 1, and the reader queue is decremented by 1 when the reader completes reading.

12. A system for quickly accessing and processing the status data of a master and standby machine in an electric power automation system according to claim 8, characterized in that: Among the four capability modules, the write lock is used to build the ability for writers to mutually exclusive write the master-slave status data, as follows: before a writer reads the master-slave status data, it first adds 1 to the writer queue, and then competes for the write lock. If successful, it queries whether the reader queue is empty. If not, it waits until it is empty and then starts writing the master-slave status data. If the write lock competition fails, it waits for other writers to complete writing and release the write lock before continuing to compete for the write lock. When the writer completes writing, it first releases the write lock and then reduces the writer queue by 1.

13. A system for quickly accessing and processing the status data of a main and standby machine of an electric power automation system as claimed in claim 8, characterized in that: Among the four capability modules, the ability to build writer priority through the writer queue to avoid writer starvation is as follows: when the reader queue is not empty, if a writer tries to write the master-slave status data, the writer queue will be incremented by 1 and then compete for the write lock. By making the writer queue not empty, other new readers are prevented from reading the master-slave status data. At the same time, they only need to wait for the limited number of readers in the reader queue to complete the reading, thus avoiding writer starvation.

14. A system for quickly accessing and processing the master-standby machine status data of an electric power automation system as claimed in claim 8 and characterized in that, among the four capability modules, the capability of mutually exclusive access between writers and readers to the master-standby machine status data is constructed through a reader queue as follows: When a reader is reading the master-standby machine status data and a writer is trying to write the master-standby machine status data, the writer first waits because the reader queue is not empty. While waiting for the reader queue to become empty, the writer will hold a write lock to prevent other writers from writing the master-standby machine status data.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into a processor, the method for reading and writing semaphores with writer priority according to any one of claims 1 to 7 is implemented.

16. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for reading and writing semaphores with writer priority according to any one of claims 1 to 7 is implemented.