CN111352762A - Process access determining method and related device - Google Patents
Process access determining method and related device Download PDFInfo
- Publication number
- CN111352762A CN111352762A CN202010143232.8A CN202010143232A CN111352762A CN 111352762 A CN111352762 A CN 111352762A CN 202010143232 A CN202010143232 A CN 202010143232A CN 111352762 A CN111352762 A CN 111352762A
- Authority
- CN
- China
- Prior art keywords
- target resource
- access
- target
- identifier
- flag
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/0715—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a system implementing multitasking
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0751—Error or fault detection not based on redundancy
- G06F11/0754—Error or fault detection not based on redundancy by exceeding limits
- G06F11/076—Error or fault detection not based on redundancy by exceeding limits by exceeding a count or rate limit, e.g. word- or bit count limit
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/079—Root cause analysis, i.e. error or fault diagnosis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the application discloses a process access determining method and a related device, wherein in a computer environment allowing multi-process access to resources, a plurality of access identification bits are set for the resources to serve as a basis for determining whether the resources are accessed. And aiming at the target resource, if the first process accesses the target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource. And setting the target zone bit as a first identifier, and if the first process is determined to be abnormal, setting the target zone bit as a second identifier. Therefore, even if a process is abnormal when accessing the target resource, the access flag bit corresponding to the process can be set as the second identifier for indicating, and when other processes access the target resource, whether the process is accessing the target resource can be accurately determined by whether the access flag bits corresponding to the target resource are the second identifiers, so that the influence of the abnormal process on the resource access of other processes is reduced.
Description
Technical Field
The present application relates to the field of computers, and in particular, to a process access determination method and a related apparatus.
Background
In a computer technology environment, the same resource may be accessed by multiple processes. When one resource is accessed by a plurality of processes at the same time, only read operation and the like can be carried out, the operation of other accessing processes is not influenced, and the operations of modification, deletion and the like cannot be carried out.
In the related art, whether a resource is accessed is determined by adopting a reference counting mode, and the current access number of the resource is identified by a counting value. For example, when a process needs to access a resource, it is determined that the count value corresponding to the resource is greater than 0, so as to determine that the resource is currently being accessed, and at this time, the process cannot perform an operation on the resource that affects other visitors.
However, in a computer environment that allows multiple processes to access a resource, if a process terminates abnormally when accessing the resource, the reference count of the resource cannot be subtracted from the count value added before the process, resulting in the reference count of the resource being always greater than 0 and being difficult to recover correctly.
Disclosure of Invention
In order to solve the technical problem, the application provides a process access determining method and a related device, so that the influence of an abnormal process on resource access of other processes is reduced, and the resource access efficiency is improved.
The embodiment of the application discloses the following technical scheme:
in one aspect, an embodiment of the present application provides a method for determining process access, where the method includes:
if a first process accesses a target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
setting the target zone bit as a first identifier, wherein the first identifier is used for identifying that the first process corresponding to the target zone bit is accessing the target resource;
if the first process is determined to be abnormal, setting the target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource;
when the plurality of access flag bits are all set to the second identifier, determining that the target resource is not accessed by a process.
Optionally, the method further includes:
setting a count value corresponding to the target resource for the first process; the numerical value of the counting value is used for identifying the access quantity of the thread in the first process to the target resource;
when a first thread in the first process accesses the target resource, increasing the count value, and if the increased count value is equal to a first numerical value, setting the target zone bit as a first identifier;
when a second thread in the first process stops accessing the target resource, reducing the count value, and if the reduced count value is equal to a second numerical value, setting the target flag bit as a second identifier; the second value is less than the first value.
Optionally, the method further includes:
determining that the target resource is accessed by a process when at least one access flag bit of the plurality of access flag bits is set to the first flag.
Optionally, a plurality of bits of storage space are used as the plurality of access flag bits, and one bit of storage space is used as one access flag bit.
Optionally, a linked list is used as the multiple access flag bits, and one entry of the linked list is used as one access flag bit.
On the other hand, an embodiment of the present application provides a process access determination apparatus, which includes a first determination unit, a first setting unit, and a second determination unit:
the first determining unit is configured to determine, if a first process accesses a target resource, a target flag corresponding to the first process from a plurality of access flags corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
the first setting unit is configured to set the target flag bit to a first identifier, where the first identifier is used to identify that the first process corresponding to the target flag bit is accessing the target resource;
the first setting unit is further configured to set the target flag bit to a second identifier if it is determined that the first process is abnormal, where the second identifier is used to identify that the first process corresponding to the target flag bit stops accessing the target resource;
the second determining unit is configured to determine that the target resource is not accessed by the process when the plurality of access flag bits are all set to the second flag.
Optionally, the apparatus further includes a second setting unit and a counting unit:
the second setting unit is configured to set a count value corresponding to the target resource for the first process; the numerical value of the counting value is used for identifying the access quantity of the thread in the first process to the target resource;
the counting unit is configured to increase the count value when a first thread in the first process accesses the target resource, and set the target flag bit to a first flag if the increased count value is equal to a first numerical value;
the counting unit is further configured to reduce the count value when a second thread in the first process stops accessing the target resource, and set the target flag bit to a second flag if the reduced count value is equal to a second value; the second value is less than the first value.
Optionally, the second determining unit is further configured to determine that the target resource is accessed by a process when at least one access flag bit of the multiple access flag bits is set to the first identifier.
Optionally, a plurality of bits of storage space are used as the plurality of access flag bits, and one bit of storage space is used as one access flag bit.
Optionally, a linked list is used as the multiple access flag bits, and one entry of the linked list is used as one access flag bit.
In another aspect, an embodiment of the present application provides an apparatus, where the apparatus includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of the above aspect according to instructions in the program code.
In another aspect, the present application provides a computer-readable storage medium for storing a computer program for executing the method of the above aspect.
According to the technical scheme, in a computer environment allowing multi-process access to resources, a plurality of access identification bits are set for the resources to serve as a basis for determining whether the resources are accessed, and the access identification bits correspond to different processes accessing the resources respectively. For a target resource, if a first process accesses the target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource. Setting the target zone bit as a first identifier, wherein the first identifier is used for identifying that the first process corresponding to the target zone bit is accessing the target resource; and if the first process is determined to be abnormal, setting the target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource. Therefore, even if a process is abnormal when accessing the target resource, the access flag bit corresponding to the process can be set as the second identifier for indicating, and when other processes access the target resource, whether the process is accessing the target resource can be accurately determined by whether the access flag bits corresponding to the target resource are the second identifiers, so that the influence of the abnormal process on the resource access of other processes is avoided, and the system robustness is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic view of a process access scenario provided in an embodiment of the present application;
fig. 2 is a method flow of a process access determination method according to an embodiment of the present application;
fig. 3 is a flowchart illustrating flag setting of reference counting and access flag in a process according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating flag setting of reference counting and access flag in a process according to an embodiment of the present disclosure;
fig. 5 is a device structure diagram of a process access determination device according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of a server in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a terminal in an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
In a computer environment allowing multiple processes to access resources, a reference counting mode in the related art causes reference counting errors due to sudden abnormality of the processes accessing the resources, and other processes cannot acquire correct information about whether the resources are accessed, so that some modification operations are difficult to implement, and the efficiency of accessing the resources by the processes is reduced.
In a computer environment allowing multi-process access to resources, a plurality of access flag bits are set for the resources as a basis for determining whether the resources are accessed, and the plurality of access flag bits respectively correspond to different processes accessing the resources.
The embodiments of the present application may be performed by a processing device having data processing capabilities. The processing device can acquire the relevant information of the resource accessed by the process and perform corresponding processing, and the processing device can be a server. The method can be independently executed by the server, can also be applied to a network scene of communication between the terminal equipment and the server, and is executed by matching the terminal equipment and the server. The terminal device may be a computer, a Personal Digital Assistant (PDA), a tablet computer, or the like. The server may be understood as an application server or a Web server, and in actual deployment, the server may be an independent server or a cluster server. Meanwhile, in a hardware environment, the technology has been implemented in the following environments: an ARM architecture processor, an X86 architecture processor; in a software environment, the technology has been implemented in the following environments: android platform, Windows xp and operating systems or Linux operating systems.
In the computer environment shown in FIG. 1, a plurality of processes may access a target resource 100, and the target resource 100 may be in the form of various possible data such as files, packets, parameters, and the like. Target resource 100 is configured with a plurality of access flag bits 200.
If the first process 300 accesses the target resource 100, the processing device may determine a target flag 201 corresponding to the first process 300 from a plurality of access flags 200 corresponding to the target resource 100. Setting the target flag bit 201 as a first identifier, where the first identifier is used to identify that the first process 300 corresponding to the target flag bit 201 is accessing the target resource 100.
If it is determined that the first process 300 is abnormal, the processing device may set the target flag 201 to be a second identifier, where the second identifier is used to identify that the first process 300 corresponding to the target flag 201 stops accessing the target resource 100.
Therefore, even if a process is abnormal when accessing the target resource, the access flag bit corresponding to the process can be set as the second identifier for indicating, and when other processes access the target resource, whether the process is accessing the target resource can be accurately determined by whether the access flag bits corresponding to the target resource are the second identifiers.
For example, when the second process accesses the target resource 100, if it is determined that the multiple access flag bits 200 corresponding to the target resource 100 are all the second identifiers, it may be determined that the target resource 100 is not currently accessed by other processes, and the second process may modify and delete the target resource 100. Therefore, the influence of the abnormal process on the resource access of other processes is reduced, and the resource access efficiency is improved.
Fig. 2 is a flowchart of a method for determining process access according to an embodiment of the present application, where the method includes:
s201: if the first process accesses the target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource.
The target resource may be accessed by multiple processes, e.g., simultaneously or sequentially. The first process is one of a plurality of processes that may access the target resource.
The target resource has a corresponding plurality of access flag bits, wherein one access flag bit is used for corresponding to one process accessing the target resource. The access flag of the target resource is used to identify whether the corresponding process is accessing the target resource. And a plurality of access flag bits corresponding to the target resource are used for reflecting the access condition of all processes accessing the target resource from the overall view.
The access flag bit of the target resource can reflect the access condition of the corresponding process to the target resource through different identifications. In the embodiment of the application, the first identifier and the second identifier are used for distinguishing, wherein the first identifier is used for representing that the process is accessing, and the second identifier is used for representing that the process stops accessing. The embodiment of the present application does not limit the specific form of the first identifier and the second identifier, as long as the distinction can be achieved, for example, the first identifier may be 1, and the second identifier may be 0.
The specific use of the first identifier and the second identifier will be described in detail in the following steps.
The multiple access flags of the target resource may be preset, e.g., N access flags may be preset for each resource. The number of access flag bits corresponding to different resources may be the same or different.
The form of the access flag is not limited in the present application, and may include at least one of the following two forms, for example.
In a possible implementation manner, a storage space (e.g. shared memory) with a plurality of bits (N bits) is used as the plurality of access flag bits, and a storage space with one bit is used as one access flag bit. By determining the access flag bit in this way, superior results in performance can be achieved.
In a possible implementation manner, a linked list is used as the multiple access flag bits, and one entry of the linked list is used as one access flag bit. The access flag bit is determined in the mode, so that the condition that the upper limit of the access process is uncertain can be adapted.
S202: and setting the target zone bit as a first identifier.
When one of the multiple access flag bits corresponding to the target resource is allocated to the first process as a target flag bit, the identifier set in the target flag bit can reflect the current access condition of the first process to the target resource.
Because the first process is accessing the target resource at present and no exception occurs temporarily, the target flag bit is set to be a first identifier, and the first identifier is used for identifying that the first process corresponding to the target flag bit is accessing the target resource.
S203: and if the first process is determined to be abnormal, setting the target zone bit as a second identifier.
An exception as referred to herein is an abnormal termination of a first process during which the first process is accessing a target resource. In the computer environment, other processes or a background can determine that a process is abnormal, so when the first process is found to be abnormal, the first process can be determined to access the target resource through the allocation relation of the access flag bits, and the target flag bits are allocated. And setting a target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource.
Therefore, even if the process is abnormal when accessing the resource, the process can be clearly indicated by setting the identifier of the corresponding access flag bit, so that other processes can know the actual condition that the resource is accessed by the process. The problem that the original reference counting can not be solved is solved.
The exception may refer to a process stopping abnormally, an abnormal termination, and the like.
It should be noted that, if the first process stops accessing the target resource, i.e. normally stops accessing the target resource, the first process may set the target flag to the second flag to indicate other processes that wish to access the target resource.
S204: when the plurality of access flag bits are all set to the second identifier, determining that the target resource is not accessed by a process.
If a process accessing the target resource is abnormal in the accessing process, the access flag bit corresponding to the process is not kept as the first identifier for embodying the accessing process, but is set from the first identifier to the second identifier.
And if the process stops accessing the target resource, the corresponding access flag bit is set as the second identifier.
That is, when the process is abnormal or stops accessing the target resource when accessing the target resource, the corresponding flag bit is set as the second identifier.
Therefore, when a process, for example, a second process needs to access a target resource, if it is determined that all of the access flag bits corresponding to the target resource are set to the second identifier, it may be determined that the current target resource is not accessed by the process, and the second process may perform modification and deletion operations on the target resource if necessary.
Similarly, in a possible implementation manner, when at least one access flag bit of the multiple access flag bits corresponding to the target resource is set as the first identifier, it is determined that the target resource is accessed by the process. If a process needs to access the target resource under the condition, the process only has the right of reading the target resource but does not have the right of modifying and deleting the target resource, otherwise, other processes accessing the target resource are influenced.
Therefore, even if a process is abnormal when accessing the target resource, the access flag bit corresponding to the process can be set as the second identifier for explicit indication, and when other processes access the target resource, whether the process is accessing the target resource can be accurately determined by whether the access flag bits corresponding to the target resource are the second identifiers, so that the influence of the abnormal process on the resource access of other processes is reduced, and the resource access efficiency is improved.
It should be noted that the embodiment of the present application further provides a reference counting mechanism in a process, and the process performs identifier setting on an access flag allocated to the process based on the reference counting mechanism. For example, for a first process accessing a target resource, the first process may count (for the target resource) a count value of reference counts maintained by the first process, and the count value may represent the number of accesses to the target resource by a thread in the first process. And reasonably setting the identifier of the target zone bit under the condition that the first process is not abnormal, so as to maintain the actual condition of accessing the target resource by the first process through correctly setting the identifier.
In a possible implementation manner, taking a first process as an example, a count value corresponding to the target resource is set for the first process; and the numerical value of the counting value is used for identifying the number of threads accessing the target resource in the first process.
And when a first thread in the first process accesses the target resource, increasing the count value, and if the increased count value is equal to a first numerical value, setting the target zone bit as a first identifier.
For example, in the scenario shown in fig. 3, the first value is 1, the first flag is 1, and the count value is incremented by 1 every time the access to the target resource by one thread is increased.
When a thread is added in the first process to access the target resource, the count value of the target resource corresponding to the first process is added with 1, if the added count value is equal to 1, the first process is proved that the thread starts to access the target resource under the condition that no thread accesses the target resource, and the target flag bit is set to be 1.
If the increased count value is not equal to 1, it proves that other threads in the first process are accessing the target resource before the thread accessing the target resource is increased, and the target flag bit may not be operated.
When a second thread in the first process stops accessing the target resource, reducing the count value, and if the reduced count value is equal to a second numerical value, setting the target flag bit as a second identifier; the second value is less than the first value.
For example, in the scenario shown in fig. 4, the second value is 0, the second flag is 0, and the count value is decremented by 1 every time the access of a thread to the target resource is decreased.
And when one thread in the first process is reduced to access the target resource, the count value of the target resource corresponding to the first process is reduced by 1, if the reduced count value is equal to 0, the fact that no thread in the first process accesses the target resource is proved, and the target flag bit is set to be 0.
If the reduced count value is not equal to 0, it is proved that the first process still accesses the target resource after reducing the threads accessing the target resource, and the target flag bit may not be operated.
By the reference counting method combining the reference counting in the process and the access flag bit shared by a plurality of processes, the resource access condition can be accurately identified, and the problems caused by abnormal processes are avoided.
The correctness of reference counting can be guaranteed even if the process abnormally stops under the multi-process environment. And because the access flag bit shared by multiple processes is required to be modified only when the state of the reference number is changed between 0 and non-0 in the processes, and the simplest bit operation is modified, the performance is basically equivalent to that of the conventional reference count. By numbering the processes, the count of each process is not required to be additionally recorded in the access mark, and the structure of the access mark and the counting operations of adding, subtracting and clearing are simplified.
Fig. 5 is a diagram of an apparatus structure of a process access determination apparatus provided in an embodiment of the present application, where the apparatus includes a first determination unit 501, a first setting unit 502, and a second determination unit 503:
the first determining unit is configured to determine, if a first process accesses a target resource, a target flag corresponding to the first process from a plurality of access flags corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
the first setting unit is configured to set the target flag bit to a first identifier, where the first identifier is used to identify that the first process corresponding to the target flag bit is accessing the target resource;
the first setting unit is further configured to set the target flag bit to a second identifier if it is determined that the first process is abnormal, where the second identifier is used to identify that the first process corresponding to the target flag bit stops accessing the target resource;
the second determining unit is configured to determine that the target resource is not accessed by the process when the plurality of access flag bits are all set to the second flag.
Optionally, the apparatus further includes a second setting unit and a counting unit:
the second setting unit is configured to set a count value corresponding to the target resource for the first process; the numerical value of the counting value is used for identifying the access quantity of the thread in the first process to the target resource;
the counting unit is configured to increase the count value when a first thread in the first process accesses the target resource, and set the target flag bit to a first flag if the increased count value is equal to a first numerical value;
the counting unit is further configured to reduce the count value when a second thread in the first process stops accessing the target resource, and set the target flag bit to a second flag if the reduced count value is equal to a second value; the second value is less than the first value.
Optionally, the second determining unit is further configured to determine that the target resource is accessed by a process when at least one access flag bit of the multiple access flag bits is set to the first identifier.
Optionally, a plurality of bits of storage space are used as the plurality of access flag bits, and one bit of storage space is used as one access flag bit.
Optionally, a linked list is used as the multiple access flag bits, and one entry of the linked list is used as one access flag bit.
Therefore, even if a process is abnormal when accessing the target resource, the access flag bit corresponding to the process can be set as the second identifier for explicit indication, and when other processes access the target resource, whether the process is accessing the target resource can be accurately determined by whether the access flag bits corresponding to the target resource are the second identifiers, so that the influence of the abnormal process on the resource access of other processes is reduced, and the resource access efficiency is improved.
By the reference counting method combining the reference counting in the process and the access flag bit shared by a plurality of processes, the resource access condition can be accurately identified, and the problems caused by abnormal processes are avoided.
The correctness of reference counting can be guaranteed even if the process abnormally stops under the multi-process environment. And because the access flag bit shared by multiple processes is required to be modified only when the state of the reference number is changed between 0 and non-0 in the processes, and the simplest bit operation is modified, the performance is basically equivalent to that of the conventional reference count. By numbering the processes, the count of each process is not required to be additionally recorded in the access mark, and the structure of the access mark and the counting operations of adding, subtracting and clearing are simplified.
The present embodiment further provides a device, which may specifically be a server, fig. 6 is a schematic structural diagram of the server provided in the present embodiment, and the server 600 may generate a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 622 (e.g., one or more processors) and a memory 632, and one or more storage media 630 (e.g., one or more mass storage devices) storing an application program 642 or data 644. Memory 632 and storage medium 630 may be, among other things, transient or persistent storage. The program stored in the storage medium 630 may include one or more modules (not shown), each of which may include a series of instruction operations for the server. Still further, the central processor 622 may be configured to communicate with the storage medium 630 and execute a series of instruction operations in the storage medium 630 on the server 600.
The server 600 may also include one or more power supplies 626, one or more wired or wireless network interfaces 650, one or more input-output interfaces 658, and/or one or more operating systems 641, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so forth.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 6.
The CPU622 is configured to execute the following steps:
if a first process accesses a target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
setting the target zone bit as a first identifier, wherein the first identifier is used for identifying that the first process corresponding to the target zone bit is accessing the target resource;
if the first process is determined to be abnormal, setting the target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource;
when the plurality of access flag bits are all set to the second identifier, determining that the target resource is not accessed by a process.
Optionally, the CPU622 is further configured to execute steps of any implementation manner of the process access determination method provided in the embodiment of the present application.
The embodiment of the present application further provides another device, which may specifically be a terminal, and the terminal may be a desktop, a notebook computer, or the like, as shown in fig. 7, for convenience of description, only a part related to the embodiment of the present application is shown, and details of the specific technology are not disclosed, please refer to a method part in the embodiment of the present application. Taking the terminal as desktop as an example:
fig. 7 is a block diagram illustrating a structure of a desktop part related to a terminal provided in an embodiment of the present application. Referring to fig. 7, the desktop includes: radio Frequency (RF) circuit 710, memory 720, input unit 730, display unit 740, sensor 750, audio circuit 760, wireless fidelity (WiFi) module 770, processor 780, and power supply 790. Those skilled in the art will appreciate that the desktop architecture shown in FIG. 7 does not constitute a limitation on desktop, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The following specifically describes each constituent component of the desktop with reference to fig. 7:
the RF circuit 710 may be used for receiving and transmitting signals during a message or call. In general, RF circuit 710 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low noise amplifier (Low noise Amplifier, LNA), a duplexer, and the like. In addition, the RF circuit 710 may also communicate with networks and other devices via wireless communication.
The memory 720 may be used to store software programs and modules, and the processor 780 may execute various functional applications of the desktop and data processing by operating the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the desktop, and the like. Further, the memory 720 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 730 may be used to receive input numeric or character information and generate key signal inputs related to user setting and function control of the desktop. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also referred to as a touch screen, can collect touch operations of a user (e.g. operations of the user on or near the touch panel 731 by using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 731 may include two portions of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 780, and can receive and execute commands from the processor 780. In addition, the touch panel 731 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 730 may include other input devices 732 in addition to the touch panel 731. In particular, other input devices 732 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 740 may be used to display information input by the user or information provided to the user and various menus of the desktop. The Display unit 740 may include a Display panel 741, and optionally, the Display panel 741 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 731 can cover the display panel 741, and when the touch panel 731 detects a touch operation on or near the touch panel 731, the touch operation is transmitted to the processor 780 to determine the type of the touch event, and then the processor 780 provides a corresponding visual output on the display panel 741 according to the type of the touch event. Although in fig. 7, the touch panel 731 and the display panel 741 are two independent components to implement the input and output functions of the desktop, in some embodiments, the touch panel 731 and the display panel 741 may be integrated to implement the input and output functions of the desktop.
The desktop may also include at least one sensor 750, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 741 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 741 and/or the backlight when the desktop moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing a desktop gesture, related functions of vibration recognition (such as pedometer and tapping), and the like; as for the desktop, other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor may be further configured, which are not described herein.
WiFi belongs to short-distance wireless transmission technology, desktop can help users to receive and send e-mails, browse webpages and access streaming media and the like through a WiFi module 770, and wireless broadband Internet access is provided for the users. Although fig. 7 shows the WiFi module 770, it is understood that it does not belong to the essential constitution of the desktop, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 780 is a control center of the desktop, connects each part of the entire desktop by using various interfaces and lines, and performs various functions of the desktop and processes data by running or executing software programs and/or modules stored in the memory 720 and calling data stored in the memory 720, thereby performing overall monitoring of the desktop. Optionally, processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 780.
The desktop also includes a power supply 790 (e.g., a battery) for supplying power to the various components, which may preferably be logically connected to the processor 780 via a power management system, so as to manage charging, discharging, and power consumption via the power management system.
Although not shown, the desktop may further include a camera, a bluetooth module, and the like, which are not described in detail herein.
In the embodiment of the present application, the processor 780 included in the terminal further has the following functions:
if a first process accesses a target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
setting the target zone bit as a first identifier, wherein the first identifier is used for identifying that the first process corresponding to the target zone bit is accessing the target resource;
if the first process is determined to be abnormal, setting the target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource;
when the plurality of access flag bits are all set to the second identifier, determining that the target resource is not accessed by a process.
Optionally, the processor 780 is further configured to execute the steps of any implementation manner of the process access determination method of the present application.
The embodiment of the present application further provides a computer-readable storage medium for storing a computer program, where the computer program is configured to execute any one implementation manner of a process access determination method described in the foregoing embodiments.
The present application further provides a computer program product including instructions, which when run on a computer, cause the computer to execute any one of the implementation manners of a process access determination method described in the foregoing embodiments.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium may be at least one of the following media: various media that can store program codes, such as read-only memory (ROM), RAM, magnetic disk, or optical disk.
It should be noted that, in the present specification, all the embodiments are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A method for process access determination, the method comprising:
if a first process accesses a target resource, determining a target zone bit corresponding to the first process from a plurality of access zone bits corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
setting the target zone bit as a first identifier, wherein the first identifier is used for identifying that the first process corresponding to the target zone bit is accessing the target resource;
if the first process is determined to be abnormal, setting the target zone bit as a second identifier, wherein the second identifier is used for identifying that the first process corresponding to the target zone bit stops accessing the target resource;
when the plurality of access flag bits are all set to the second identifier, determining that the target resource is not accessed by a process.
2. The method of claim 1, further comprising:
setting a count value corresponding to the target resource for the first process; the numerical value of the counting value is used for identifying the access quantity of the thread in the first process to the target resource;
when a first thread in the first process accesses the target resource, increasing the count value, and if the increased count value is equal to a first numerical value, setting the target zone bit as a first identifier;
when a second thread in the first process stops accessing the target resource, reducing the count value, and if the reduced count value is equal to a second numerical value, setting the target flag bit as a second identifier; the second value is less than the first value.
3. The method of claim 1, further comprising:
determining that the target resource is accessed by a process when at least one access flag bit of the plurality of access flag bits is set to the first flag.
4. A method according to any of claims 1-3, characterized in that a plurality of bits of storage space are used as the plurality of access flag bits, and one bit of storage space is used as one access flag bit.
5. A method according to any of claims 1-3, wherein a linked list is used as the plurality of access flags, and wherein an entry of the linked list is used as an access flag.
6. A process access determination apparatus, characterized in that the apparatus comprises a first determination unit, a first setting unit, and a second determination unit:
the first determining unit is configured to determine, if a first process accesses a target resource, a target flag corresponding to the first process from a plurality of access flags corresponding to the target resource; the plurality of access flag bits respectively correspond to different processes accessing the target resource;
the first setting unit is configured to set the target flag bit to a first identifier, where the first identifier is used to identify that the first process corresponding to the target flag bit is accessing the target resource;
the first setting unit is further configured to set the target flag bit to a second identifier if it is determined that the first process is abnormal, where the second identifier is used to identify that the first process corresponding to the target flag bit stops accessing the target resource;
the second determining unit is configured to determine that the target resource is not accessed by the process when the plurality of access flag bits are all set to the second flag.
7. The apparatus according to claim 6, characterized in that it further comprises a second setting unit and a counting unit:
the second setting unit is configured to set a count value corresponding to the target resource for the first process; the numerical value of the counting value is used for identifying the access quantity of the thread in the first process to the target resource;
the counting unit is configured to increase the count value when a first thread in the first process accesses the target resource, and set the target flag bit to a first flag if the increased count value is equal to a first numerical value;
the counting unit is further configured to reduce the count value when a second thread in the first process stops accessing the target resource, and set the target flag bit to a second flag if the reduced count value is equal to a second value; the second value is less than the first value.
8. The apparatus of claim 6, wherein the second determining unit is further configured to determine that the target resource is accessed by a process when at least one of the plurality of access flags is set to the first flag.
9. An apparatus, comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of any of claims 1-5 according to instructions in the program code.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program for performing the method of any of claims 1-5.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010143232.8A CN111352762A (en) | 2020-03-04 | 2020-03-04 | Process access determining method and related device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010143232.8A CN111352762A (en) | 2020-03-04 | 2020-03-04 | Process access determining method and related device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111352762A true CN111352762A (en) | 2020-06-30 |
Family
ID=71192562
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010143232.8A Pending CN111352762A (en) | 2020-03-04 | 2020-03-04 | Process access determining method and related device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111352762A (en) |
Citations (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| FR2829847A1 (en) * | 2001-09-20 | 2003-03-21 | Cp8 | Controlling access to shared resources, especially on a chip card, using a locking flag that is set and reset using two different primitive systems, thus ensuring that a resource cannot be accessed simultaneously by two processes |
| US20030135537A1 (en) * | 2002-01-12 | 2003-07-17 | Mortensen Mikael | Semaphore system based on process events |
| US20090044194A1 (en) * | 2007-08-09 | 2009-02-12 | Pradeep Kumar Rathi | Multithreaded lock management |
| US20130080672A1 (en) * | 2011-09-27 | 2013-03-28 | Kaminario Technologies Ltd. | System, method and computer program product for access control |
| CN106326014A (en) * | 2016-08-24 | 2017-01-11 | 杭州费尔斯通科技有限公司 | Resource access method and device |
| US20170286107A1 (en) * | 2014-09-08 | 2017-10-05 | Arm Limited | Shared resources in a data processing apparatus for executing a plurality of threads |
| CN108170489A (en) * | 2016-12-07 | 2018-06-15 | 腾讯科技(深圳)有限公司 | A kind of method and device of quick loading resource |
| US20200401463A1 (en) * | 2019-06-24 | 2020-12-24 | International Business Machines Corporation | Self-managed lock access |
| CN114912103A (en) * | 2021-02-09 | 2022-08-16 | 华为技术有限公司 | Access control method and related device |
-
2020
- 2020-03-04 CN CN202010143232.8A patent/CN111352762A/en active Pending
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| FR2829847A1 (en) * | 2001-09-20 | 2003-03-21 | Cp8 | Controlling access to shared resources, especially on a chip card, using a locking flag that is set and reset using two different primitive systems, thus ensuring that a resource cannot be accessed simultaneously by two processes |
| US20030135537A1 (en) * | 2002-01-12 | 2003-07-17 | Mortensen Mikael | Semaphore system based on process events |
| CN1703676A (en) * | 2002-01-12 | 2005-11-30 | 英特尔公司 | Semaphore system based on process events |
| US20090044194A1 (en) * | 2007-08-09 | 2009-02-12 | Pradeep Kumar Rathi | Multithreaded lock management |
| US20130080672A1 (en) * | 2011-09-27 | 2013-03-28 | Kaminario Technologies Ltd. | System, method and computer program product for access control |
| US20170286107A1 (en) * | 2014-09-08 | 2017-10-05 | Arm Limited | Shared resources in a data processing apparatus for executing a plurality of threads |
| CN106326014A (en) * | 2016-08-24 | 2017-01-11 | 杭州费尔斯通科技有限公司 | Resource access method and device |
| CN108170489A (en) * | 2016-12-07 | 2018-06-15 | 腾讯科技(深圳)有限公司 | A kind of method and device of quick loading resource |
| US20200401463A1 (en) * | 2019-06-24 | 2020-12-24 | International Business Machines Corporation | Self-managed lock access |
| CN114912103A (en) * | 2021-02-09 | 2022-08-16 | 华为技术有限公司 | Access control method and related device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108089977B (en) | Application program exception handling method and device and mobile terminal | |
| CN106502906B (en) | A kind of method and apparatus of test application program | |
| CN106502703B (en) | Function calling method and device | |
| CN110196795B (en) | Method and related device for detecting running state of mobile terminal application | |
| CN106708554B (en) | Program operating method and device | |
| CN107368400A (en) | CPU monitoring method, device, computer readable storage medium and mobile terminal | |
| CN112231144A (en) | Data processing method and device and electronic equipment | |
| CN106294168B (en) | A kind of method and system carrying out Application testing | |
| CN111736980A (en) | A memory management method and device | |
| CN110413497B (en) | Abnormal monitoring method, device, terminal equipment and computer-readable storage medium | |
| CN110012152B (en) | Interface display method and terminal device | |
| CN107908492B (en) | Black screen detection method, mobile terminal and computer readable storage medium | |
| CN110442361B (en) | Gray release method and device and electronic equipment | |
| CN105278942B (en) | Component management method and device | |
| CN113821142A (en) | Interface window management method and related device | |
| CN111966491B (en) | Method for counting memory usage and terminal equipment | |
| CN106709330B (en) | Method and device for recording file execution behaviors | |
| US10853092B2 (en) | Method and device for sound effect processing | |
| CN111367502A (en) | Numerical value processing method and device | |
| CN109857305B (en) | An input response method and mobile terminal | |
| CN107818036B (en) | Black screen detection method, mobile terminal and computer readable storage medium | |
| CN107122204B (en) | Application unloading state detection method and device | |
| CN110245017B (en) | Resource identifier allocation method and equipment | |
| WO2019072179A1 (en) | Application running control method and apparatus | |
| CN105528220B (en) | Method and device for loading dynamic shared object |
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 | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200630 |