CN113032130A - System exception handling method and device - Google Patents
System exception handling method and device Download PDFInfo
- Publication number
- CN113032130A CN113032130A CN202110561962.4A CN202110561962A CN113032130A CN 113032130 A CN113032130 A CN 113032130A CN 202110561962 A CN202110561962 A CN 202110561962A CN 113032130 A CN113032130 A CN 113032130A
- Authority
- CN
- China
- Prior art keywords
- card
- sub
- electronic device
- electronic equipment
- value
- 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; CALCULATING OR 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/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/32—Monitoring with visual or acoustical indication of the functioning of the machine
- G06F11/324—Display of status information
- G06F11/327—Alarm or error message display
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the application provides a system exception handling method and a device, which relate to the technical field of terminals, and when the electronic equipment performs FSCK on data of an SD card through a start subprocess after the SD card is confirmed to be inserted into the electronic equipment, the electronic device can monitor the operation of the sub-process in the main process, so that the operation of the sub-process can be known in time, and further, when the operation of the sub-process is judged to meet the preset condition, the electronic equipment can timely avoid the problems of blockage, black screen or restart and the like of the electronic equipment due to overlarge memory occupation by stopping the sub-process, further, timely avoid the system breakdown of the electronic equipment, therefore, the starting and running robustness of the electronic equipment is enhanced, the usability of the whole electronic equipment is not influenced by the SD card, and a user does not need to frequently replace the SD card, so that the use experience of the user on the electronic equipment is improved.
Description
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a method and an apparatus for processing system exceptions.
Background
With the popularization of electronic devices, users can mount a secure digital memory dard (SD) memory card on the electronic device, so that the electronic device can use the SD memory card to store data.
In a possible scenario, when the electronic device uses an abnormal SD memory card, the electronic device may have problems of card pause, black screen, or restart, and the like, so that the electronic device may avoid the problems by replacing the SD memory card.
However, when the electronic device is stuck, blacked or restarted every time, the user needs to spend time replacing the SD memory card, and the replaced SD memory card cannot ensure that the electronic device is not stuck, blacked or restarted, which affects the user experience of the electronic device.
Disclosure of Invention
The embodiment of the application provides a system exception handling method and device, after an SD card is confirmed to be inserted into an electronic device, when the electronic device performs FSCK on data of the SD card through a promoter process, the electronic device can monitor operation of a subprocess in a main process, so that the operation of the subprocess can be known timely, and further, when the operation of the subprocess is judged to meet a preset condition, the electronic device can stop the subprocess, so that the problems of jamming, black screen or restarting and the like of the electronic device due to overlarge memory occupation are avoided timely, further, system breakdown of the electronic device is avoided timely, the starting and operation robustness of the electronic device is enhanced, the usability of the whole electronic device is not affected by the SD card, a user does not need to frequently replace the SD card, and the use experience of the user on the electronic device is improved.
In a first aspect, an embodiment of the present application provides a method for processing system exceptions, where the method includes: the electronic equipment detects an interrupt report about the insertion of the secure digital storage card SD card in the kernel layer; the electronic equipment scans a user space event Uevent interface of a kernel layer to confirm that the SD card is inserted into the electronic equipment; the electronic equipment reports an event that the SD card is inserted into the electronic equipment to the system layer through the kernel layer; the electronic equipment starting subprocess carries out File System Check (FSCK) on the data of the SD card; the electronic equipment monitors the sub-process in the main process; and when the running of the subprocess meets the preset condition, the electronic equipment stops the subprocess. Therefore, the electronic equipment starts a new subprocess to replace an FSCK program started by an initialization process, and once the new subprocess meets the preset condition, the electronic equipment can stop running of the subprocess, so that the problems of blockage, screen blackness or restarting and the like of the electronic equipment are avoided.
In a possible implementation manner, when the running of the sub-process satisfies a preset condition, the electronic device stops the sub-process, including: and when the running time of the sub-process is greater than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value, the electronic equipment stops the sub-process. Therefore, the electronic equipment can stop the running of the subprocess, and the phenomenon that the electronic equipment occupies too much memory when running the subprocess is avoided, so that the problems of blockage, screen blackness or restarting and the like of the electronic equipment are avoided.
In one possible implementation manner, when the running time of the sub-process is greater than or equal to a first value and/or the memory usage ratio of the electronic device during running of the sub-process is greater than or equal to a second value, the stopping of the sub-process by the electronic device includes: the electronic equipment judges whether the running time of the sub-process is greater than or equal to a first value or not; when the running time of the sub-process is larger than or equal to a first value, the electronic equipment stops the sub-process; or when the running time of the sub-process is less than the first value, the electronic equipment judges whether the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value; and when the memory occupation ratio of the electronic equipment is greater than or equal to the second value in the running of the subprocess, the electronic equipment stops the subprocess. Therefore, the electronic equipment can avoid the problems of jamming, screen blacking or restarting and the like.
In a possible implementation, the method further includes: and when the memory occupation ratio of the electronic equipment is smaller than the second value in the running of the subprocess, the electronic equipment waits for the preset time length and then judges whether the running time of the subprocess is larger than or equal to the first value again. Therefore, the electronic equipment repeatedly executes the judgment process, so that the judgment result of the electronic equipment is not influenced by the external network environment, and the accuracy of the judgment result is improved.
In a possible implementation manner, the first value is 60 seconds, the second value is 40%, and the preset time duration is 1 second.
In one possible implementation, the electronic device stopping the sub-process includes: the electronic device invokes the kill file system check kill fsck sub-process, which is used to stop the sub-process. Therefore, the electronic equipment stops the subprocess through the kill fsck subprocess, and the phenomenon that the memory occupation is overlarge when the electronic equipment runs the subprocess is avoided, so that the problems of blockage, screen blackness or restarting and the like of the electronic equipment are avoided.
In a possible implementation manner, after the electronic device stops the sub-process, the method further includes: and the electronic equipment displays a user interface, wherein the user interface comprises information for prompting the SD card to operate abnormally. In this way, the user can replace the SD card or format the SD card based on the abnormal operation information of the SD card.
In one possible implementation manner, the user interface comprises a notification popup window, and information for prompting the SD card to operate abnormally is displayed in the notification popup window; or the user interface comprises a drop-down bar, and the drop-down bar is used for displaying information for prompting the SD card to operate abnormally according to user trigger. In this way, the user can obtain the abnormal operation information of the SD card through the popup window or the pull-down bar, so that the user can replace the SD card or format the SD card.
In a possible implementation manner, the electronic device detects an interrupt report about the secure digital memory card SD card insertion at a kernel layer, and includes: the electronic equipment detects an interrupt report about the insertion of the SD card through the multimedia card mmcblk driver of the kernel layer. In this way, the electronic device can perform subsequent processing on the SD card based on the interrupt report, for example, detecting whether the SD card has been inserted into the electronic device or whether the SD card is usable or not, and the like.
In a possible implementation manner, the reporting, by the electronic device, to the system layer through the kernel layer of the event that the SD card is inserted into the electronic device includes: and the electronic equipment reports the event that the SD card is inserted into the electronic equipment to a disk daemon process vold of the system layer through a user space event Uevent interface. In this way, the vold of the system layer can obtain the event that the SD card is inserted into the electronic device, and further, the electronic device can start the subprocess to perform file system check FSCK on the data of the SD card.
In a second aspect, an embodiment of the present application provides a system exception handling apparatus, where the system exception handling apparatus may be an electronic device, or may be a component, a chip, or a system-on-chip in the electronic device. The system exception handling apparatus may comprise a processing unit. When the system exception handling apparatus is an electronic device, the processing unit may be a processor. The system exception handling apparatus may further include a storage unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored by the storage unit to enable the electronic device to implement the method described in the first aspect or any one of the possible implementation manners of the first aspect. When the system exception handling apparatus is a component, a chip, or a system-on-a-chip in an electronic device, the processing unit may be a processor, and the processing unit executes instructions stored in the storage unit to enable the electronic device to implement the method described in the first aspect or any one of the possible implementation manners of the first aspect. The storage unit may be a storage unit (e.g., a register, a cache, etc.) within the chip, or a storage unit (e.g., a read-only memory, a random access memory, etc.) external to the chip within the electronic device.
Exemplarily, the processing unit is used for detecting an interrupt report about the insertion of the secure digital memory card SD card at a kernel layer; the processing unit is also used for scanning a user space event Uevent interface of the kernel layer and confirming that the SD card is inserted into the electronic equipment; the processing unit is also used for reporting an event that the SD card is inserted into the electronic equipment to the system layer through the kernel layer; the processing unit is also used for starting the subprocess to carry out File System Check (FSCK) on the data of the SD card; the processing unit is also used for monitoring the subprocess in the main process; and when the running of the subprocess meets the preset condition, the processing unit is also used for stopping the subprocess.
In a possible implementation manner, the processing unit is specifically configured to: and stopping the subprocess when the running time of the subprocess is larger than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the subprocess is larger than or equal to a second value.
In a possible implementation manner, the processing unit is specifically configured to: judging whether the running time of the sub-process is greater than or equal to a first value or not; stopping the sub-process when the running time of the sub-process is greater than or equal to a first value; or when the running time of the sub-process is less than the first value, judging whether the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value; and stopping the subprocess when the memory occupation ratio of the electronic equipment is greater than or equal to a second value in the running of the subprocess.
In a possible implementation manner, the processing unit is further configured to: and when the memory occupation ratio of the electronic equipment is smaller than a second value in the running of the subprocess, waiting for a preset time length, and judging whether the running time of the subprocess is larger than or equal to the first value again.
In a possible implementation manner, the first value is 60 seconds, the second value is 40%, and the preset time duration is 1 second.
In a possible implementation manner, the processing unit is specifically configured to: a kill file system is invoked to check the kill fsck sub-process, which is used to stop the sub-process.
In a possible implementation manner, the processing unit is further configured to: and displaying a user interface, wherein the user interface comprises information for prompting the SD card to operate abnormally.
In one possible implementation manner, the user interface comprises a notification popup window, and information for prompting the SD card to operate abnormally is displayed in the notification popup window; or the user interface comprises a drop-down bar, and the drop-down bar is used for displaying information for prompting the SD card to operate abnormally according to user trigger.
In a possible implementation manner, the processing unit is specifically configured to: an interrupt report about the insertion of the secure digital memory card SD card is detected by a multimedia card block mmcblk driver of the kernel layer.
In a possible implementation manner, the processing unit is specifically configured to: and reporting the event that the SD card is inserted into the electronic equipment to a disk daemon process vold of the system layer through a user space event Uevent interface.
In a third aspect, an embodiment of the present application provides a system exception handling apparatus, including a processor and a memory, where the memory is used to store code instructions, and the processor is used to execute the code instructions to perform the method described in the first aspect or any one of the possible implementation manners of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, in which a computer program or instructions are stored, and when the computer program or instructions are run on a computer, the computer is caused to execute the method described in the first aspect or any one of the possible implementation manners of the first aspect.
In a fifth aspect, the present application provides a computer program product including a computer program, which when run on a computer causes the computer to perform the method described in the first aspect or any one of the possible implementations of the first aspect.
In a sixth aspect, an embodiment of the present application provides a system exception handling system, where the system includes: the second aspect and various possible implementations of the second aspect.
In a seventh aspect, the present application provides a chip or a chip system, where the chip or the chip system includes at least one processor and a communication interface, where the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to execute a computer program or instructions to perform the method described in the first aspect or any one of the possible implementations of the first aspect; the communication interface in the chip may be an input/output interface, a pin, a circuit, or the like.
In one possible implementation, the chip or chip system described above in this application further comprises at least one memory having instructions stored therein. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or may be a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
It should be understood that the second to seventh aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the advantageous effects obtained by the aspects and the corresponding possible implementations are similar and will not be described again.
Drawings
FIG. 1 is a schematic diagram of a fault problem provided by an embodiment of the present application;
fig. 2 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a system exception handling method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of a system exception handling method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a pull-down frame according to an embodiment of the present application;
fig. 7 is a schematic flowchart of an electronic device mounting an SD card according to an embodiment of the present disclosure;
fig. 8 is a schematic flowchart of a system exception handling method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a system exception handling apparatus according to an embodiment of the present application;
fig. 10 is a schematic hardware configuration diagram of a system exception handling apparatus according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
In the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same or similar items having substantially the same function and action. For example, the first chip and the second chip are only used for distinguishing different chips, and the sequence order thereof is not limited. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the embodiments of the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
With the popularization of electronic devices, users can mount a Secure Digital (SD) memory card on the electronic device, so that the electronic device can use the SD memory card to store data; however, when the electronic device uses an abnormal SD memory card (hereinafter referred to as an SD card), a process of the electronic device storing data in the SD card or a process of the electronic device reading data of the SD card may be caused to have a problem of malfunction.
For example, fig. 1 is a schematic diagram of a failure problem provided by an embodiment of the present application, and as shown in fig. 1, the failure problems that may occur in an electronic device include read-write speed abnormality, read-write frequent error, data inability to be written, and data retention abnormality, where a proportion of the read-write speed abnormality in the failure problem is 10%, a proportion of the read-write frequent error in the failure problem is 20%, a proportion of the data inability to be written in the failure problem is 20%, and a proportion of the data retention abnormality in the failure problem is 50%.
The abnormal read-write speed may be understood as that the electronic device reads data from the SD card at a slow rate, or the electronic device stores data into the SD card at a slow speed, compared with the electronic device using a normal SD card. For example, when the electronic device uses a normal SD card and the CLASS of the normal SD card is 10, the read/write speed may be 10M/s, that is, the electronic device may read or write 10M data per second, whereas when the electronic device uses an abnormal SD card, 7M data per second may be read or written.
The frequent reading and writing errors can be understood as that when the electronic device reads data in the SD card or when the electronic device stores data in the SD card, the electronic device displays reading and writing errors.
The data cannot be written in the electronic device, which is understood to mean that the electronic device cannot store data into the SD card although the SD card is mounted on the electronic device.
The data storage exception may be understood as that, although the electronic device stores data into the SD card, when the electronic device reads the data from the SD card, the format of the read data may be changed, so that the electronic device cannot correctly use the data.
The abnormal SD card may include an external inferior SD card or an old SD card, and the external inferior SD card may be understood as the SD card having a defect on the outside, and the old SD card may be understood as the electronic device having a slow speed of reading data in the SD card.
As can be seen from the above, the electronic device may have a failure problem due to the abnormal SD card, which may cause the electronic device to have a card pause, a black screen, or a restart problem.
In general understanding, the problem of the electronic device can be solved by replacing the SD card, but when the electronic device has the problems of card pause, black screen or restart at each time, on one hand, the time of the user is wasted by the above frequent replacement of the SD card, and on the other hand, the problems of card pause, black screen or restart cannot be caused after the electronic device is replaced with the SD card, which affects the user experience of the electronic device.
Based on this, the reason why the electronic device has problems of stuck, black screen or restart every time is further analyzed in the embodiment of the present application is: after the SD card is inserted into the electronic equipment, the electronic equipment calls a File System Check (FSCK) program, the FSCK program needs to check and verify the legality and the consistency of the disk metadata of the SD card, and the disk metadata of the SD card can be abnormal due to the fact that the abnormal SD card is mounted on the electronic equipment and the electronic equipment frequently uses the abnormal SD card, so that when the disk metadata of the SD card is read into a memory of the electronic equipment by the FSCK program, the disk metadata of the SD card can be circularly loaded by the FSCK program, and further, the process of reading the disk metadata of the SD card by the FSCK program is a dead-cycle process; moreover, because the FSCK program is started by an initialization process (init process), the authority and priority of the FSCK program are high, and even if the memory usage is large, the FSCK program is not killed by a low memory killer (low memory killer), so that the memory usage of the electronic device is too large, the electronic device has the problems of jamming, black screen or restarting and the like, and further, the system crash of the electronic device is caused.
The abnormal disk metadata of the SD card can be understood as that the metadata of the file system in the SD card is damaged, which causes the metadata to be inconsistent with the format of the file system, so that when the electronic device calls the FSCK program to check and verify the validity and consistency of the SD card disk metadata, the electronic device cannot mount the SD card in a proper directory, and the electronic device can report an error; alternatively, even if the SD card is mounted on the electronic device, the file directory of the SD card displayed on the electronic device is scrambled, so that the electronic device cannot store data in the SD card, or the electronic device cannot read data in the SD card.
In view of this, according to the method of the embodiment of the present application, after it is confirmed that the SD card is inserted into the electronic device, when the electronic device performs FSCK on data of the SD card through the sub-process, the electronic device may monitor the operation of the sub-process in the main process, so as to know the operation of the sub-process in time, and further, when it is determined that the operation of the sub-process meets the preset condition, the electronic device may stop the sub-process, so as to avoid the problems of stutter, black screen, or restart of the electronic device due to the excessively large memory occupation, further avoid system crash of the electronic device in time, thereby enhancing the robustness of starting and operating the electronic device, so that the usability of the whole electronic device is not affected by the SD card, and the user does not need to frequently replace the SD card, thereby improving the use experience of the user on the electronic.
The method of the embodiment of the application can be applied to electronic equipment, as well as embedded equipment such as android (android) flat equipment and android televisions, and an SD card can be inserted into the embedded equipment, so that the embedded equipment can store data in the SD card, or the embedded equipment can read the data in the SD card; it can be understood that the specific content of the embedded device may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
Fig. 2 is a schematic diagram of a hardware structure of an electronic device 100 according to an embodiment of the present disclosure, and as shown in fig. 2, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor module 180, a key 190, a camera 193, a display screen 194, and the like; among them, the sensor module 180 may include: a pressure sensor 180A, an acceleration sensor 180E, a fingerprint sensor 180H, and a touch sensor 180K, etc.
It should be noted that the structure illustrated in the embodiment of the present application does not specifically limit the electronic device 100; it will be appreciated that the electronic device 100 may include more or fewer components than illustrated, or combine certain components, or split certain components, or a different arrangement of components; where the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
It should be noted that, the electronic device further includes a socket for inserting the SD card, when the SD card is inserted into the socket, the electronic device may perform subsequent processing procedures, for example, whether the electronic device detects an interrupt report about the insertion of the secure digital memory card SD card, or whether the electronic device confirms that the SD card is inserted into the electronic device, etc.; wherein the socket is not shown in the figure.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory that may hold instructions or data that have just been used or recycled by the processor 110.
In some embodiments, the processor 110 may include one or more interfaces, which may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, and/or a Universal Serial Bus (USB) interface, among others.
The user interface 130 is used for transmitting data between the electronic device 100 and a peripheral device, and may also be used for connecting an earphone and playing audio through the earphone; the user interface 130 may also be used to connect other devices, such as Augmented Reality (AR) devices and the like.
The power management module 141 receives the input of the charging management module 140, and the power management module 141 supplies power to the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like.
In this embodiment of the application, when it is determined that the SD card is inserted into the electronic device, the electronic device may supply power to the SD card based on the power management module 141, so that the SD card may operate.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, and the like; wherein the antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. The antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example, the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network.
The mobile communication module 150 may provide a solution including wireless communication of 2G/3G/4G/5G and the like applied to the electronic device 100; the wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices via wireless communication techniques; the wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology, etc.
The electronic device 100 implements a display function through the display screen 194, the display screen 194 is used for displaying images, videos, and the like, and the display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include 1 or N display screens 194, with N being a positive integer greater than 1.
In the embodiment of the application, the electronic device may display information of abnormal operation of the SD card for the user through the display screen 194, or when the electronic device determines that the SD card is abnormal in operation, the electronic device may display information of replacing the SD card for the user through the display screen 194.
The electronic apparatus 100 may implement a photographing function by a camera 193 or the like, and the camera 193 is used to capture a still image or video. In some embodiments, the electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The external memory interface 120 may be used to connect an external memory card to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.
In the embodiment of the present application, the electronic device may be connected to an external SD card through the external memory interface 120, so that the electronic device may use the SD card to store data, or the electronic device may read data in the SD card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like.
The pressure sensor 180A is used for sensing a pressure signal, and converting the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes); the fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and so on.
The touch sensor 180K is also called a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby.
The keys 190 include a volume key and the like, and the keys 190 may be mechanical keys or touch keys. The electronic device 100 may receive a key input, generate a key signal input related to a user setting and a function control of the electronic device 100.
In the embodiment of the application, by combining the display screen 194 and the touch sensor 180K, when the electronic device displays the information about the abnormal operation of the SD card for the user through the display screen 194, the user can display the information about the abnormal operation of the SD card by clicking the touch screen based on the touch screen formed by the touch sensor 180K and the display screen 194.
For example, fig. 3 is a schematic diagram of a software structure of an electronic device 100 according to an embodiment of the present application, and as shown in fig. 3, a layered architecture divides software into a plurality of layers, each layer has a clear role and division, and the layers communicate with each other through a software interface.
In some embodiments, the Android system may be divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system layer, and a kernel layer from top to bottom.
The application layer may include a series of application packages, for example, the application packages may include camera, calendar, phone, map, phone, music, settings, mailbox, video, or social applications, among other possible ways.
In a possible manner, the application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer, the application framework layer may include a window manager, a content provider, a resource manager, a view system or a notification manager, and the application framework layer further includes some predefined functions.
The window manager is used for managing window programs, and can acquire the size of the display screen; the content provider is used for storing and acquiring data and making the data accessible to the application program; the data may include browsing history and bookmarks, calls made and answered, video, images, audio or phone books, etc.
Among other things, the resource manager provides various resources, such as localized strings, icons, pictures, layout files, video files, etc., to the application.
The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The notification manager enables the application program to display notification information in the status bar, can be used for conveying notification type messages, can automatically disappear after short-time stopping, and does not need user interaction. For example, a notification manager is used to inform download completion, message alerts, and the like. The notification manager may also be a notification that appears in the form of a chart or scroll bar text on the top status bar of the system, e.g., a notification for a running application in the background, or a notification that appears on the screen in the form of a dialog window, e.g., prompting a text message in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
In the embodiment of the application, the electronic device can display the information of the abnormal operation of the SD card to the user in a pop-up window notification manner based on the notification manager, or the electronic device can trigger the display of the information for prompting the abnormal operation of the SD card in a pull-down bar manner based on the notification manager.
The Android runtime is used for scheduling and managing an Android system in a possible mode and can comprise a core library and a virtual machine. Wherein, the core library comprises two parts: one part is a function to be called by java language, and the other part is a kernel library of android; the virtual machine is used for executing the functions of object safety and exception management, life cycle management, stack management, thread management, garbage collection and the like.
It should be noted that the application layer and the application framework layer run in the virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine.
In a possible manner, the system layer may include a plurality of functional modules. For example: surface managers (surface managers), Media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used for managing the display subsystem and providing fusion of 2D and 3D layers for a plurality of application programs; the three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like; the 2D graphics engine is a drawing engine for 2D drawing; the media library supports various commonly used video format playback and recording, audio and still image files, etc., and the media library may support various audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
In a possible manner, the kernel layer is a layer between hardware and software, and the kernel layer at least includes a display driver, an audio driver, a sensor driver, or the like.
In the embodiment of the present application, with reference to fig. 3, an mmcblk driver and user space event (ue) interface is in the kernel layer, so that the electronic device can detect an interrupt report about SD card insertion based on the mmcblk, and further, the electronic device can determine whether the SD card is inserted into the electronic device based on the ue interface; when the electronic device confirms that the SD card is inserted into the electronic device at the Uevent interface, further, the electronic device may report an event that the SD card is inserted into the electronic device to a disk daemon (volume daemon, vold) of the system layer through the Uevent interface.
The vold is a control center of an external storage system in the Android platform and is a background process for managing and controlling the external storage device of the Android platform. For example, the functions that vold can implement include: the method comprises the following steps of SD card plugging event detection, SD card mounting, SD card unloading or SD card formatting and the like.
With reference to fig. 2 and fig. 3, for example, fig. 4 is a schematic flowchart of a system exception handling method provided in the embodiment of the present application, and as shown in fig. 4, the method may include the following steps:
s401: the electronic device detects an interrupt report on the secure digital memory card SD card insertion at the kernel layer.
In the embodiment of the present application, with reference to fig. 2, since the electronic device may connect the external SD card based on the external memory interface 120, when the SD card is connected to the external memory interface 120, the electronic device may detect an interrupt report about the insertion of the secure digital memory card SD card in the kernel layer, and thus, based on the interrupt report, the electronic device may perform subsequent processing on the SD card, for example, detect whether the SD card is inserted into the electronic device or detect whether the SD card is usable or not; the interrupt report may include, among other things, the time at which the SD card was detected to be inserted into the electronic device.
It can be understood that the specific content of the interrupt report and the implementation manner of the electronic device detecting the interrupt report related to the insertion of the secure digital memory card SD card in the kernel layer may also be set according to practical application scenarios, and the embodiment of the present application is not limited.
S402: and the electronic equipment scans a user space event Uevent interface of the kernel layer to confirm that the SD card is inserted into the electronic equipment.
In this embodiment, the electronic device may confirm that the SD card is inserted into the electronic device at a user space event (Uevent) interface based on the SD card scanning processing program. For example, the SD card scanning processing program may be mmc _ rescan, which is a function that can be used to detect relevant information of the SD card inserted into the electronic device, such as the type of the SD card, the data structure of the SD card, the capacity of the SD card, or the access rate supported by the SD card; it can be understood that specific contents of the related information of the SD card may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
It should be noted that, with reference to fig. 2, when it is confirmed that the SD card is inserted into the electronic device, the electronic device may supply power to the SD card based on the power management module 141, so that the SD card may operate.
S403: and the electronic equipment reports the event that the SD card is inserted into the electronic equipment to the system layer through the kernel layer.
Accordingly, the system layer may know an event that the SD card has been inserted into the electronic device, and further, the electronic device may perform S404.
S404: the electronic equipment starting subprocess performs File System Check (FSCK) on the data of the SD card.
In the embodiment of the application, the data of the SD card refers to the disk metadata of the SD card, and before the electronic equipment mounts the SD card, the electronic equipment needs to check the legality and consistency of the disk metadata of the SD card, so that the electronic equipment performs FSCK on the disk metadata of the SD card by a sub-process; the electronic device may create a sub-process for executing the FSCK through a fork function, so that the electronic device may determine whether to kill the sub-process based on the running of the sub-process; moreover, the sub-process does not affect the main process, and the sub-process and the main process are asynchronously executed processes.
S405: the electronic device monitors the sub-process in the main process.
In the embodiment of the application, the electronic device may monitor the sub-process in the main process through a Profiler command, and further, the electronic device may know relevant information of the sub-process, such as memory usage of the sub-process, running time of the sub-process, electric quantity consumed by running the sub-process, and the like; it can be understood that specific contents of the related information of the sub-process may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
It can be understood that the specific implementation manner of the electronic device monitoring the sub-process in the main process may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
S406: and when the running of the subprocess meets the preset condition, the electronic equipment stops the subprocess.
In this embodiment of the application, the preset condition may be set by a user, or may be set by the electronic device when the electronic device leaves a factory, for example, the preset condition may be that the electronic device is stuck, and specific contents of the preset condition may also be set according to an actual application scenario, and the embodiment of the application is not limited.
In the embodiment of the application, the running of the sub-process meets the preset condition, and it can be understood that the electronic device is stuck due to the fact that the electronic device runs the sub-process, and the authority and the priority of the sub-process are not high, so that the electronic device can kill the sub-process through lowmem-killer, that is, the electronic device stops the sub-process, and thus the electronic device interrupts the processing process of performing FSCK on the data of the SD.
In summary, in the embodiment of the present application, when it is determined that the SD card is inserted into the electronic device, the electronic device may perform FSCK on data of the SD card through the sub-process based on an event that the SD card is inserted into the electronic device, which is received at a system layer, and monitor the operation of the sub-process in the main process, so as to know the operation of the sub-process in time.
Based on the embodiment shown in fig. 4, exemplarily, fig. 5 is a schematic flowchart of a system exception handling method provided in the embodiment of the present application, and as shown in fig. 5, the method may include the following steps:
s501: the electronic device detects an interrupt report on the secure digital memory card SD card insertion at the kernel layer.
In the embodiment of the present application, referring to fig. 2, since there is a multimedia-media-block (mmcblk) driver in the core layer, the electronic device may detect an interrupt report about the insertion of the secure digital memory card SD card through the mmcblk driver in the core layer. For example, the mmcblk driver includes a driver, and the driver can recognize a read/write request of the SD card, so that the electronic device can detect an interrupt report about the SD card insertion of the secure digital memory card according to the read/write request.
It can be understood that a specific implementation manner of the electronic device detecting the interrupt report related to the secure digital memory card SD card insertion at the kernel layer may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
S502: and the electronic equipment scans a user space event Uevent interface of the kernel layer to confirm that the SD card is inserted into the electronic equipment.
S503: and the electronic equipment reports the event that the SD card is inserted into the electronic equipment to the system layer through the kernel layer.
In this embodiment, referring to fig. 2, because the mmcblk driver is located in the kernel layer, and the disk daemon (volume daemon, vold) is located in the system layer, according to S502, the electronic device scans and confirms that the SD card is inserted into the electronic device at the Uevent interface, and further, the electronic device may report an event that the SD card is inserted into the electronic device to the vold of the system layer through the Uevent interface, and accordingly, the vold of the system layer may obtain the event that the SD card is inserted into the electronic device.
It can be understood that the specific implementation manner of the event that the SD card is inserted into the electronic device is reported to the system layer by the electronic device through the kernel layer, and may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
S504: the electronic equipment starting subprocess performs File System Check (FSCK) on the data of the SD card.
S505: the electronic device monitors the sub-process in the main process.
S506: and when the running time of the sub-process is greater than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value, the electronic equipment stops the sub-process.
In the embodiment of the application, the electronic device can know the running of the sub-process in time by executing the step S505, so that the electronic device can stop the sub-process based on the running of the sub-process; the running of the sub-process may include a running time of the sub-process or a memory occupation ratio of the electronic device during running of the sub-process, and the memory occupation ratio of the electronic device during running of the sub-process may be understood as a ratio of a memory in the electronic device and a running memory of the electronic device, which is applied for running the sub-process.
In one possible implementation manner, the electronic device stops the sub-process when the running time of the sub-process is judged to be greater than or equal to the first value. For example, when the running time of the sub-process is 110 seconds and the first value is 60 seconds, the electronic device may stop the sub-process since 110 seconds >60 seconds.
In another possible implementation manner, when the electronic device determines that the running time of the sub-process is smaller than a first value, the electronic device determines whether a memory occupation ratio of the electronic device in the running of the sub-process is larger than or equal to a second value; and when the memory occupation ratio of the electronic equipment is greater than or equal to the second value in the running of the subprocess, the electronic equipment stops the subprocess.
For example, when the running time of the sub-process is 40 seconds, the first value is 60 seconds, the electronic device further determines the memory usage ratio of the electronic device during the running of the sub-process because 40 seconds is less than 60 seconds, and when the second value is 40% and the memory usage ratio of the electronic device during the running of the sub-process is 55%, the electronic device may stop the sub-process because 55% > 40%.
The electronic equipment can call a kill (kill) fsck subprocess, and then the electronic equipment stops the subprocess through the kill fsck subprocess; it can be understood that the implementation manner of the electronic device stopping the sub-process may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
Wherein the electronic device may set the first and second values described above based on the historical data; the historical data comprises the running time of the plurality of sub-processes and the memory occupation proportion of the electronic equipment in the running of the plurality of sub-processes. For example, the first value may be an average value of the running times of the plurality of sub-processes, or may be the running time of one of the sub-processes; the second value may be an average value of memory occupation ratios of the electronic device in the running of a plurality of sub-processes, or may be a memory occupation ratio of the electronic device in the running of one sub-process; it can be understood that the specific value of the first value and the specific value of the second value may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
S507: and when the memory occupation ratio of the electronic equipment is smaller than the second value in the running of the subprocess, the electronic equipment waits for the preset time length and then judges whether the running time of the subprocess is larger than or equal to the first value again.
In this embodiment of the application, the preset time may be 1 second, so that the electronic device may determine whether the running time of the sub-process is greater than or equal to the first value again after 1 second, and when the electronic device determines that the running time of the sub-process is greater than or equal to the first value, the electronic device may refer to the content adaptation description of S506, which is not described herein again.
It can be understood that the specific value of the preset time may also be set according to an actual application scenario, and the embodiment of the present application is not limited.
S508: and the electronic equipment displays a user interface, wherein the user interface comprises information for prompting the SD card to operate abnormally.
In this embodiment of the present application, the information about the abnormal operation of the SD card may include that the SD card is an abnormal SD, and may also include that metadata of a disk in the SD card is damaged, and it can be understood that specific contents of the information about the abnormal operation of the SD card may also be set according to an actual application scenario, and this embodiment of the present application is not limited.
In the embodiment of the application, a User Interface (UI) may include a notification popup window or a drop-down bar, and when the UI includes the notification popup window, information for prompting the SD card to operate abnormally may be displayed in the notification popup window, so that a user may see the information that the SD card operates abnormally; or, when the user interface comprises the pull-down bar, the user triggers the pull-down bar, and the pull-down bar is used for displaying information for prompting the abnormal operation of the SD card according to the triggering of the user, so that the user can know that the SD card operates abnormally.
It should be noted that, because the electronic device includes a plug-in for creating a page reminder and a status prompt bar, for example, a notify plug-in, the electronic device may display the UI through the notify plug-in, so as to display information about abnormal operation of the SD card, and further prompt the user that the SD card is abnormal in operation, so that the user may replace the SD card, or the user may perform formatting processing and the like on the SD card on the electronic device.
Taking an electronic device as an example of a terminal device, for example, fig. 6 is a schematic diagram of a drop-down box provided in an embodiment of the present application, where when a user triggers the drop-down box on the terminal device, information for prompting an SD card to operate abnormally may be displayed on the drop-down box, for example, the SD card is abnormal, and the drop-down box also displays content that may cause file loss due to continuous use and suggests that you replace the SD card with backup data, so that the user may replace the SD card according to the content, or the user may format the SD card on the terminal device according to the content, so that the terminal device may continue to use the SD card, thereby expanding a data storage space of the electronic device and improving user experience.
With reference to the embodiments shown in fig. 4 or fig. 5, for example, fig. 7 is a schematic flowchart of an electronic device mounting an SD card according to an embodiment of the present disclosure, as shown in fig. 7, when an interrupt report about SD card insertion is detected by an mmcblk driver after the SD card is inserted into the electronic device, the electronic device scans that the SD card is inserted into the electronic device at a Uevent interface, so that the electronic device can report an event that the SD card is inserted into the electronic device to a vold through the Uevent interface, and when the vold does not respond to the SD card normally, the electronic device can determine that the SD card inserted into the electronic device is an abnormal SD card, and therefore, the electronic device does not mount the SD card, so that the electronic device cannot use the SD card; when the response of the vold to the SD card is normal, the electronic device may perform FSCK on the data of the SD card, and in the FSCK process of the electronic device, if the electronic device is stuck, blacked or restarted, the data in the SD card may be abnormal, for example, the format of the data of the SD card is abnormal, so that the electronic device cannot mount the SD card in a proper directory, and therefore the electronic device does not mount the SD card; if the electronic equipment does not have the conditions of card pause, black screen, restart and the like, the electronic equipment can mount the SD card, so that the electronic equipment can use the SD card to store data, the data storage space of the electronic equipment can be expanded, and the use experience of a user is improved.
When the electronic device is stuck, blacked or restarted, the memory occupied by the electronic device running the FSCK may be too large, so that on the basis of the embodiment shown in fig. 7, a sub-process may be created, and the memory of the electronic device is prevented from being too large according to the running of the sub-process, thereby preventing the electronic device from being stuck, blacked or restarted, and further preventing the system of the electronic device from being crashed.
Exemplarily, fig. 8 is a schematic flowchart of a system exception handling provided by an embodiment of the present application, where the method in the embodiment of the present application is used in a process in which an electronic device in fig. 7 performs FSCK on data in an SD card, as shown in fig. 8, the electronic device creates a sub-process, and since different file systems need to call different FSCK, the electronic device may call doCheck () to detect a file system in the SD card, when the file system is EXT4, the electronic device may start FSCK corresponding to EXT4, when the file system is FAT, the electronic device may start FSCK corresponding to FAT, and further, the electronic device may perform FSCK on data in the SD card; and when the electronic equipment performs FSCK on the data in the SD card in the subprocess, the electronic equipment can monitor the running time of the subprocess and the memory occupation ratio of the electronic equipment in the running of the subprocess in the main process, so that the electronic equipment can determine whether to stop the subprocess according to the running time of the subprocess and the memory occupation ratio of the electronic equipment in the running of the subprocess.
In one example, when the running time of the sub-process is greater than or equal to 60 seconds, the electronic device calls a kill fsck sub-process, and the sub-process is stopped through the kill fsck sub-process; or, when the running time of the sub-process is not greater than or equal to 60 seconds, that is, the running time of the sub-process is less than 60 seconds, the electronic device may call the kill fsck sub-process and stop the sub-process through the kill fsck sub-process under the condition that the memory occupation ratio of the electronic device in the running of the sub-process is greater than or equal to 40%.
Therefore, after the electronic equipment stops the subprocess, the electronic equipment can display the UI, and the information of the SD card running abnormity is displayed through the UI interface, so that a user can be prompted to replace the SD card, or the user is prompted to perform formatting processing on the SD card.
For another example, when the running time of the sub-process is not greater than or equal to 60 seconds, that is, the running time of the sub-process is less than 60 seconds, the electronic device may wait for 1 second when the memory occupied proportion of the electronic device in the running of the sub-process is not greater than or equal to 40%, that is, the memory occupied proportion of the electronic device in the running of the sub-process is less than 40%, and determine again whether the running time of the sub-process is greater than or equal to 60 seconds after 1 second, so that the electronic device repeatedly executes the determination process, so that the determination result of the electronic device is not affected by the external network environment, and the accuracy of the determination result is improved.
It should be noted that, with reference to fig. 7, in the flowchart shown in fig. 8, after performing FSCK on data of the SD card, the electronic device may perform corresponding steps based on a determination result of the host process, which is not described herein again.
In the flowchart shown in fig. 8, with reference to fig. 7, when the electronic device displays a UI to prompt the user to replace the SD card, or after prompting the user to perform a formatting process on the SD card, the electronic device executes the step of not mounting the SD card in fig. 7.
The method of the embodiment of the present application is described above with reference to fig. 4 to 8, and the apparatus for performing the method provided by the embodiment of the present application is described below. Those skilled in the art can understand that the method and the apparatus can be combined and referred to each other, and the system exception handling apparatus provided in the embodiments of the present application can perform the steps in the system exception handling method described above.
Fig. 9 is a schematic structural diagram of a system exception handling apparatus according to an embodiment of the present disclosure, and as shown in fig. 9, the apparatus 90 may be an electronic device, or may be a chip or a chip system applied to the electronic device; the apparatus 90 comprises: a processing unit 901, the processing unit 901 is configured to support the system exception handling apparatus to execute the step of information processing.
Exemplarily, the processing unit 901 is configured to detect an interrupt report on the secure digital memory card SD card insertion at a kernel layer; the processing unit 901 is further configured to scan a user space event Uevent interface at the kernel layer, and confirm that the SD card is inserted into the electronic device; the processing unit 901 is further configured to report, to the system layer, an event that the SD card is inserted into the electronic device through the kernel layer; the processing unit 901 is further configured to start a subprocess to perform file system check FSCK on data of the SD card; the processing unit 901 is further configured to monitor a sub-process in the main process; the processing unit 901 is further configured to stop the sub-process when the running of the sub-process meets a preset condition.
In a possible implementation manner, the processing unit 901 is specifically configured to: and stopping the subprocess when the running time of the subprocess is larger than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the subprocess is larger than or equal to a second value.
In a possible implementation manner, the processing unit 901 is specifically configured to: judging whether the running time of the sub-process is greater than or equal to a first value or not; stopping the sub-process when the running time of the sub-process is greater than or equal to a first value; or when the running time of the sub-process is less than the first value, judging whether the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value; and stopping the subprocess when the memory occupation ratio of the electronic equipment is greater than or equal to a second value in the running of the subprocess.
In a possible implementation manner, the processing unit 901 is further configured to: and when the memory occupation ratio of the electronic equipment is smaller than a second value in the running of the subprocess, waiting for a preset time length, and judging whether the running time of the subprocess is larger than or equal to the first value again.
In a possible implementation manner, the first value is 60 seconds, the second value is 40%, and the preset time duration is 1 second.
In a possible implementation manner, the processing unit 901 is specifically configured to: a kill file system is invoked to check the kill fsck sub-process, which is used to stop the sub-process.
In a possible implementation manner, the processing unit 901 is further configured to: and displaying a user interface, wherein the user interface comprises information for prompting the SD card to operate abnormally.
In one possible implementation manner, the user interface comprises a notification popup window, and information for prompting the SD card to operate abnormally is displayed in the notification popup window; or the user interface comprises a drop-down bar, and the drop-down bar is used for displaying information for prompting the SD card to operate abnormally according to user trigger.
In a possible implementation manner, the processing unit 901 is specifically configured to: an interrupt report about the insertion of the secure digital memory card SD card is detected by a multimedia card block mmcblk driver of the kernel layer.
In a possible implementation manner, the processing unit 901 is specifically configured to: and reporting the event that the SD card is inserted into the electronic equipment to a disk daemon process vold of the system layer through a user space event Uevent interface.
In a possible embodiment, the system exception handling apparatus may further include: a memory cell 902. The processing unit 901 and the storage unit 902 are connected via a communication bus.
The storage unit 902 may include one or more memories, which may be devices in one or more devices or circuits for storing programs or data.
The storage unit 902 may exist independently, and is connected to the processing unit 901 of the system exception handling apparatus through a communication bus; the storage unit 902 may also be integrated with the processing unit 901.
The system exception handling apparatus may be used in a system exception handling device, circuit, hardware component, or chip.
Fig. 10 is a schematic diagram of a hardware structure of a system exception handling apparatus according to an embodiment of the present disclosure, and as shown in fig. 10, the system exception handling apparatus includes a processor 101, a communication line 104, and at least one communication interface (an example of the communication interface 103 in fig. 10 is described as an example).
The processor 101 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more ics for controlling the execution of programs in accordance with the present disclosure.
The communication link 104 may include circuitry to communicate information between the aforementioned components.
The communication interface 103 may be any device, such as a transceiver, for communicating with other devices or communication networks, such as ethernet, Wireless Local Area Networks (WLAN), etc.
Possibly, the system exception handling apparatus may further comprise a memory 102.
The memory 102 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that may store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 102 may be separate and coupled to the processor 101 via a communication line 104. The memory 102 may also be integrated with the processor 101.
The memory 102 is used for storing computer-executable instructions for executing the present application, and is controlled by the processor 101 to execute. The processor 101 is configured to execute computer-executable instructions stored in the memory 102, thereby implementing the methods provided by the embodiments of the present application.
Possibly, the computer executed instructions in the embodiments of the present application may also be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
In particular implementations, processor 101 may include one or more CPUs, such as CPU0 and CPU1 in fig. 10, for example, as one embodiment.
In one embodiment, the system exception handling apparatus may include a plurality of processors, for example, the processor 101 and the processor 105 in fig. 10. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
Exemplarily, fig. 11 is a schematic structural diagram of a chip provided in an embodiment of the present application. Chip 110 includes one or more (including two) processors 1110 and a communication interface 1130.
In some embodiments, memory 1140 stores the following elements: an executable module or a data structure, or a subset thereof, or an expanded set thereof.
In the present embodiment, memory 1140 may comprise read only memory and random access memory and provide instructions and data to processor 1110. A portion of memory 1140 may also include non-volatile random access memory (NVRAM).
In the illustrated embodiment, memory 1140, communication interface 1130, and memory 1140 are coupled via bus system 1120. The bus system 1120 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. For ease of description, the various buses are identified in FIG. 11 as bus system 1120.
The methods described in the embodiments of the present application may be applied to the processor 1110, or may be implemented by the processor 1110. Processor 1110 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 1110. The processor 1110 may be a general-purpose processor (e.g., a microprocessor or a conventional processor), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an FPGA (field-programmable gate array) or other programmable logic device, discrete gate, transistor logic device or discrete hardware component, and the processor 1110 may implement or execute the methods, steps and logic blocks disclosed in the embodiments of the present invention.
The steps of the method combined with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium mature in the field, such as a random access memory, a read only memory, a programmable read only memory, or a charged erasable programmable memory (EEPROM). The storage medium is located in the memory 1140, and the processor 1110 reads the information in the memory 1140, and combines the hardware thereof to complete the steps of the above-mentioned method.
In the above embodiments, the instructions stored by the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be written in the memory in advance, or may be downloaded in the form of software and installed in the memory.
The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. Computer instructions may be stored in, or transmitted from, a computer-readable storage medium to another computer-readable storage medium, e.g., from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optics, Digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.), the computer-readable storage medium may be any available medium that a computer can store or a data storage device including one or more available media integrated servers, data centers, etc., the available media may include, for example, magnetic media (e.g., floppy disks, hard disks, or magnetic tape), optical media (e.g., digital versatile disks, DVD), or a semiconductor medium (e.g., a Solid State Disk (SSD)), etc.
The embodiment of the application also provides a computer readable storage medium. The methods described in the above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may include any medium that can communicate a computer program from one place to another. A storage medium may be any target medium that can be accessed by a computer.
As one possible design, the computer-readable medium may include a compact disk read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disk storage; the computer readable medium may include a disk memory or other disk storage device. Also, any connecting line may also be properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers.
Combinations of the above should also be included within the scope of computer-readable media. The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (23)
1. A method for system exception handling, the method comprising:
the electronic equipment detects an interrupt report about the insertion of the secure digital storage card SD card in the kernel layer;
the electronic equipment scans a user space event Uevent interface of the kernel layer to confirm that the SD card is inserted into the electronic equipment;
the electronic equipment reports the event that the SD card is inserted into the electronic equipment to a system layer through the kernel layer;
the electronic equipment starts a subprocess to perform File System Check (FSCK) on the data of the SD card;
the electronic equipment monitors the sub-process in the main process;
and when the running of the sub-process meets a preset condition, the electronic equipment stops the sub-process.
2. The method according to claim 1, wherein the electronic device stops the sub-process when the running of the sub-process meets a preset condition, and comprises:
and when the running time of the sub-process is greater than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the sub-process is greater than or equal to a second value, the electronic equipment stops the sub-process.
3. The method according to claim 2, wherein the stopping of the sub-process by the electronic device when the running time of the sub-process is greater than or equal to a first value and/or the memory usage ratio of the electronic device during the running of the sub-process is greater than or equal to a second value comprises:
the electronic equipment judges whether the running time of the sub-process is greater than or equal to the first value;
when the running time of the sub-process is greater than or equal to the first value, the electronic equipment stops the sub-process;
or when the running time of the sub-process is less than the first value, the electronic device judges whether the memory occupation ratio of the electronic device in the running of the sub-process is greater than or equal to the second value; and when the memory occupation ratio of the electronic equipment is greater than or equal to the second value in the running of the subprocess, the electronic equipment stops the subprocess.
4. The method of claim 3, further comprising:
and when the memory occupation ratio of the electronic equipment is smaller than the second value in the running of the sub-process, after waiting for a preset time length, the electronic equipment judges whether the running time of the sub-process is larger than or equal to the first value again.
5. The method according to claim 4, wherein the first value is 60 seconds, the second value is 40%, and the preset time period is 1 second.
6. The method of any of claims 1-5, wherein the electronic device stopping the sub-process comprises:
and the electronic equipment calls a kill file system to check a kill fsck subprocess, and the kill fsck subprocess is used for stopping the subprocess.
7. The method of claim 1, wherein after the electronic device stops the sub-process, the method further comprises:
and the electronic equipment displays a user interface, wherein the user interface comprises information for prompting the abnormal operation of the SD card.
8. The method according to claim 7, wherein the user interface comprises a notification popup window in which information for prompting the SD card to operate abnormally is displayed;
or the user interface comprises a pull-down bar, and the pull-down bar is used for displaying information for prompting the SD card to operate abnormally according to user trigger.
9. The method according to claim 1, wherein the electronic device detects an interrupt report on the secure digital memory card (SD) insertion at a kernel layer, comprising:
the electronic equipment detects an interrupt report about the insertion of the secure digital storage card SD card through a multimedia card block mmcblk driver of the kernel layer.
10. The method according to claim 1, wherein the reporting, by the electronic device, to a system layer through the kernel layer of the event that the SD card is inserted into the electronic device comprises:
and the electronic equipment reports the event that the SD card is inserted into the electronic equipment to a disk daemon process vold of the system layer through the Uevent interface of the user space.
11. A system exception handling apparatus, the apparatus comprising a processing unit;
the processing unit is used for detecting an interrupt report about the insertion of the secure digital memory card SD card in the kernel layer;
the processing unit is further configured to scan a user space event Uevent interface of the kernel layer and confirm that the SD card is inserted into the electronic device;
the processing unit is further configured to report, to a system layer through the kernel layer, an event that the SD card has been inserted into the electronic device;
the processing unit is also used for starting a subprocess to perform File System Check (FSCK) on the data of the SD card;
the processing unit is also used for monitoring the sub-process in the main process;
and when the running of the subprocess meets a preset condition, the processing unit is further used for stopping the subprocess.
12. The apparatus according to claim 11, wherein the processing unit is specifically configured to: and stopping the subprocess when the running time of the subprocess is greater than or equal to a first value and/or the memory occupation ratio of the electronic equipment in the running of the subprocess is greater than or equal to a second value.
13. The apparatus according to claim 12, wherein the processing unit is specifically configured to: judging whether the running time of the sub-process is greater than or equal to the first value; stopping the sub-process when the running time of the sub-process is greater than or equal to the first value; or when the running time of the sub-process is less than the first value, judging whether the memory occupation proportion of the electronic equipment in the running of the sub-process is greater than or equal to the second value; and when the memory occupation ratio of the electronic equipment is greater than or equal to the second value in the running of the subprocess, stopping the subprocess.
14. The apparatus of claim 13, wherein the processing unit is further configured to: and when the memory occupation ratio of the electronic equipment is smaller than the second value in the running of the sub-process, waiting for a preset time length, and then judging whether the running time of the sub-process is larger than or equal to the first value again.
15. The apparatus of claim 14, wherein the first value is 60 seconds, the second value is 40%, and the preset time period is 1 second.
16. The apparatus according to any one of claims 11 to 15, wherein the processing unit is specifically configured to: and calling a kill file system to check a kill fsck subprocess, wherein the kill fsck subprocess is used for stopping the subprocess.
17. The apparatus of claim 11, wherein the processing unit is further configured to: and displaying a user interface, wherein the user interface comprises information for prompting the SD card to operate abnormally.
18. The apparatus according to claim 17, wherein the user interface comprises a notification popup window in which information for prompting the SD card to operate abnormally is displayed;
or the user interface comprises a pull-down bar, and the pull-down bar is used for displaying information for prompting the SD card to operate abnormally according to user trigger.
19. The apparatus according to claim 11, wherein the processing unit is specifically configured to: an interrupt report about the insertion of the secure digital memory card SD card is detected by a multimedia card block mmcblk driver of the kernel layer.
20. The apparatus according to claim 11, wherein the processing unit is specifically configured to: and reporting the event that the SD card is inserted into the electronic equipment to a disk daemon process vold of the system layer through the Uevent interface of the user space.
21. A system exception handling apparatus comprising a processor and a memory, the memory for storing code instructions; the processor is configured to execute the code instructions to perform the method of any one of claims 1-10.
22. A computer-readable storage medium having instructions stored thereon that, when executed, cause a computer to perform the method of any of claims 1-10.
23. A computer program product, comprising a computer program which, when executed, causes a computer to perform the method of any one of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110561962.4A CN113032130A (en) | 2021-05-24 | 2021-05-24 | System exception handling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110561962.4A CN113032130A (en) | 2021-05-24 | 2021-05-24 | System exception handling method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113032130A true CN113032130A (en) | 2021-06-25 |
Family
ID=76455512
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110561962.4A Pending CN113032130A (en) | 2021-05-24 | 2021-05-24 | System exception handling method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113032130A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070174839A1 (en) * | 2006-01-24 | 2007-07-26 | Ruriko Takahashi | Method and system for managing programs within systems |
CN104503828A (en) * | 2014-12-12 | 2015-04-08 | 广东欧珀移动通信有限公司 | Process management method and terminal |
CN105005502A (en) * | 2015-07-15 | 2015-10-28 | 上海斐讯数据通信技术有限公司 | Method and system for ending SD card using process through kernel |
CN106528158A (en) * | 2016-11-18 | 2017-03-22 | 广东欧珀移动通信有限公司 | Method and device for mounting memory card and mobile terminal |
CN107665142A (en) * | 2017-07-24 | 2018-02-06 | 平安科技(深圳)有限公司 | A kind of method, terminal and computer-readable recording medium for detecting application program operation flow and interrupting |
CN110618908A (en) * | 2019-09-09 | 2019-12-27 | 中山市天启智能科技有限公司 | Method for quickly verifying screen and machine display interface |
CN111198759A (en) * | 2018-11-16 | 2020-05-26 | 深圳市优必选科技有限公司 | Memory optimization method, system, terminal equipment and readable storage medium |
-
2021
- 2021-05-24 CN CN202110561962.4A patent/CN113032130A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070174839A1 (en) * | 2006-01-24 | 2007-07-26 | Ruriko Takahashi | Method and system for managing programs within systems |
CN104503828A (en) * | 2014-12-12 | 2015-04-08 | 广东欧珀移动通信有限公司 | Process management method and terminal |
CN105005502A (en) * | 2015-07-15 | 2015-10-28 | 上海斐讯数据通信技术有限公司 | Method and system for ending SD card using process through kernel |
CN106528158A (en) * | 2016-11-18 | 2017-03-22 | 广东欧珀移动通信有限公司 | Method and device for mounting memory card and mobile terminal |
CN107665142A (en) * | 2017-07-24 | 2018-02-06 | 平安科技(深圳)有限公司 | A kind of method, terminal and computer-readable recording medium for detecting application program operation flow and interrupting |
CN111198759A (en) * | 2018-11-16 | 2020-05-26 | 深圳市优必选科技有限公司 | Memory optimization method, system, terminal equipment and readable storage medium |
CN110618908A (en) * | 2019-09-09 | 2019-12-27 | 中山市天启智能科技有限公司 | Method for quickly verifying screen and machine display interface |
Non-Patent Citations (3)
Title |
---|
YIHONGYUELAN: "Andorid 2.3 SD卡挂载流程浅析", 《WWW.LINUXIDC.COM/LINUX/2011-11/47136P3.HTM》 * |
吕为工,张策: "《嵌入式计算机系统设计》", 31 March 2017 * |
杨文志: "《深入Linux建构与管理 Red Hat 7.X》", 30 April 2001 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11853820B2 (en) | Cross-process communication method, apparatus, and device | |
CN111880991B (en) | Memory optimization method and device, electronic equipment and computer readable storage medium | |
CN109522147A (en) | A kind of method, apparatus, storage medium and the terminal of record booting exception information | |
CN114020652B (en) | Application program management method and electronic equipment | |
CN110633190B (en) | Application program memory monitoring method, device, equipment and storage medium | |
CN110865837A (en) | Method and terminal for upgrading system | |
CN110502345A (en) | A kind of overload protection method, device, computer equipment and storage medium | |
CN112394906A (en) | Method and equipment for switching application operation | |
CN115407943A (en) | Memory dump file generation method, device and equipment and readable storage medium | |
CN113467981A (en) | Exception handling method and device | |
CN114579055A (en) | Disk storage method, device, equipment and medium | |
CN113412480B (en) | Mounting processing method, mounting processing device, electronic equipment and computer readable storage medium | |
CN110764962A (en) | Log processing method and device | |
CN113536320A (en) | Error information processing method, device and storage medium | |
CN109634782B (en) | Method and device for detecting system robustness, storage medium and terminal | |
CN117724892A (en) | Dump data generation method, electronic device and storage medium | |
CN111475356A (en) | System startup test information display method and related device | |
CN113672445A (en) | Method for recording running state information of target program and electronic equipment | |
CN113032130A (en) | System exception handling method and device | |
CN109254856B (en) | Method for providing interface to client by intelligent POS server | |
CN116610392A (en) | HDMI screen control method, device, computer equipment and storage medium | |
CN115168119A (en) | PCIE (peripheral component interface express) link detection method, device and medium for server | |
CN115421960A (en) | UE memory fault recovery method, device, electronic equipment and medium | |
CN116610648A (en) | Log storage method and device, electronic equipment and storage medium | |
CN116450473A (en) | Method for positioning memory stepping problem and electronic equipment |
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: 20210625 |