IO request processing method, device, storage medium and electronic device

By marking the target threads in interactive events and increasing the frequency of processor and memory, the lag caused by thread IO waiting in electronic device interaction scenarios is solved, and the operation efficiency and user experience are improved.

CN111831462BActive Publication Date: 2024-11-15GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010628768.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-01
Publication Date
2024-11-15
Estimated Expiration
2040-07-01

AI Technical Summary

Technical Problem

Electronic devices often experience lag in interactive scenarios, mainly due to the inefficiency of running due to the long-term IO waiting state.

Method used

By determining and marking the target threads used to execute interactive events as first-class threads, the operating frequency of the processor and/or memory is increased to speed up the running speed of the threads when these threads are in the IO waiting state.

Benefits of technology

It effectively reduces lag in interactive scenarios and improves thread operation efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111831462B_ABST
    Figure CN111831462B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, storage medium and electronic device for processing IO requests, wherein the embodiment of the present application determines a target thread for executing related tasks in an interactive event, and marks the target thread as a first-class thread; when a thread in an IO wait state is detected, the category of the thread is determined; if the thread is a first-class thread, the operating frequency of the processor and / or memory is increased. When the system detects that the thread executing the related task in the interactive event enters the IO wait state, the operating frequency of the processor and / or memory is increased to speed up the running speed of the thread, end the IO wait state of the thread as soon as possible, and reduce the jamming phenomenon in the interactive scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and in particular to a method, device, storage medium and electronic equipment for processing IO requests. Background Art

[0002] With the development of technology, more and more applications are installed in electronic devices, such as video applications, game applications, and instant messaging applications, etc. This requires electronic devices to often run many applications in the foreground and background, which easily causes freezes in user interaction scenarios. Summary of the invention

[0003] The embodiments of the present application provide a method, device, storage medium and electronic device for processing IO requests, which can reduce the jamming phenomenon in interactive scenarios.

[0004] In a first aspect, an embodiment of the present application provides a method for processing an IO request, including:

[0005] Determine a target thread for executing related tasks in the interactive event, and mark the target thread as a first-category thread;

[0006] When a thread in an IO wait state is detected, determining a category of the thread;

[0007] If the thread is a first type of thread, the operating frequency of the processor and / or memory is increased.

[0008] In a second aspect, an embodiment of the present application further provides an IO request processing device, including:

[0009] A thread marking module, used to determine a target thread for executing a related task in an interactive event, and mark the target thread as a first-category thread;

[0010] A thread identification module, for determining the type of a thread when a thread in an IO wait state is detected;

[0011] The parameter adjustment module is used to increase the operating frequency of the processor and / or the memory if the thread is a first-type thread.

[0012] In a third aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program runs on a computer, the computer executes a method for processing IO requests as provided in any embodiment of the present application.

[0013] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory has a computer program, and the processor executes a method for processing an IO request as provided in any embodiment of the present application by calling the computer program.

[0014] The technical solution provided by the embodiment of the present application is that the running status of the threads that execute related tasks in the interactive event affects whether the jamming phenomenon will occur in the interactive event. If these threads are in the IO waiting state for a long time and cannot run normally, it will cause the running efficiency of the threads to be low and jamming to occur. The solution of the present application determines the target threads for executing related tasks in the interactive event, and marks these target threads as first-class threads. When the system detects that such threads enter the IO waiting state, the operating frequency of the processor and / or memory is increased to speed up the running speed of the thread, end the IO waiting state of the thread as soon as possible, and reduce the jamming phenomenon in the interactive scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0016] Figure 1 A first flow chart of a method for processing IO requests provided in an embodiment of the present application.

[0017] Figure 2 A schematic diagram of an application scenario of the method for processing IO requests provided in an embodiment of the present application.

[0018] Figure 3 A second flow chart of the method for processing IO requests provided in an embodiment of the present application.

[0019] Figure 4 A schematic diagram of the structure of an IO request processing device provided in an embodiment of the present application.

[0020] Figure 5 A first structural schematic diagram of an electronic device provided in an embodiment of the present application.

[0021] Figure 6 A second structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0023] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0024] The embodiment of the present application provides a method for processing an IO request, and the execution subject of the method for processing an IO request may be the IO request processing device provided in the embodiment of the present application, or an electronic device integrating the IO request processing device, wherein the IO request processing device may be implemented in hardware or software. The electronic device may be a smart phone, tablet computer, PDA, laptop computer, desktop computer or other device.

[0025] See also Figure 1 , Figure 1 The first flow chart of the method for processing IO requests provided in the embodiment of the present application is as follows:

[0026] In 101, a target thread for executing related tasks in an interactive event is determined, and the target thread is marked as a first-category thread.

[0027] In an embodiment of the present application, the operating system of the electronic device may be a system based on the Linux kernel, such as an Android operating system. System processes and application processes are running on the electronic device. A thread is an execution path of a process and is the smallest unit when a program is executed. A process can have multiple threads, but at least one thread. For the kernel, when performing resource scheduling, such as CPU (central processing unit) scheduling, it is specific to a certain thread. There is a main thread in the process, and it will also create many sub-threads to assist in the work. For example, a WeChat application process will start a main thread to execute code, and other sub-threads will be started during execution to assist in running the task code of each part.

[0028] The operation of the system process of the electronic device and the process of the application program requires the system kernel to allocate IO (Input / Output) resources for them. When the system is under a high IO load state, some threads may enter the IO wait state. For example, thread 1 needs to wait for the IO processing of thread 2 in the system to be completed before it can continue to run, then thread 1 is considered to have entered the IO wait state. If the thread is in the IO wait state for a long time, it will cause the thread to run inefficiently. If the threads that affect the user experience are inefficient because they are in the IO wait state for a long time, it will cause a jamming phenomenon, affecting the user experience. In order to solve this problem, the embodiment of the present application identifies the threads that affect the user experience from the system threads and marks them out.

[0029] The processes in the embodiments of the present application include system-level processes and application-level processes. When a process has a task to execute, a thread will be created to execute the task. Since the scenarios that produce user-perceivable interface freezes are mostly relative to the process running in the foreground. Therefore, in the scheme of the embodiments of the present application, when a process switched to the foreground is detected, the foreground process is first determined. After the foreground process is determined, the thread used to execute the relevant tasks in the interactive event is determined from the threads of the foreground process as the target thread.

[0030] For example, in one embodiment, a first preset thread for executing related tasks in an interactive event is identified from threads of a foreground process as a target thread; a preset tag is added to the target thread to mark the thread as a first-category thread.

[0031] Since whether the threads that execute related tasks in interactive events can run smoothly determines whether user-perceivable lags will occur in interactive events, these threads that are closely related to user experience are recorded as ux (user experience) threads, i.e., first-class threads. In the embodiment of the present application, threads other than ux threads are recorded as second-class threads. The operation of second-class threads generally does not affect user experience, or has little impact.

[0032] Among them, the system architecture of the electronic device includes at least an application framework layer and a kernel layer. In an embodiment of the present application, ux threads are identified and marked from the perspective of the framework layer and the kernel layer. For example, the application framework layer adds preset labels to some threads that directly execute related tasks in interactive events to mark these threads as static ux threads, and the kernel layer marks some threads that indirectly affect the execution of related tasks in interactive events as dynamic ux threads.

[0033] For example, the first preset thread includes some threads created when the process is running and used to directly execute tasks related to interactive events, such as UI (user interface) thread, Render thread, GL thread, user input event distribution thread, user input event detection thread, etc., where the GL thread is the rendering thread of OGL (OpenGraphics Library). Whether these threads can run smoothly determines whether there will be user-perceivable lag in the interactive interface between the user and the process.

[0034] For example, a user uses a chat software to chat with a friend. The user enters text in the dialog box, and the electronic device sends the text entered by the user to the friend's electronic device through the server. In this interactive event, the UI thread, Render thread, user input event distribution thread, user input event detection thread and other threads need to work together to complete this interactive event. The operation of each thread requires the system to allocate resources for it. Therefore, when the process switches to the foreground, these threads are identified and preset tags are added to them, such as the ux tag, marking them as ux threads.

[0035] Among them, the first preset thread is generally an application-level thread, which can be determined by analyzing the actual jamming scenario. For example, in the test, if an application jam occurs in a certain user interaction scenario, and the analysis of the scenario finds that the jamming phenomenon is caused by a certain thread processing tasks too slowly, then it can be considered that the thread is used to execute related tasks in the interactive event, and the operation of the thread is closely related to the user experience, and the thread can be used as the first preset thread.

[0036] Based on this, various possible jamming scenarios can be tested to record the threads that cause jamming. The electronic device stores the relevant information of the first preset threads, and when the process is switched to the foreground, all threads belonging to the pre-recorded first preset threads under the process are marked as ux threads.

[0037] It is understandable that, for the electronic device, the stored relevant information of the first preset thread is not unmodifiable, and when the system is upgraded, the relevant information of the first preset thread can be updated.

[0038] Furthermore, in another embodiment, the method further comprises: when it is detected that a second preset thread is created, marking the created second preset thread as a first-class thread, wherein the second preset thread is a system-level thread.

[0039] Since in the process of executing interactive events, in addition to application-level threads, some system-level threads may be involved to complete tasks, the system framework layer also needs to mark these system-level threads as ux threads. Generally, these threads are created when the system starts. Therefore, when the system starts, these threads can be identified and marked, such as Surfaceflinger threads (layer synthesis threads), system animation threads, etc. Alternatively, during the operation of the system, if it is detected that a new system process thread is created and used to perform related tasks in the interactive event, the system framework layer also marks these threads as ux threads. For example, SystemUI (system interface) threads. Among them, the second preset thread can also be determined by analyzing the actual jamming scene. For example, in the test, if an application jam occurs in a certain user interaction scene, and the jamming phenomenon is found to be caused by a system-level thread processing task too slowly through the analysis of the scene, it can be considered that the system-level thread is used to perform related tasks in the interactive event. The operation of the system-level thread is closely related to the user experience, and the system-level thread can be used as the second preset thread. The electronic device stores the relevant information of these second preset threads, and if it is detected that the system has created these threads, they are marked as ux threads.

[0040] Linux uses the task_struct structure to describe and record threads. Each thread has a corresponding task_struct structure. The task_struct records the name, identifier, state, priority, memory pointer, context data and other attribute information of the thread. Therefore, the application framework layer can add the corresponding uxflag member to the task_struct structure to mark the UI thread, Render thread, GL thread and other threads of the foreground process that perform related tasks in the interactive event with the ux flag, so that the kernel layer can identify the task attributes of the thread.

[0041] It should be noted that the above-mentioned static ux threads are only examples and are not limited to them. As long as it is a thread that directly executes related tasks in an interactive event and its operation directly affects the user experience, it can be marked as a static ux thread. For the application framework layer, when it is detected that the newly created thread is used to execute an interactive event, or when it is detected that some resident system-level threads are used to process interactive events, these threads are added with ux tags to mark them as static ux threads.

[0042] In another embodiment, "determining a target thread for executing relevant tasks in an interactive event from threads of a foreground process, and marking the target thread as a first-category thread" also includes: during the running of the foreground process, when a newly created thread is detected, determining whether the newly created thread is used to execute relevant tasks in an interactive event; when the newly created thread is used to execute relevant tasks in an interactive event, marking the newly created thread as a first-category thread.

[0043] When a foreground process is running, if an interactive event occurs, in addition to the first preset thread mentioned above, there may be some temporarily created task threads. The operation of these task threads will directly affect whether there will be user-perceivable lag in the user's interaction interface with the process. Therefore, the application framework layer will also mark these threads as ux threads to optimize the system's resource allocation to the threads.

[0044] Among them, the electronic device determines the interactive event that occurs based on the detected user instruction. It should be noted that the interactive event in the embodiment of the present application can also be understood as a user interactive event, which generally refers to the situation that after the user triggers a certain instruction, the electronic device needs to respond to the instruction immediately, perform some processing and display the processing result on the interface. For example, users use electronic devices to watch videos, edit text messages, use chat software, use game software, control the switching of electronic device interfaces, use browsing to browse web pages, etc., all of which belong to interactive events. For example, a user uses chat software to chat with a friend, the user enters text in the dialog box, and the electronic device sends the text entered by the user to the friend's electronic device through the server. In this process, the electronic device needs to schedule multiple threads to complete this interactive event. From the start to the completion of the interactive event, the threads created by the process to complete this interactive event can be considered as threads related to the user experience.

[0045] In some embodiments, after marking the target thread as the first type of thread, the method further includes: if the foreground process is an application process, when it is detected that the foreground process switches to background execution, deleting the preset label of the first preset thread.

[0046] When the foreground process switches to the background, the running status of the process is no longer related to the user experience, and the importance of its thread has also decreased. Therefore, the ux mark of the first preset thread corresponding to the process can be deleted, and these ux threads can be restored to ordinary threads, and resources can be allocated to them according to the second allocation mechanism.

[0047] In addition, for those task threads temporarily created in interactive events, they will be destroyed after completing the corresponding tasks, and they will naturally lose the ux tag. For the second preset threads at the system level, even if the foreground and background switching of the process occurs, these threads are always related to the user experience, so they always retain the ux tag.

[0048] The above embodiment introduces the identification of static ux threads. Although some threads do not directly execute tasks related to interactive events, the operation of these threads will also affect the operation of static ux threads, and then indirectly affect the execution of tasks related to interactive events. In other words, these threads are not always related to user experience, but these threads may be associated with static ux threads through resource constraints during a certain period of time during the execution process. Therefore, in some embodiments, in order to further reduce the jamming phenomenon in interactive scenarios, these threads with constraints between static ux threads are also marked as ux threads. Once this constraint relationship ends, the thread will be restored to a non-ux thread. In the embodiment of the present application, such threads are defined as dynamic ux threads. Among them, the specific constraint relationship includes but is not limited to inter-process communication, inter-thread communication, or holding critical section resources. For example, ordinary threads requested by static ux threads through inter-process communication, ordinary threads requested by static ux threads through some inter-thread communication method, ordinary threads holding critical section resources such as waiting semaphores, read-write semaphores, and mutexes required by static ux threads, etc., are marked as dynamic ux threads in the embodiment of the present application.

[0049] Based on this, in some embodiments, the method also includes: detecting the running status of the first-class thread; when it is detected that the first-class thread has entered a blocked state, determining an associated thread that has a constraint relationship with the first-class thread that has entered the blocked state; and adding a preset label to the associated thread to mark the associated thread as a first-class thread.

[0050] In some embodiments, after marking the associated thread as a first-category thread, the method further includes: when it is detected that the constraint relationship is released, deleting the preset label of the associated thread.

[0051] Among them, regarding the blocking state of a thread, it is generally divided into D state (Uninterruptable sleep state) and S state (interruptable sleep state) at the kernel level. For example, if a thread initiates an IO request but is not satisfied, it enters the D state; if a thread initiates a synchronous Binder (an inter-process communication mechanism) request, it enters the S state. Threads generally enter these states because they need to actively or passively give up CPU resources due to some reasons or logic during the execution of the thread task.

[0052] In this embodiment, the kernel layer detects the state of the static ux thread. When it is detected that the ux thread enters a blocked state, the kernel layer determines the associated threads that have a constraint relationship with the ux thread that enters the blocked state. If these associated threads are not allocated resources in time, such as IO resources, resulting in operation obstruction, the slow operation of the associated threads will cause the ux thread to be in a blocked state for a long time. Therefore, in order to avoid the ux thread being in a blocked state for a long time, the kernel layer will also mark the identified associated threads as ux threads to improve their IO processing efficiency and ensure their timely execution, thereby quickly releasing the blocked state of the ux thread.

[0053] The above describes the way in which the application framework layer and the kernel layer identify and mark ux threads. Through any one or more of the above multiple embodiments, threads that affect the user experience are identified and marked as ux threads.

[0054] In 102, when a thread in an IO wait state is detected, the category of the thread is determined.

[0055] In 103, if the thread is a first-type thread, the operating frequency of the processor and / or memory is increased.

[0056] Once the kernel detects a thread that has entered the IO wait state, it first determines the type of the thread. If the thread is a ux thread, the operating frequency of the processor and / or memory is increased to speed up the thread's running efficiency. For example, thread 1 needs to wait for the IO processing of thread 2 in the system to complete before it can continue to run. Thread 1 enters the IO wait state. At this time, if the operating frequency of the processor and / or memory is increased, the running efficiency of thread 2 is accelerated, and thread 2 can complete the IO processing faster to shorten the time that thread 1 is in the IO wait state. At the same time, when thread 1 is running, it can also run at a higher efficiency due to the increase in the operating frequency of the processor and / or memory, thereby improving the execution efficiency of interactive events and reducing the jamming phenomenon in interactive scenarios.

[0057] In one embodiment, the processor core where the thread is located is determined, and the operating frequency of the processor core is increased to the maximum value. Alternatively, in another embodiment, the operating frequency of the memory is increased to the maximum value. Alternatively, in another embodiment, the processor core where the thread is located is determined, and the operating frequencies of the processor core and the memory are increased to the maximum value. Figure 2 , Figure 2 Schematic diagram of application scenarios of the method for processing IO requests provided in the embodiment of the present application. In the related art before the improvement, both the thread running time and the IO waiting time were long. After the improvement of the present application, not only the IO waiting time is shortened, but also the thread running time is reduced.

[0058] In specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.

[0059] From the above, it can be seen that the IO request processing method provided in the embodiment of the present application and the running conditions of the threads that execute the relevant tasks in the interactive event affect whether the jamming phenomenon will occur in the interactive event. If these threads are in the IO waiting state for a long time and cannot run normally, it will cause the running efficiency of the threads to be low and jamming will occur. The scheme of the present application determines the target threads for executing the relevant tasks in the interactive event, and marks these target threads as first-class threads. When the system detects that such threads enter the IO waiting state, the operating frequency of the processor and / or memory is increased to speed up the running speed of the thread, end the IO waiting state of the thread as soon as possible, reduce the jamming phenomenon in the interactive scenario, and improve the user experience.

[0060] See also Figure 3 , Figure 3 A second flow chart of a method for processing an IO request provided by an embodiment of the present invention. The method comprises:

[0061] In 201, when it is detected that the system is started, a second preset thread is determined from threads created during the system startup process, and the second preset thread is marked as a first-category thread.

[0062] Since whether the threads that execute related tasks in the interactive event can run smoothly determines whether the interactive event will cause user-perceivable lag, these threads that are closely related to the user experience are recorded as ux threads, i.e., first-class threads. In the embodiment of the present application, threads other than ux threads are recorded as second-class threads. The operation of the second-class threads generally does not affect the user experience.

[0063] Among them, the system architecture of the electronic device includes at least an application framework layer and a kernel layer. In an embodiment of the present application, ux threads are identified and marked from the perspective of the framework layer and the kernel layer. For example, the application framework layer adds preset labels to some threads that directly execute related tasks in interactive events to mark these threads as static ux threads, and the kernel layer marks some threads that indirectly affect the execution of related tasks in interactive events as dynamic ux threads.

[0064] Since in the process of executing interactive events, in addition to the threads of the corresponding process, some system-level threads may also be involved to complete the task, the system framework layer also needs to mark these system-level threads as ux threads. Generally, these threads are created when the system starts, so when the system starts, these threads can be identified and marked, such as Surfaceflinger threads, system animation threads, etc.

[0065] In 202, when it is detected that a process is switched to the foreground, the foreground process is determined.

[0066] In 203, a first preset thread for executing related tasks in the interactive event is identified from threads of the foreground process as a target thread.

[0067] In 204 , a preset tag is added to the target thread to mark the thread as a first-category thread.

[0068] In 205 , during the running of the foreground process, when a newly created thread is detected, it is determined whether the newly created thread is used to execute related tasks in the interactive event.

[0069] In 206 , when the newly created thread is used to execute related tasks in the interactive event, the newly created thread is marked as a first-category thread.

[0070] In addition, when a process switched to the foreground is detected, the foreground process is first determined. From the threads of the foreground process, a thread used to execute relevant tasks in the interactive event is determined as the target thread. For example, a first preset thread and some temporarily created task threads used to execute relevant tasks in the interactive event. For the first preset thread, it can be determined whether the attribute information of the thread of the foreground process matches the preset attribute information to determine the first preset thread, and these first preset threads are marked as ux threads. For temporarily created task threads, it can be determined whether these threads are threads created during the execution of the interactive event to execute relevant tasks. If so, they are also marked as ux threads.

[0071] In 207, the running status of the first type of threads is detected.

[0072] In 208, when it is detected that a first-type thread enters a blocked state, an associated thread having a constraint relationship with the first-type thread entering the blocked state is determined.

[0073] In 209 , a preset tag is added to the associated thread to mark the associated thread as a first-category thread.

[0074] There are also some threads that do not directly execute the tasks related to the interactive event, but the operation of these threads will also affect the operation of the static ux thread, and then indirectly affect the execution of the tasks related to the interactive event. In other words, these threads are not always related to the user experience, but these threads may be associated with the static ux thread through resource constraints during a certain period of time during the execution process. Therefore, in some embodiments, in order to further reduce the jamming phenomenon in the interactive scenario, these threads with constraints between the static ux threads are also marked as ux threads. Once this constraint relationship ends, the thread will be restored to a non-ux thread. In the embodiment of the present application, such threads are defined as dynamic ux threads. Among them, the specific constraint relationship includes but is not limited to inter-process communication, inter-thread communication, or holding critical section resources. For example, ordinary threads requested by static ux threads through inter-process communication, ordinary threads requested by static ux threads through some inter-thread communication method, ordinary threads holding critical section resources such as waiting semaphores, read-write semaphores, and mutexes required by static ux threads, etc., in the embodiment of the present application, such threads are marked as dynamic ux threads. In addition, it should be noted that the marking of dynamic ux threads is performed at the kernel layer. From the kernel's perspective, it does not distinguish which process these threads belong to. Therefore, the kernel only marks the dynamic ux threads based on the above constraints.

[0075] It is understandable that the marking of the task thread temporarily created to execute the relevant tasks in the interactive event and the marking of the dynamic ux thread do not occur at any specific stage of the foreground process. Therefore, the execution of 205 to 209, 210 to 211 and 212 to 214 can be interleaved and is not limited by the execution order of the described steps.

[0076] In 210, when it is detected that a thread is switched to the foreground for execution, it is determined whether the thread switched to the foreground for execution is a first-category thread;

[0077] If not, execute 211.

[0078] In 211 , a second preset tag is added to the thread to mark the thread as a second type of thread.

[0079] In 212, when a thread in an IO wait state is detected, the category of the thread is determined;

[0080] In 213, if the thread is a first-type thread, the operating frequency of the processor is increased to a maximum value, and the operating frequency of the memory is increased to a maximum value.

[0081] In 214 , if the thread is a second type of thread, the operating frequency of the memory is increased to a maximum value.

[0082] In this embodiment, in addition to marking the ux thread, the threads running in the foreground among the threads other than the ux thread are marked as the second type of threads, recorded as FG threads, and the threads running in the background among the threads other than the ux thread are marked as the third type of threads, recorded as BG threads. When the thread entering the IO wait state is a ux thread, the processor core where the thread is located is determined, and the operating frequencies of the processor core and the memory are increased to the maximum value; when the thread entering the IO wait state is an FG thread, the operating frequency of the memory is increased according to the preset increment. When the thread entering the IO wait state is a BG thread, no processing is performed.

[0083] In addition, in another embodiment, for the FG thread, the operating frequency of the memory can be adjusted as follows: when the kernel detects that the thread entering the IO wait state is the FG thread, if the current operating frequency of the memory is freq1, it is adjusted to 2*freq1; if the thread continues to have IO wait, the operating frequency of the memory is adjusted to 2*2*freq1 until the highest frequency is reached.

[0084] In one embodiment, a device for processing IO requests is also provided. Figure 4 , Figure 4 The schematic diagram of the structure of the IO request processing device 300 provided in the embodiment of the present application. The IO request processing device 300 is applied to an electronic device, and the IO request processing device 300 includes a thread marking module 301, a thread identification module 302 and a parameter adjustment module 303, as follows:

[0085] A thread marking module 301 is used to determine a target thread for executing a related task in an interactive event, and mark the target thread as a first-category thread;

[0086] The thread identification module 302 is used to determine the type of the thread when a thread in an IO wait state is detected;

[0087] The parameter adjustment module 303 is configured to increase the operating frequency of the processor and / or memory if the thread is a first-type thread.

[0088] In some embodiments, the thread marking module 301 is further used to: determine the foreground process when detecting a process switched to the foreground;

[0089] A target thread for executing related tasks in an interactive event is determined from threads of the foreground process, and the target thread is marked as a first-category thread.

[0090] In some embodiments, the thread marking module 301 is further used to: during the running process of the foreground process, when a newly created thread is detected, determine whether the newly created thread is used to execute a related task in the interactive event;

[0091] When a newly created thread is used to execute related tasks in an interaction event, the newly created thread is marked as a first-class thread.

[0092] In some embodiments, the thread marking module 301 is further used for: when it is detected that a second preset thread is created, marking the created second preset thread as a first type of thread, wherein the second preset thread is a system-level thread.

[0093] In some embodiments, the thread marking module 301 is further used to: when the first type of thread in a blocked state is detected, determine an associated thread having a constraint relationship with the first type of thread entering the blocked state;

[0094] The first preset tag is added to the associated thread to mark the associated thread as a first type of thread.

[0095] In some embodiments, the thread marking module 301 is further used to: if the foreground process is an application process, then when it is detected that the foreground process switches to background execution, delete the preset label of the first preset thread.

[0096] In some embodiments, the thread marking module 301 is further used to: when detecting that a thread is switched to the foreground to run, determine whether the thread switched to the foreground to run is a first-category thread;

[0097] If not, adding a second preset label to the thread switched to the foreground to mark the thread as a second type of thread;

[0098] The parameter adjustment module 303 is further configured to: if the thread is a second type of thread, increase the operating frequency of the memory.

[0099] In some embodiments, the parameter adjustment module 303 is further used to: increase the operating frequency of the processor to a maximum value, and increase the operating frequency of the memory to a maximum value.

[0100] It should be noted that the IO request processing device provided in the embodiment of the present application and the IO request processing method in the above embodiment belong to the same concept. Any method provided in the IO request processing method embodiment can be implemented through the IO request processing device. The specific implementation process is detailed in the IO request processing method embodiment, which will not be repeated here.

[0101] From the above, it can be seen that the IO request processing device proposed in the embodiment of the present application and the running conditions of the threads that execute the relevant tasks in the interactive event affect whether the jamming phenomenon will occur in the interactive event. If these threads are in the IO waiting state for a long time and cannot run normally, it will cause the running efficiency of the threads to be low and jamming will occur. The scheme of the present application determines the target threads for executing the relevant tasks in the interactive event, and marks these target threads as first-class threads. When the system detects that such threads enter the IO waiting state, the operating frequency of the processor and / or memory is increased to speed up the running speed of the thread, end the IO waiting state of the thread as soon as possible, and reduce the jamming phenomenon in the interactive scenario.

[0102] The present application also provides an electronic device. The electronic device may be a smart phone, a tablet computer, or other device. Figure 5 , Figure 5 The first structural diagram of the electronic device provided in the embodiment of the present application is as follows: The electronic device 400 includes a processor 401 and a memory 402. The processor 401 is electrically connected to the memory 402.

[0103] The processor 401 is the control center of the electronic device 400. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or calling computer programs stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the electronic device as a whole.

[0104] The memory 402 may be used to store computer programs and data. The computer programs stored in the memory 402 include instructions that can be executed in the processor. The computer programs may constitute various functional modules. The processor 401 executes various functional applications and data processing by calling the computer programs stored in the memory 402.

[0105] In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to implement various functions:

[0106] Determine a target thread for executing related tasks in the interactive event, and mark the target thread as a first-category thread;

[0107] When a thread in an IO wait state is detected, determining a category of the thread;

[0108] If the thread is a first type of thread, the operating frequency of the processor and / or memory is increased.

[0109] In some embodiments, see Figure 6 , Figure 6 A second structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 400 further includes: a radio frequency circuit 403, a display screen 404, a control circuit 405, an input unit 406, an audio circuit 407, a sensor 408, and a power supply 409. The processor 401 is electrically connected to the radio frequency circuit 403, the display screen 404, the control circuit 405, the input unit 406, the audio circuit 407, the sensor 408, and the power supply 409, respectively.

[0110] The radio frequency circuit 403 is used to send and receive radio frequency signals to communicate with network devices or other electronic devices through wireless communication.

[0111] The display screen 404 may be used to display information input by a user or information provided to a user and various graphical user interfaces of the electronic device. These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.

[0112] The control circuit 405 is electrically connected to the display screen 404 and is used to control the display screen 404 to display information.

[0113] The input unit 406 can be used to receive input numbers, character information or user feature information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. The input unit 406 can include a fingerprint recognition module.

[0114] The audio circuit 407 can provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 407 includes a microphone. The microphone is electrically connected to the processor 401. The microphone is used to receive voice information input by the user.

[0115] The sensor 408 is used to collect external environment information. The sensor 408 may include one or more sensors such as an environment brightness sensor, an acceleration sensor, and a gyroscope.

[0116] The power supply 409 is used to supply power to various components of the electronic device 400. In some embodiments, the power supply 409 may be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, power consumption, and other functions.

[0117] Although not shown in the figure, the electronic device 400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0118] In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to implement various functions:

[0119] Determine a target thread for executing related tasks in the interactive event, and mark the target thread as a first-category thread;

[0120] When a thread in an IO wait state is detected, determining a category of the thread;

[0121] If the thread is a first type of thread, the operating frequency of the processor and / or memory is increased.

[0122] As can be seen from the above, an embodiment of the present application provides an electronic device, wherein the running conditions of threads of the electronic device that execute relevant tasks in an interactive event affect whether a jamming phenomenon will occur in the interactive event. If these threads are in an IO waiting state for a long time and cannot run normally, the running efficiency of the threads will be low and jamming will occur. The scheme of the present application determines the target threads for executing relevant tasks in interactive events, and marks these target threads as first-class threads. When the system detects that such threads enter the IO waiting state, the operating frequency of the processor and / or memory is increased to speed up the running speed of the threads, end the IO waiting state of the threads as soon as possible, and reduce the jamming phenomenon in interactive scenarios.

[0123] An embodiment of the present application further provides a storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the method for processing an IO request described in any of the above embodiments.

[0124] It should be noted that, a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the storage medium can include but is not limited to: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0125] In addition, the terms "first", "second", and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.

[0126] The above is a detailed introduction to the IO request processing method, device, storage medium and electronic device provided in the embodiments of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application; at the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for processing an IO request, characterized in that: include: Determine a target thread for executing related tasks in the interactive event, and mark the target thread as a first-category thread; When detecting a thread switched to the foreground, determining whether the thread switched to the foreground is a first-class thread; If not, the thread switched to the foreground is marked as a second-category thread; When a thread in an IO wait state is detected, determining a category of the thread; If the thread is a first-class thread, increasing the operating frequency of the processor and the memory to speed up the running efficiency of other threads that the first-class thread is waiting for; If the thread is the second type of thread, the operating frequency of the memory is increased.

2. The method for processing an IO request according to claim 1, wherein: The step of determining a target thread for executing a related task in an interactive event and marking the target thread as a first-category thread includes: When a process running in the foreground is detected, the foreground process is determined; A target thread for executing related tasks in an interactive event is determined from threads of the foreground process, and the target thread is marked as a first-category thread.

3. The method for processing an IO request according to claim 2, wherein: The method further comprises: During the running of the foreground process, when a newly created thread is detected, determining whether the newly created thread is used to execute a related task in the interactive event; When a newly created thread is used to execute related tasks in an interaction event, the newly created thread is marked as a first-class thread.

4. The method for processing an IO request according to claim 2, wherein: The method further comprises: When it is detected that a second preset thread is created, the created second preset thread is marked as a first-type thread, wherein the second preset thread is a system-level thread.

5. The method for processing an IO request according to claim 3 or 4, characterized in that: After marking the target thread as a first-class thread, the method further includes: When the first type of thread in a blocked state is detected, determining an associated thread having a constraint relationship with the first type of thread in the blocked state; A first preset tag is added to the associated thread to mark the associated thread as a first type of thread.

6. The method for processing an IO request according to claim 3 or 4, characterized in that: After marking the target thread as a first-class thread, the method further includes: If the foreground process is an application process, when it is detected that the foreground process is switched to background operation, the preset label of the first preset thread is deleted.

7. The method for processing an IO request according to claim 5, characterized in that: If not, marking the thread switched to the foreground as a second-class thread includes: If not, a second preset label is added to the thread switched to the foreground to mark the thread as a second type of thread.

8. The method for processing an IO request according to claim 1, wherein: The step of increasing the operating frequency of the processor and / or memory includes: Increase the processor's operating frequency to its maximum value, and increase the memory's operating frequency to its maximum value.

9. A device for processing IO requests, characterized in that: include: a thread marking module, for determining a target thread for executing a related task in an interactive event, and marking the target thread as a first-class thread, and for determining whether the thread switched to the foreground is a first-class thread when detecting a thread switched to the foreground; if not, marking the thread switched to the foreground as a second-class thread; A thread identification module, for determining the type of a thread when a thread in an IO wait state is detected; The parameter adjustment module is used to increase the operating frequency of the processor and / or memory if the thread is a first-class thread, so as to speed up the running efficiency of other threads that the first-class thread is waiting for; and is also used to increase the operating frequency of the memory if the thread is a second-class thread.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed on a computer, the computer is enabled to execute the method for processing an IO request according to any one of claims 1 to 8.

11. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: The processor is configured to execute the method for processing an IO request according to any one of claims 1 to 8 by calling the computer program.