CN114942791A - Process awakening method and device, computing device and readable storage medium - Google Patents

Process awakening method and device, computing device and readable storage medium Download PDF

Info

Publication number
CN114942791A
CN114942791A CN202210614457.6A CN202210614457A CN114942791A CN 114942791 A CN114942791 A CN 114942791A CN 202210614457 A CN202210614457 A CN 202210614457A CN 114942791 A CN114942791 A CN 114942791A
Authority
CN
China
Prior art keywords
wake
target
pipeline
data
target pipeline
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
CN202210614457.6A
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.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology 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 Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202210614457.6A priority Critical patent/CN114942791A/en
Publication of CN114942791A publication Critical patent/CN114942791A/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/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • 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/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Advance Control (AREA)

Abstract

The invention discloses a process awakening method, a process awakening device, computing equipment and a readable storage medium. The process wake-up method of the present invention is executed in a computing device, at least one process running in an operating system of the computing device, and the method includes: and after the target process in the at least one process writes data into the target pipeline or reads data from the target pipeline, judging whether a process to be awakened exists in a corresponding waiting queue of the target pipeline. If so, a wake-up function is executed to wake up the at least one process to be woken up. If not, the wake-up function is not performed. Therefore, after any process writes data into any pipeline or reads data from any pipeline, the wakening function cannot be executed immediately, and the wakening function can be executed only when the process to be wakened exists in the corresponding waiting queue of the pipeline, so that the read-write performance of the pipeline process can be improved.

Description

Process awakening method and device, computing device and readable storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a process wake-up method, apparatus, computing device, and readable storage medium.
Background
The pipeline PIPE is a half-duplex process communication mechanism which is frequently used, and is commonly used among processes, wherein one end of the pipeline PIPE is used as a reading end, and the other end of the pipeline PIPE is used as a writing end. The PIPE is a kind of file, but unlike the file, it cannot write without limitation, and the buffer area (buffer) size of the PIPE is fixed. Thus, when any process writes data into the pipe, if the cache is full, the process may enter a blocked state (i.e., blocked) waiting to be awakened. Similarly, when any process reads data from the pipeline, if the buffer is empty (i.e. all data in the buffer has been read out), the process also enters a blocking state and waits to be woken up.
For this reason, an efficient process wake mechanism is needed to wake up the blocked process.
Disclosure of Invention
To this end, the present invention provides a process wake-up method, apparatus, computing device and readable storage medium in an effort to solve, or at least mitigate, the above-identified problems.
According to an aspect of the present invention, there is provided a process wake-up method, executed in a computing device, having at least one process running in an operating system of the computing device, the method comprising: after a target process in at least one process writes data into a target pipeline or reads data from the target pipeline, judging whether a process to be awakened exists in a corresponding waiting queue of the target pipeline; if so, executing a wake-up function to wake up at least one process to be woken up; if not, the wake-up function is not performed.
Optionally, in the process wake-up method according to the present invention, if there is a process to be woken up in the read wait queue of the target pipeline after the target process writes data into the target pipeline, a wake-up function is executed to wake up at least one process to be woken up in the read wait queue.
Optionally, in the process wake-up method according to the present invention, if there is a process to be woken up in the write-wait queue of the target pipeline after the target process reads data from the target pipeline, a wake-up function is executed to wake up at least one process to be woken up in the write-wait queue.
Optionally, in the process wake-up method according to the present invention, the method further includes: receiving a data processing request of a target process to a target pipeline, and determining the data processing request as a data reading request or a data writing request; if the data processing request is a data reading request, judging whether a cache region of the target pipeline is empty or not; and if the buffer area is not empty, informing the target process to read data from the target pipeline.
Optionally, in the process wake-up method according to the present invention, the method further includes: if the data processing request is a data writing request, judging whether a cache region of the target pipeline is full; and if the cache region is not full, informing the target process to write data into the target pipeline.
Optionally, in the process wake-up method according to the present invention, before the step of executing the wake-up function, the method further includes: the lock of the corresponding wait queue is acquired and the interrupt state is maintained.
According to another aspect of the present invention, there is provided a process wake-up apparatus residing in a computing device, at least one process running in an operating system of the computing device, the apparatus comprising: the judging unit is suitable for judging whether a process to be awakened exists in a corresponding waiting queue of the target pipeline after a target process in at least one process writes data into the target pipeline or reads data from the target pipeline; a wake-up unit adapted to execute a wake-up function to wake up at least one process to be woken up, if present; a termination unit adapted to not execute the wake-up function if not present.
Optionally, in the process wake-up apparatus according to the present invention, the wake-up unit is adapted to execute a wake-up function to wake up the at least one to-be-woken-up process in the read wait queue of the target pipeline if the to-be-woken-up process exists in the read wait queue of the target pipeline after the target process writes data into the target pipeline, and is further adapted to execute the wake-up function to wake up the at least one to-be-woken-up process in the write wait queue of the target pipeline if the to-be-woken-up process exists in the write wait queue of the target pipeline after the target process reads data from the target pipeline.
According to yet another aspect of the invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the process wake-up method according to the present invention.
According to yet another aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform a process wake-up method according to the present invention.
According to the process awakening method, after the target process writes data into the target pipeline or reads data from the target pipeline, whether the process to be awakened exists in the corresponding waiting queue of the target pipeline is judged. If so, a wake-up function is executed to wake up the at least one process to be woken up. If not, the wake-up function is not performed. Therefore, the invention can not execute the wake-up function immediately after any process writes data into any pipeline or reads data from any pipeline, and only when the corresponding waiting queue of the pipeline is confirmed to have the process to be woken up, the wake-up function can be executed. Therefore, the situation that the wake-up function is still executed when no process to be wakened exists in the read waiting queue of the pipeline or no process to be wakened exists in the write waiting queue of the pipeline can be avoided, the performance loss caused by the execution of redundant wake-up functions can be effectively avoided, and the read-write performance of the pipeline process is improved.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 is a diagram illustrating a wake-up process based on an unconditional wake-up function mechanism in a write data application scenario according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a wakeup process based on an unconditional wake-up function mechanism in a read data application scenario according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a flow of executing a wake-up function under a mechanism for unconditionally executing the wake-up function according to an embodiment of the present invention;
FIG. 4 illustrates a block diagram of a computing device 400, according to one embodiment of the invention;
FIG. 5 illustrates a flow diagram of a process wake-up method 500 according to one embodiment of the invention;
FIG. 6 is a diagram illustrating a flowchart of a process wake-up method 600 in a write data application scenario, according to yet another embodiment of the invention;
FIG. 7 is a diagram illustrating a flowchart of a process wake-up method 700 in a read data application scenario, according to yet another embodiment of the present invention;
fig. 8 is a block diagram illustrating a process wake-up apparatus 800 according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In order to clearly show the scheme and the beneficial effects of the embodiment of the present invention, before specifically developing and explaining the embodiment of the present invention, a description is first given to process blocking, process waking, and pipeline PIPE.
And (3) process blocking: the running process can only call the blocking primitive to block itself to wait for the occurrence of the corresponding event because the running process makes a system service request (such as an I/O operation) but does not get an immediate response of the operating system for some reason or data required to be obtained from other cooperative processes does not arrive yet.
And (4) process awakening: when an event expected by a blocked process occurs, such as an I/O completion or its expected data has arrived, a wake primitive is invoked by the relevant process (e.g., the process that runs out and releases the I/O device) to wake the process waiting for the event to enter a ready state.
Pipeline PIPE: the communication mode among the processes can realize bidirectional data transmission, but at most one direction transmission can be realized at the same time, namely only one process can read data from the processes or write data into the processes at the same time. Further, for the processes at both ends of the pipeline, the pipeline is actually a file, but it should be noted that the buffer size of the buffer is fixed.
Since the buffer size of the pipeline is fixed, data cannot be written into the pipeline without limitation. Thus, when any process writes data into the pipe (this process is referred to as a write process), if the cache is full, the write process may be blocked, as in FIG. 1. Similarly, when any process reads data from the pipeline (this process is referred to as a read process), the read process may be blocked if the buffer is empty, as shown in FIG. 2.
For the blocked read/write process, the process may wake up by executing a wake-up function after either process writes data to or reads data from the pipe. Specifically, after any process writes data into the pipe, a wake-up function is executed to wake up the blocking read process in the read wait queue of the pipe, as shown in fig. 1. After any process reads data from the pipeline, a wake-up function is executed to wake up the blocking write process in the write-wait queue of the pipeline, as shown in fig. 2.
It can be seen that the above-described wake-up mechanism is unconditionally executed, and as long as a process successfully writes data into or reads data from the pipeline, the process immediately executes the wake-up function. It should be noted that the process is not necessarily awakened after the wake-up function is executed, because a blocked read process or write process is not necessarily present in the read wait queue or write wait queue of the pipeline after the process successfully writes data into or reads data from the pipeline. That is, after a process successfully writes data into the pipeline or successfully reads data from the pipeline, the process is not woken up despite the execution of the wake-up function, since there are sometimes no processes that need to be woken up at all. Obviously, this situation wastes the time to execute the wake-up function (or wake-up code), resulting in performance loss.
In addition, before executing the wake-up function, the lock of the read/write wait queue is generally acquired, then the interrupt status is maintained, and finally the wake-up function is executed, as shown in fig. 3. After the wake-up function is executed, it is first determined whether a blocked read/write process exists in the read/write wait queue. If so, the at least one blocked read/write process is woken up and the lock is released. If not, the process is not awakened, and the lock is directly released. It can be seen that before the wake-up function is executed, the lock of the queue to be woken up needs to be acquired. However, there is a high probability that the lock will be preempted by the interrupt program when acquiring, which wastes a portion of the time and causes a significant performance loss.
In this regard, the present invention provides a process wake-up method adapted to be executed in a computing device. Specifically, after any process reads data from the pipeline or writes data into the pipeline, the wake-up function is executed only if a blocked write process or read process exists in the write-wait queue or read-wait queue of the pipeline, so that performance loss caused by executing redundant wake-up functions and interruption in lock acquisition can be effectively avoided.
Fig. 4 illustrates a block diagram of the physical components (i.e., hardware) of a computing device 400. In a basic configuration, computing device 400 includes at least one processing unit 402 and system memory 404. According to one aspect, processing unit 402 may be implemented as a processor depending on the configuration and type of computing device. The system memory 404 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, an operating system 405 and program modules 406 are included in system memory 404, and a process wake module 420 is included in program modules 406, process wake module 420 being configured to perform process wake method 500 of the present invention.
According to one aspect, the operating system 405 is, for example, adapted to control the operation of the computing device 400. Further, the examples are practiced in conjunction with a graphics library, other operating systems, or any other application program, and are not limited to any particular application or system. This basic configuration is illustrated in fig. 4 by those components within dashed line 408. According to one aspect, computing device 400 has additional features or functionality. For example, according to one aspect, computing device 400 includes additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in FIG. 4 by removable storage devices 409 and non-removable storage devices 410.
As stated above, according to one aspect, program modules are stored in the system memory 404. According to one aspect, the program modules may include one or more applications, the invention not being limited to the type of application, for example, the applications may include: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided applications, web browser applications, and the like.
According to one aspect, examples may be practiced in a circuit comprising discrete electronic elements, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or microprocessors. For example, an example may be practiced via a system on a chip (SOC) in which each or many of the components shown in fig. 4 may be integrated on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functions described herein may be operated via application-specific logic integrated with other components of the computing device 400 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other technologies capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum technologies. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuits or systems.
According to one aspect, computing device 400 may also have one or more input devices 412, such as a keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s) 414 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 400 may include one or more communication connections 416 that allow communication with other computing devices 418. Examples of suitable communication connections 416 include, but are not limited to: RF transmitter, receiver and/or transceiver circuitry; universal Serial Bus (USB), parallel, and/or serial ports.
The term computer readable media as used herein includes computer storage media. Computer storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, or program modules. The system memory 404, removable storage 409, and non-removable storage 410 are all examples of computer storage media (i.e., memory storage). Computer storage media may include Random Access Memory (RAM), Read Only Memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture which can be used to store information and which can be accessed by the computer device 400. In accordance with one aspect, any such computer storage media may be part of computing device 400. Computer storage media does not include a carrier wave or other propagated data signal.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism) and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more feature sets or that has been altered in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, Radio Frequency (RF), infrared, and other wireless media.
FIG. 5 illustrates a flow diagram of a process wake-up method 500 according to an embodiment of the invention, where the method 500 is adapted to be executed in a computing device (e.g., the computing device 400 shown in FIG. 4) and at least one process is running in an operating system of the computing device. The operating system of the computing device may be a Linux operating system, or may be other operating systems, such as Unix, Windows, and the like, which is not limited in the present invention.
As shown in fig. 5, the process wake-up method 500 of the present invention starts at step S510. Before step S510, the method further includes receiving a data processing request of a target process in the at least one process to the target pipeline, and determining that the data processing request is a data read request or a data write request, that is, determining whether the data processing request is a data read request or a data write request.
And if the data processing request is a data reading request, judging whether the cache region of the target pipeline is empty or not. If the cache region of the target pipeline is not empty, the data in the cache region of the target pipeline is represented to be available for the target process to read, and then the target process is informed to read the data from the target pipeline. If the cache region of the target pipeline is empty, the data in the cache region of the target pipeline is completely read, and then the target process is added into the read waiting queue of the target pipeline (i.e. the target process is blocked) to wait for being awakened, and at this time, the target process becomes a process to be awakened in the read waiting queue of the target pipeline.
And if the data processing request is a data writing request, judging whether the cache region of the target pipeline is full. If the cache region of the target pipeline is not full, the cache region of the target pipeline represents that space is available for the target process to write data, and then the target process is informed to write the data into the target pipeline. If the cache region of the target pipeline is full, the data to be written by the target process is stored in the cache region of the target pipeline, and then the target process is added into the write waiting queue of the target pipeline to wait for being awakened, and at this time, the target process becomes a process to be awakened in the write waiting queue of the target pipeline.
After the target process writes data into the target pipeline or reads data from the target pipeline, step S510 is performed to determine whether a process to be woken up exists in a corresponding waiting queue of the target pipeline. It should be noted that, if the target process successfully writes data into the target pipeline and the triggered determination is made on whether a process to be wakened exists in the corresponding waiting queue of the target pipeline, the corresponding waiting queue here refers to a read waiting queue of the target pipeline. If the target process successfully reads data from the target pipeline, and whether the process to be awakened exists in the corresponding waiting queue of the target pipeline is judged by triggering, the corresponding waiting queue refers to a writing waiting queue of the target pipeline.
According to an embodiment of the present invention, after the target process writes data into the target pipeline or reads data from the target pipeline, the following interfaces are invoked to determine whether a process to be woken up exists in a corresponding waiting queue of the target pipeline:
int is_pipe_wait(struct pipe_inode_info*pipe)
if yes, go to step S520, execute the wake-up function to wake up at least one process to be woken up. Specifically, if there is a process to be woken up in the read wait queue of the target pipeline after the target process writes data into the target pipeline, a wake-up function is executed to wake up at least one process to be woken up in the read wait queue of the target pipeline. And if the to-be-awakened process exists in the write-in waiting queue of the target pipeline after the target process reads the data from the target pipeline, executing an awakening function to awaken at least one to-be-awakened process in the write-in waiting queue of the target pipeline.
The wake-up function may be __ wake _ up _ common specifically. According to one embodiment of the invention, prior to executing the wake _ up _ common function __, the lock of the corresponding wait queue may be acquired and held in an interrupt state. Next, the wake-up function is executed again. Finally, after the wake-up function is executed, the acquired lock is released.
Specifically, after the target process writes data into the target pipeline, if there is a process to wake up in the read wait queue of the target pipeline, the lock of the read wait queue of the target pipeline is first acquired through the __ wake _ up _ common _ lock function. Then, the interrupt state is maintained by the spin _ lock _ irqsave function. Then, at least one to-be-woken process in the read wait queue of the target pipeline is woken up again through the __ wake _ up _ common function. Finally, the lock of the read wait queue of the target pipeline is released through the spin _ unlock _ irqrestore function.
Similarly, after the target process reads data from the target pipeline, if there is a process to wake up in the write-wait queue of the target pipeline, the lock of the write-wait queue of the target pipeline is first obtained through the __ wake _ up _ common _ lock function. Then, the interrupt state is maintained by the spin _ lock _ irqsave function. Then, at least one to-be-woken process in the write wait queue of the target pipeline is woken up again through the __ wake _ up _ common function. Finally, the lock of the write-wait queue of the target pipeline is released through the spin _ unlock _ irqrestore function.
The above is the case that the process to be woken up exists in the corresponding waiting queue of the target pipeline after the target process writes data into the target pipeline or reads data from the target pipeline. If there is no process to be wakened in the corresponding waiting queue of the target pipeline after the target process writes data into the target pipeline or reads data from the target pipeline, step S530 is entered, and no wake-up function is executed.
Specifically, if there is no process to be wakened in the read wait queue of the target pipeline after the target process writes data into the target pipeline, the wakening function is not executed, and the process is directly ended. Similarly, if the target process reads data from the target pipeline and the program to be wakened does not exist in the write-in waiting queue of the target pipeline, the wakening function is not executed and the process is finished directly.
It can be seen that, the process wake-up method of the present invention is specifically that after a target process writes data into a target pipeline, it is first determined whether a process to be woken up exists in a read wait queue of the target pipeline, if so, a wake-up function is executed, if not, the wake-up function is not executed any more, and the process is directly ended; after the target process reads data from the target pipeline, whether a process to be awakened exists in a write-in waiting queue of the target pipeline is judged, if yes, an awakening function is executed, if not, the awakening function is not executed, and the operation is finished directly.
Obviously, the invention does not execute the wake-up function immediately after the target process writes data into the target pipeline, and executes the wake-up function only when the read waiting queue of the target pipeline is confirmed to have the process to be wakened. Similarly, after the target process reads data from the target pipeline, the invention does not execute the wake-up function immediately, and executes the wake-up function only when the write-in waiting queue of the target pipeline is confirmed to have the process to be wakened. Therefore, the situation that the wake-up function is still executed when the process to be wakened does not exist in the read waiting queue of the pipeline or the process to be wakened does not exist in the write waiting queue of the pipeline can be avoided, and performance loss caused by interruption when some redundant functions (such as the wake-up function) are executed and the lock is acquired can be effectively avoided.
In order to better illustrate the complete implementation process of the invention, two embodiments are provided.
FIG. 6 is a schematic diagram illustrating a flow chart of a process wake-up method 600 in a write data application scenario, the method 600 being suitable for execution in a computing device (e.g., the computing device 400 shown in FIG. 4) according to one embodiment of the present invention. As shown in fig. 6, the method 600 begins at step S610.
In step S610, a request for a target process to write data into a target pipe is received. Subsequently, the process proceeds to step S620.
In step S620, it is determined whether the cache area of the target pipeline is full. If so, the process proceeds to step S630. Otherwise, the process proceeds to step S640.
In step S630, the target process is added to the write-wait queue of the target pipeline to wait for being woken up. After the target process is added into the write-in waiting queue of the target pipeline, the target process is a process to be awakened in the write-in waiting queue of the target pipeline.
In step S640, the target process is notified to write data into the target pipeline, and after the target process finishes writing data into the target pipeline, the process proceeds to step S650.
In step S650, it is determined whether there is a process to be woken up in the read wait queue of the target pipe. If so, the process proceeds to step S660. Otherwise, the process proceeds to step S670.
In step S660, a wake-up function is executed to wake up at least one to-be-woken process in the read wait queue of the target pipe.
In step S670, the wake-up function is not executed, and the process ends.
FIG. 7 is a schematic diagram illustrating a flowchart of a process wake-up method 700 in a read data application scenario, the method 700 being suitable for execution in a computing device (e.g., the computing device 400 shown in FIG. 4), according to an embodiment of the present invention. As shown in fig. 7, the method 700 begins at step S710.
In step S710, a request for a target process to read data from a target pipe is received. Subsequently, the process proceeds to step S720.
In step S720, it is determined whether the buffer of the target pipe is empty. If so, the process proceeds to step S730. Otherwise, the process proceeds to step S740.
In step S730, the target process is added to the read wait queue of the target pipeline to wait for being woken up. After the target process is added into the read waiting queue of the target pipeline, the target process is a process to be awakened in the read waiting queue of the target pipeline.
In step S740, the target process is notified to read data from the target pipe, and after the target process finishes reading data from the target pipe, the process proceeds to step S750.
In step S750, it is determined whether there is a process to be woken up in the write-wait queue of the target pipeline. If so, the process proceeds to step S760. Otherwise, the process proceeds to step S770.
In step S760, a wake-up function is executed to wake up at least one to-be-woken process in the write wait queue of the target pipeline.
In step S770, the wake-up function is not executed, and the process ends.
For specific details of the process wake-up method in the read data application scenario and the process wake-up method in the write data application scenario in this embodiment, reference may be made to the description based on fig. 1 to 5, which is not repeated herein.
In addition, the invention also utilizes unixbenchu to test the process awakening method. unixbenchu is a general performance testing tool in unix system, and is mainly used for testing the system from multiple aspects of file system, CPU, memory, process execution and the like. The invention mainly tests the throughput rate of the pipeline PIPE in unixbench, namely the read-write speed of the pipeline PIPE. Specifically, within the same time length, the throughput rate of the pipeline PIPE is tested based on the wake-up mechanism for executing the wake-up function unconditionally and the wake-up mechanism of the present invention. The test results obtained were: the throughput rate of the PIPE is 5095.1 based on the wake-up mechanism for unconditionally executing the wake-up function, and 6004.1 based on the wake-up mechanism of the present invention. Therefore, compared with the wake-up mechanism based on unconditional execution of the wake-up function, the wake-up mechanism provided by the invention can obviously improve the throughput rate of pipeline PIPE reading and writing. Therefore, the awakening method can obviously improve the read-write performance of the pipeline process.
The invention also provides a process awakening device. FIG. 8 is a block diagram illustrating an example of a process wake-up unit 800, suitable for residing in the computing device 500, according to an embodiment of the invention. Wherein at least one process runs in the operating system of the computing device 500. As shown in fig. 8, the process wake-up apparatus includes a judging unit 810, a wake-up unit 820, and a terminating unit 830.
The determining unit 810 is adapted to determine whether a process to be woken up exists in a corresponding waiting queue of the target pipeline after a target process of the at least one process writes data into the target pipeline or reads data from the target pipeline.
A wake-up unit 820 adapted to execute a wake-up function to wake up the at least one process to be woken up, if present. Specifically, if there is a process to be woken up in the read wait queue of the target pipeline after the target process writes data into the target pipeline, a wake-up function is executed to wake up at least one process to be woken up in the read wait queue of the target pipeline, and if there is a process to be woken up in the write wait queue of the target pipeline after the target process reads data from the target pipeline, a wake-up function is executed to wake up at least one process to be woken up in the write wait queue.
A termination unit 830 adapted to not perform the wake-up function if not present.
The details of the process wake-up apparatus 800 according to the present invention are disclosed in detail in the description based on fig. 1 to 7, and are not repeated herein.
According to the process awakening method, after the target process writes data into the target pipeline or reads data from the target pipeline, whether the process to be awakened exists in the corresponding waiting queue of the target pipeline is judged. If so, a wake-up function is executed to wake up the at least one process to be woken up. If not, the wake-up function is not performed. Therefore, the invention can not execute the wake-up function immediately after any process writes data into any pipeline or reads data from any pipeline, and only when confirming that the process to be wakened exists in the corresponding waiting queue of the pipeline, the wake-up function can be executed. Therefore, the situation that the wake-up function is still executed when the process to be wakened does not exist in the read waiting queue of the pipeline or the process to be wakened does not exist in the write waiting queue of the pipeline can be avoided, performance loss caused by interruption when certain redundant functions (such as the wake-up function) are executed and the lock is acquired can be effectively avoided, and the read-write performance of the pipeline process is improved.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to perform the process wake-up method of the present invention according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system is apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
It should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: rather, the invention as claimed requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the device in this example. The modules in the foregoing examples may be combined into one module or may additionally be divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed with respect to the scope of the invention, which is to be considered as illustrative and not restrictive, and the scope of the invention is defined by the appended claims.

Claims (10)

1. A process wakeup method adapted to be executed in a computing device having at least one process running in an operating system of the computing device, the method comprising:
after a target process in the at least one process writes data into a target pipeline or reads data from the target pipeline, judging whether a process to be awakened exists in a corresponding waiting queue of the target pipeline;
if so, executing a wake-up function to wake up at least one process to be woken up;
if not, the wake-up function is not executed.
2. The method of claim 1, wherein:
and if the processes to be awakened exist in the read waiting queue of the target pipeline after the data is written into the target pipeline by the target process, executing an awakening function to awaken at least one process to be awakened in the read waiting queue.
3. The method of claim 1 or 2, wherein:
and if the to-be-awakened process exists in the write-in waiting queue of the target pipeline after the target process reads data from the target pipeline, executing an awakening function to awaken at least one to-be-awakened process in the write-in waiting queue.
4. The method of any of claims 1-3, further comprising:
receiving a data processing request of the target process to the target pipeline, and determining that the data processing request is a data reading request or a data writing request;
if the data processing request is a data reading request, judging whether a cache region of the target pipeline is empty;
and if the cache region is not empty, informing the target process to read data from the target pipeline.
5. The method of claim 4, further comprising:
if the data processing request is a data writing request, judging whether a cache region of the target pipeline is full;
and if the cache region is not full, informing the target process to write data into the target pipeline.
6. The method of any of claims 1-5, wherein prior to the step of performing a wake-up function, further comprising:
the lock of the corresponding wait queue is acquired and the interrupt state is maintained.
7. A process wake apparatus residing in a computing device having at least one process running in an operating system of the computing device, the apparatus comprising:
the judging unit is suitable for judging whether a process to be awakened exists in a corresponding waiting queue of the target pipeline after a target process in the at least one process writes data into the target pipeline or reads data from the target pipeline;
a wake-up unit adapted to execute a wake-up function to wake up at least one of the processes to be woken up, if present;
a termination unit adapted to not execute the wake-up function if not present.
8. The apparatus of claim 7, wherein:
the wake-up unit is adapted to execute a wake-up function to wake up at least one to-be-woken process in the read wait queue of the target pipeline if the to-be-woken process exists in the read wait queue of the target pipeline after the data is written into the target pipeline by the target process, and further adapted to execute the wake-up function to wake up at least one to-be-woken process in the write wait queue of the target pipeline if the to-be-woken process exists in the write wait queue of the target pipeline after the data is read from the target pipeline by the target process.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-6.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-6.
CN202210614457.6A 2022-05-26 2022-05-26 Process awakening method and device, computing device and readable storage medium Pending CN114942791A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210614457.6A CN114942791A (en) 2022-05-26 2022-05-26 Process awakening method and device, computing device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210614457.6A CN114942791A (en) 2022-05-26 2022-05-26 Process awakening method and device, computing device and readable storage medium

Publications (1)

Publication Number Publication Date
CN114942791A true CN114942791A (en) 2022-08-26

Family

ID=82910000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210614457.6A Pending CN114942791A (en) 2022-05-26 2022-05-26 Process awakening method and device, computing device and readable storage medium

Country Status (1)

Country Link
CN (1) CN114942791A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040015979A1 (en) * 2002-07-22 2004-01-22 Te-Cheng Shen System and method for efficiently exchanging data among processes
US20100057863A1 (en) * 2008-09-03 2010-03-04 Microsoft Corporation Composing message processing pipelines
CN102902582A (en) * 2011-09-12 2013-01-30 微软公司 Managing processes within suspend states and execution states
US20150269065A1 (en) * 2014-03-19 2015-09-24 Qualcomm Incorporated Hardware-based atomic operations for supporting inter-task communication
CN105760216A (en) * 2016-02-29 2016-07-13 惠州市德赛西威汽车电子股份有限公司 Multi-process synchronization control method
CN108304269A (en) * 2017-01-13 2018-07-20 阿里巴巴集团控股有限公司 A kind of sending, receiving method of data, device and communications framework
CN109240812A (en) * 2018-08-05 2019-01-18 温州职业技术学院 A kind of process Optimization Scheduling based on dynamic monitoring
CN113326140A (en) * 2021-06-30 2021-08-31 统信软件技术有限公司 Process migration method and device, computing equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040015979A1 (en) * 2002-07-22 2004-01-22 Te-Cheng Shen System and method for efficiently exchanging data among processes
US20100057863A1 (en) * 2008-09-03 2010-03-04 Microsoft Corporation Composing message processing pipelines
CN102902582A (en) * 2011-09-12 2013-01-30 微软公司 Managing processes within suspend states and execution states
US20150269065A1 (en) * 2014-03-19 2015-09-24 Qualcomm Incorporated Hardware-based atomic operations for supporting inter-task communication
CN105760216A (en) * 2016-02-29 2016-07-13 惠州市德赛西威汽车电子股份有限公司 Multi-process synchronization control method
CN108304269A (en) * 2017-01-13 2018-07-20 阿里巴巴集团控股有限公司 A kind of sending, receiving method of data, device and communications framework
CN109240812A (en) * 2018-08-05 2019-01-18 温州职业技术学院 A kind of process Optimization Scheduling based on dynamic monitoring
CN113326140A (en) * 2021-06-30 2021-08-31 统信软件技术有限公司 Process migration method and device, computing equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
周祖伦 , 王保定 , 朱建忠: "UNIX System V程序设计讲座 第十讲 管道通讯", 软件世界, no. 03, 31 March 1994 (1994-03-31), pages 8 *

Similar Documents

Publication Publication Date Title
US8544022B2 (en) Transactional memory preemption mechanism
US7577825B2 (en) Method for data validity tracking to determine fast or slow mode processing at a reservation station
US9395919B1 (en) Memory configuration operations for a computing device
US10606677B2 (en) Method of retrieving debugging data in UEFI and computer system thereof
US7360185B2 (en) Design verification using sequential and combinational transformations
CN112559210B (en) Shared resource read-write mutual exclusion method based on RTX real-time system
US20050160203A1 (en) Method to maintain order between multiple queues with different ordering requirements in a high frequency system
US9489173B2 (en) Resizable and relocatable queue
CN114942791A (en) Process awakening method and device, computing device and readable storage medium
US7958510B2 (en) Device, system and method of managing a resource request
CN100432926C (en) Method and apparatus for processing transactions in a data processing system
CN115840654A (en) Message processing method, system, computing device and readable storage medium
US7861114B2 (en) System and method for recovery of memory transactions
US10019390B2 (en) Using memory cache for a race free interrupt scheme without the use of “read clear” registers
CN115269199A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN113515388A (en) Process scheduling method and device, computing equipment and readable storage medium
EP3923151A1 (en) Write ordering in ssds
US7035908B1 (en) Method for multiprocessor communication within a shared memory architecture
CN113050976B (en) FPGA parallel upgrading method and device based on PCIe bus, medium and electronic equipment
US10891244B2 (en) Method and apparatus for redundant array of independent drives parity quality of service improvements
CN113342698A (en) Test environment scheduling method, computing device and storage medium
US6658525B1 (en) Concurrent access of an unsegmented buffer by writers and readers of the buffer
US6453375B1 (en) Method and apparatus for obtaining coherent accesses with posted writes from multiple software drivers
US7216194B2 (en) Methods and systems for improving delayed read handling
US20220187867A1 (en) Accurate timestamp or derived counter value generation on a complex cpu

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