CN117492958B - Thread information adjustment method and device and electronic equipment - Google Patents

Thread information adjustment method and device and electronic equipment Download PDF

Info

Publication number
CN117492958B
CN117492958B CN202311516258.2A CN202311516258A CN117492958B CN 117492958 B CN117492958 B CN 117492958B CN 202311516258 A CN202311516258 A CN 202311516258A CN 117492958 B CN117492958 B CN 117492958B
Authority
CN
China
Prior art keywords
priority
thread
application program
original
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.)
Active
Application number
CN202311516258.2A
Other languages
Chinese (zh)
Other versions
CN117492958A (en
Inventor
许晶
赵东艳
樊琳
杜君
王鑫
易玲
白鹏飞
李延
王祥
秦理想
甄明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor Technology Co Ltd
Original Assignee
Beijing Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Smartchip Microelectronics Technology Co Ltd, Beijing Smartchip Semiconductor Technology Co Ltd filed Critical Beijing Smartchip Microelectronics Technology Co Ltd
Priority to CN202311516258.2A priority Critical patent/CN117492958B/en
Publication of CN117492958A publication Critical patent/CN117492958A/en
Application granted granted Critical
Publication of CN117492958B publication Critical patent/CN117492958B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a thread information adjustment method and device and electronic equipment, and belongs to the technical field of computers. The thread information adjustment method comprises the following steps: receiving an application program installation file sent by a second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set by a thread of an application program corresponding to the application program downloading file; adjusting the priorities of all threads of the application program based on the priority reference value and the priority dynamic range value; the time slices for all threads of the application are adjusted based on the time slice reference value and the time slice dynamic range value. By setting the information adding mode for the application program downloading file, the priority and time slice information of all threads in the application program corresponding to the application program downloading file can be managed, and the defect of disordered execution of the application program is avoided.

Description

Thread information adjustment method and device and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a thread information adjustment method, a thread information adjustment device, and an electronic device.
Background
The operating system generally includes two parts: kernel space running in privileged mode and user space running in non-privileged mode. Since the kernel is the core of the operating system, it manages all the resources in the system and serves upper applications, and therefore needs to run in kernel space. The cores can be divided into different architectures according to the difference of functions realized by the cores, and in different core architectures, the providing mode of system services and the realization mode of hardware driving are different, so that the overall performance and development difficulty of the system are affected. Currently, common core architectures include three types, macro core (Monolithic Kernel), micro core (Microkernel), and Hybrid Kernel (Hybrid Kernel).
Under the micro-kernel architecture, some components such as a driver, application management, a file system and the like are divided into user mode, and some modules can be developed by different manufacturers and downloaded or version-up after being released in an operating system supporting the downloading of the modules. These modules are typically run as kernel mode programs in macro kernel or hybrid kernel architectures, with higher rights and running priorities. After being downloaded as a user mode program, the user mode program becomes a process or thread combination of the user mode, and execution confusion can occur on the scheduling priority and the time slices if the user mode program is only set by a developer and is not managed.
Disclosure of Invention
The embodiment of the invention aims to provide a thread information adjusting method, a thread information adjusting device and electronic equipment, which are used for solving the defects that after a user-state program is downloaded, a user-state process or thread combination is formed, and execution confusion occurs when a scheduling priority and a time slice are set by a developer only and are not managed.
In order to achieve the above object, an embodiment of the present invention provides a thread information adjustment method, applied to a first terminal, including:
Receiving an application program installation file sent by a second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value;
the time slices of all threads of the application are adjusted based on the time slice reference value and the time slice dynamic range value.
Optionally, the adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
And adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value.
Optionally, the determining the original thread priority range value includes:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
and determining an original thread priority range value based on the difference value between the original thread priority maximum value and the original thread priority minimum value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value is implemented by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
Optionally, in the case that the priority after the first thread adjustment of the application program is greater than the sum of the priority reference value and the priority dynamic range value, determining that the priority after the first thread adjustment of the application program is the sum of the priority reference value and the priority dynamic range value.
Optionally, the adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value includes:
calculating a time slice maximum based on the sum of the time slice reference value and the time slice dynamic range value;
Determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum value of the time slice; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the time slice after the first thread adjustment of the application program based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice value includes:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
Optionally, after the step of adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value, the method further includes:
performing thread scheduling based on all threads of the adjusted application program;
Determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread;
the target thread is any one of all threads of the application program.
Optionally, the determining the running state of the target thread based on the CPU occupation time after the target thread is started includes:
And under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
Optionally, the determining the running state of the target thread based on the keep-alive mechanism of the target thread includes:
and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
Optionally, after the step of determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread, the method further includes:
Storing the priority of all threads of the adjusted application program and the time slices of all threads into an application registry;
Performing integrity protection on the application registry to generate an integrity check value;
and under the condition that the integrity check value passes verification, storing the application registry so as to enable the application program to run threads directly by utilizing the priority levels of all threads of the application program after adjustment and the time slices of all threads when the application program runs next time.
Optionally, the application installation file further includes a signature value, where the signature value is obtained based on integrity protection and/or source legitimacy protection of the second terminal;
after the step of receiving the application installation file sent by the second terminal, the method further includes:
And carrying out integrity verification on the signature value and/or carrying out source validity verification.
On the other hand, the embodiment of the invention also provides a thread information adjustment method, which is applied to a second terminal, and comprises the following steps:
constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
And sending the application program installation file to a first terminal so that the first terminal can adjust thread information based on the application program installation file.
Optionally, the constructing the application installation file based on the application download file and the added information includes:
constructing an application program installation file based on the application program downloading file, the added information and the signature value;
wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal.
On the other hand, an embodiment of the present invention further provides a thread information adjustment device, which is applied to a first terminal, where the device includes:
The data acquisition module is used for receiving an application program installation file sent by the second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
The thread priority adjustment module is used for adjusting the priorities of all threads of the application program based on the priority reference value and the priority dynamic range value;
And the thread time slice adjusting module is used for adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value.
Optionally, the adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
And adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value.
Optionally, the determining the original thread priority range value includes:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
and determining an original thread priority range value based on the difference value between the original thread priority maximum value and the original thread priority minimum value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value is implemented by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
Optionally, in the case that the priority after the first thread adjustment of the application program is greater than the sum of the priority reference value and the priority dynamic range value, determining that the priority after the first thread adjustment of the application program is the sum of the priority reference value and the priority dynamic range value.
Optionally, the adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value includes:
calculating a time slice maximum based on the sum of the time slice reference value and the time slice dynamic range value;
Determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum value of the time slice; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the time slice after the first thread adjustment of the application program based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice value includes:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
Optionally, the apparatus further includes:
the thread scheduling module is used for performing thread scheduling based on all threads of the adjusted application program;
The running state determining module is used for determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread;
the target thread is any one of all threads of the application program.
Optionally, the determining the running state of the target thread based on the CPU occupation time after the target thread is started includes:
And under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
Optionally, the determining the running state of the target thread based on the keep-alive mechanism of the target thread includes:
and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
Optionally, the apparatus further includes:
the first storage module is used for storing the priority levels of all threads of the adjusted application program and the time slices of all threads to the application registry;
The protection module is used for carrying out integrity protection on the application registry and generating an integrity check value;
and the second storage module is used for storing the application registry under the condition that the integrity check value passes verification, so that the application program runs next time, and the priority of all threads of the application program after adjustment and the time slices of all threads are directly utilized to run the threads.
Optionally, the application installation file further includes a signature value, where the signature value is obtained based on integrity protection and/or source legitimacy protection of the second terminal;
The apparatus further comprises:
And the verification module is used for carrying out integrity verification on the signature value and/or source validity verification.
On the other hand, an embodiment of the present invention further provides a thread information adjustment device, which is applied to a second terminal, where the device includes:
the construction module is used for constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
and the sending module is used for sending the application program installation file to the first terminal so that the first terminal can adjust the thread information based on the application program installation file.
Optionally, the constructing the application installation file based on the application download file and the added information includes:
constructing an application program installation file based on the application program downloading file, the added information and the signature value;
wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal.
In another aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the thread information adjustment method described above when executing the program.
In another aspect, the present invention also provides a machine-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the thread information adjustment method described above.
According to the technical scheme, the embodiment of the invention adjusts the priority of all threads of the application program based on the priority reference value and the priority dynamic range value included in the application program installation file by receiving the application program installation file sent by the second terminal; the time slices of all threads of the application are adjusted based on the time slice reference values and the time slice dynamic range values included in the application installation file. By setting the information adding mode for the application program downloading file, the priority and time slice information of all threads in the application program corresponding to the application program downloading file can be adjusted or managed so as to meet the actual requirement of the application program operation and avoid the defect of disordered execution of the application program.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain, without limitation, the embodiments of the invention. In the drawings:
FIG. 1 is a flow chart of a thread information adjustment method according to the present invention;
FIG. 2 is a schematic diagram of the present invention for mounting all threads of an application to a thread wait area;
FIG. 3 is a schematic diagram of placing all threads of an application into a two-dimensional collection provided by the present invention;
FIG. 4 is a schematic diagram of a thread priority adjustment method according to the present invention;
FIG. 5 is a second embodiment of a thread priority adjustment method according to the present invention;
FIG. 6 is a third diagram illustrating a thread priority adjustment method according to the present invention;
FIG. 7 is a second flowchart of a thread information adjustment method according to the present invention;
FIG. 8 is a schematic diagram of thread scheduling for all threads based on an adjusted application provided by the present invention;
FIG. 9 is a third flow chart of the thread information adjustment method according to the present invention;
FIG. 10 is a flowchart illustrating a thread information adjustment method according to the present invention;
FIG. 11 is a flowchart illustrating a thread information adjustment method according to the present invention;
FIG. 12 is a flowchart illustrating a thread information adjustment method according to the present invention;
FIG. 13 is a schematic diagram of a thread information adjusting apparatus according to the present invention;
FIG. 14 is a second schematic diagram of a thread information adjusting apparatus according to the present invention;
fig. 15 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
The following describes the detailed implementation of the embodiments of the present invention with reference to the drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the invention, are not intended to limit the invention.
Method embodiment
The embodiment of the invention provides a thread information adjustment method which is applied to a first terminal. The first terminal can be a personal computer, a desktop computer, a tablet personal computer, a smart phone or other devices. Referring to fig. 1, a thread information adjustment method according to an embodiment of the present invention includes:
and step 101, receiving an application program installation file sent by the second terminal.
The first terminal may receive the application installation file sent by the second terminal through a wired (data line) or wireless (WI-FI, bluetooth, operator network, etc.) mode. The application installation file comprises an application download file and adding information.
The adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set by the second terminal for the application program which is correspondingly operated by the application program downloading file. The second terminal may be various terminals that can add information to the application download file, for example, the second terminal may be a server.
The priority reference value is a thread priority minimum value set or specified by the second terminal for the application program corresponding to the application program downloading file. The priority dynamic range value is a maximum range value that increases on the basis of the priority reference value. Wherein, different application programs can be classified and graded, and the thread priority reference value and the priority dynamic range of each application program are set. For example, when the importance level of the application 1 is higher than that of the application 2, and the importance level is higher as the priority is lower, the priority reference value of the thread of the application 1 is set to 10, and the priority dynamic range value is set to 10; the priority reference value of the thread of the application 2 is 20 and the priority dynamic range value is 10.
The time slice reference value is a minimum time slice value set or specified by the second terminal for the thread of the application program corresponding to the running application program downloading file. The time slice dynamic range value is a maximum range value that increases on the basis of the time slice reference value.
And step 103, adjusting the priorities of all threads of the application program based on the priority reference value and the priority dynamic range value.
The first terminal analyzes the application program installation file through the application executor to obtain an application program downloading file and adding information, and stores the application program downloading file into a nonvolatile memory in an embedded operating system of the first terminal. Referring to fig. 2, when the application executor parses and executes the application, all threads of the application are mounted in a thread waiting area, and the first terminal adjusts the priorities of all threads of the application program based on the priority reference value NewPrioBase and the priority dynamic range value NewPrioRng, so that the priorities of all threads of the application program are in a range from the priority reference value to a value range where the priority reference value and the priority dynamic range value are added. For example, the application 1 has 5 threads with priorities of 1, 5, 3, 7, and 9, and the first terminal adjusts the priority reference value to 10 in the added information part and the priority dynamic range value to 10, and then all the threads of the application 1 after adjustment are adjusted to 10, 14, 12, 16, and 18.
And step 104, adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value.
The first terminal adjusts the time slices of all threads of the application based on the time slice reference value NewSliceBase and the time slice dynamic range value NEWSLICERNG so that the time slices of all threads of the application are between the time slice reference value and the numerical range where the time slice reference value and the time slice dynamic range value are added. For example, the application 1 has 1 thread, the time slice is 700ms, the first terminal adjusts the time slice reference value to 100ms and the time slice dynamic range value to 600ms in the addition information part, and the time slice of the adjusted thread is adjusted to 100+600=700 ms. For another example, the application 1 has 1 thread, the time slice is 800ms, the first terminal adjusts the time slice reference value to 300ms in the addition information part, and the time slice dynamic range is 200ms, and the time slice of the adjusted thread is 300+200=500 ms.
According to the embodiment of the invention, the priority of all threads of the application program is adjusted based on the priority reference value and the priority dynamic range value included in the application program installation file by receiving the application program installation file sent by the second terminal; the time slices of all threads of the application are adjusted based on the time slice reference values and the time slice dynamic range values included in the application installation file. By setting the information adding mode for the application program downloading file, the priority and time slice information of all threads in the application program corresponding to the application program downloading file can be adjusted or managed so as to meet the actual requirement of the application program operation and avoid the defect of disordered execution of the application program.
In other aspects of the embodiments of the present invention, step 103, adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
step 1031, determining the original thread priority range value.
The first terminal determines an original thread priority range value. In one embodiment, the original thread priority range value may be stored in a non-volatile memory of the first terminal, and the first terminal may obtain the original thread priority range value from the non-volatile memory, thereby determining the original thread priority range value.
Step 1032, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value.
The first terminal adjusts the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value, so that the priorities of all threads of the application program are in a range from the priority reference value to the value range where the priority reference value and the priority dynamic range value are added.
Further, step 1031, determining an original thread priority range value, includes:
Step 10311, prioritizing all threads of the application to determine an original thread priority maximum and an original thread priority minimum.
Referring to fig. 3, the first terminal may put all threads of the application into a two-dimensional set, including a thread name and a thread priority, where the thread name Tn corresponds to the thread priority TPn one by one, and may form an array or a linked list data structure. The number of the bus threads is n; { T1, T2, …, tn; TP1, TP2, …, TPn }. Wherein, T1 is a thread name, TP1 is a thread priority corresponding to the thread name T1, and the correspondence between the remaining thread names and the thread priorities is similar.
The first terminal ranks the priorities of all threads of the application program according to the priority order from high to low or from low to high, and determines the maximum value and the minimum value of the priority of the original threads. It should be noted that, in some embodiments, the smaller the priority value set by the embedded operating system, the higher the thread execution priority; the greater the priority value set by some embedded operating systems, the higher the thread execution priority. In this embodiment, the priority values may be sorted in order from large to small or from small to large, and the embodiment of the present invention only selects the maximum value and the minimum value of the original thread priority.
Step 10312, determining an original thread priority range value based on the difference between the original thread priority maximum value and the original thread priority minimum value.
And the first terminal determines an original thread priority range value based on the difference value between the original thread priority maximum value and the original thread priority minimum value. For example, the priorities of the original 5 threads of the application program 1 are 1, 5,3, 7 and 9, respectively, and then the original thread priority range value=the original thread priority maximum value-the original thread priority minimum value=9-1=8.
In other aspects of the embodiments of the present invention, step 1032, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value includes:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
Referring to fig. 4, in the case where the priority range value OldPrioRng of the original thread is less than or equal to the priority dynamic range value NewPrioRng, it is indicated that the priority dynamic range value is sufficient for the thread of the application to adjust according to the absolute value of the original priority, and then a linear adjustment method may be used for adjustment. The first terminal determines the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value.
Further, based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value, determining the adjusted priority of the first thread of the application program is realized by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
For example, if the application program 1 has 5 threads, the priorities are 1, 5, 3, 7 and 9, the priority reference value is 10, and the priority dynamic range value is 10, the priority after the priority of the original thread 1 is adjusted=1+10-1=10; priority after the original thread priority 5 is adjusted=5+10-1=14; priority after the original thread priority 3 is adjusted=3+10-1=12; priority after the original thread priority 7 is adjusted=7+10-1=16; the priority after the original thread priority 9 is adjusted=9+10-1=18. I.e. the application 1 has 5 threads with adjusted priorities of 10, 14, 12, 16, 18, respectively.
The invention determines the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value, thereby adjusting or managing the priority of all threads in the application program corresponding to the application program downloading file so as to meet the actual requirement of the application program operation and avoid the defect of disordered execution of the application program.
In other aspects of the embodiments of the present invention, step 1022, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
If the original thread priority range value OldPrioRng is greater than the priority dynamic range value NewPrioRng, i.e., the priority dynamic range value is insufficient for the threads provided to the application to adjust according to the original priority absolute value, then a further determination of the relationship of the priority dynamic range value NewPrioRng to the total number of all threads of the application is required. If the priority dynamic range value NewPrioRng is greater than or equal to the total number n of all threads of the application program, indicating that the priority dynamic range value NewPrioRng is sufficient to provide the application with a priority relative value for adjustment, the first terminal determines the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value.
Further, the determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value. It should be noted that the calculation result of the formula may be rounded up or down. The present embodiment may round down the calculation of the formula.
Referring to fig. 5, (NewPrio m-NewPrioBase)/(OldPriom -OldPrioBase) =cosα= NewPrioRng/OldPrioRng.
For example, if the application 2 has 5 threads, the priorities are 1, 5, 3, 7 and 9, the priority reference value is 20, and the priority dynamic range value is 5, the priority after the adjustment of the original thread priority 1=20+ (1-1) ×5/(9-1) =20; priority after the original thread priority 5 is adjusted=20+ (5-1) 5/(9-1) =22; priority after the original thread priority 3 is adjusted=20+ (3-1) 5/(9-1) =21; priority after the original thread priority 7 is adjusted=20+ (7-1) 5/(9-1) =23; the priority of the original thread after 9 adjustment=20+ (9-1) ×5/(9-1) =25. I.e. the adjusted 5 thread priorities of the application 2 are respectively 20, 22, 21, 23, 25.
The invention determines the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value, thereby adjusting or managing the priority of all threads in the application program corresponding to the application program downloading file so as to meet the actual requirement of application program operation and avoid the defect of disordered application program execution.
In other aspects of the embodiments of the present invention, step 1032, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
If the original thread priority range value OldPrioRng is greater than the priority dynamic range value NewPrioRng, i.e., the priority dynamic range value is insufficient for the threads provided to the application to adjust according to the original priority absolute value, then a further determination of the relationship of the priority dynamic range value NewPrioRng to the total number of all threads of the application is required. If the priority dynamic range value NewPrioRng is less than the total number n of all threads of the application program, indicating that the priority dynamic range value is insufficient to provide the priority relative value for the application program to adjust, the first terminal determines the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value.
Further, referring to fig. 6, determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
It should be noted that, when the priority after the first thread adjustment of the application program is greater than the sum of the priority reference value and the priority dynamic range value, the priority after the first thread adjustment of the application program is determined to be the sum of the priority reference value and the priority dynamic range value. The calculation of the formula may be rounded up or down. The present embodiment may round down the calculation of the formula.
For example, the application program 3 has 5 threads with priorities of 1, 5, 3, 7 and 9, and the manager adjusts the thread reference value to 30 in the process signature modification information part and the dynamic range to 3, so that the priority of the original thread 1 is adjusted to be priority=30+ (1-1) 5/(9-1) =30; the original thread priority 5 is adjusted to be priority=30+ (5-1) 5/(9-1) =32; the original thread priority 3 is adjusted to be priority=30+ (3-1) 5/(9-1) =31; the original thread priority 7 is adjusted to be priority=30+ (7-1) 5/(9-1) =33; the priority level of the original thread priority 9 is adjusted to be=30+ (9-1) ×5/(9-1) =35, and 35 > 30+3=33, so the priority level of the original thread priority 9 is adjusted to be 33. I.e. 30, 32, 31, 33 after the adjustment of the 5 thread priorities of the adjusted application 3.
The invention determines the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program and the original thread priority range value, thereby adjusting or managing the priority of all threads in the application program corresponding to the application program downloading file, meeting the actual requirement of the application program operation and avoiding the defect of disordered execution of the application program.
In other aspects of the embodiments of the present invention, step 104, adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value includes:
Step 1041, calculating a time slice maximum value based on the sum of the time slice reference value and the time slice dynamic range value.
Step 1042, determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice; wherein the first thread is any one thread of all threads of the application program.
For example, if the slice reference value is 100ms and the slice dynamic range value is 600ms, the slice maximum value is 100+600=700 ms. And the first terminal determines the time slice after the first thread of the application program is adjusted based on the size relation between the original time slice of the first thread of the application program and the maximum time slice.
Further, the determining the time slice after the first thread adjustment of the application program based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice value includes:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
Because the influence of the time slice on the call of the thread is smaller, a simpler setting method can be selected in the embodiment of the invention, namely, when the original time slice of the first thread of the application program is larger than or equal to the maximum time slice, the maximum time slice is determined to be the time slice after the first thread of the application program is adjusted. For example, comparing the original time slice NEWSLICEM of the first thread m in progress to the time slice maximum NewSliceMax, if the original time slice NEWSLICEM of the first thread is greater than the time slice maximum NewSliceMax, NEWSLICEM = NewSliceMax.
In other embodiments, the time slices of all threads of the application program may be optionally adjusted by the same method as the thread priority adjustment.
In other aspects of the embodiments of the present invention, referring to fig. 7, after the step of adjusting the time slices of all the threads of the application program based on the time slice reference value and the time slice dynamic range value, step 104 further includes:
Step 105, performing thread scheduling based on all threads of the adjusted application program.
And step 106, determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread. The target thread is any one of all threads of the application program.
Referring to fig. 8, the first terminal mounts all threads of the adjusted application program to the thread waiting area, and performs thread scheduling based on all threads of the adjusted application program. The first terminal determines the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread, so that the thread of the application program can be correctly executed after modification. That is, in one embodiment, the first terminal determines the running state of the target thread based on the CPU occupation time after the target thread is started, so as to determine that the thread of the application program can be correctly executed after modification. In another embodiment, the first terminal determines the running state of the target thread based on the keep-alive mechanism of the target thread, so as to determine that the thread of the application program can be correctly executed after modification. In another embodiment, the first terminal determines the running state of the target thread based on the CPU occupation time after the target thread is started and based on the keep-alive mechanism of the target thread, so as to determine that the thread of the application program can be correctly executed after modification.
Further, determining the running state of the target thread based on the CPU occupation time after the target thread is started includes: and under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
For example, the first terminal may analyze the CPU occupation time of a certain thread for a period of time, such as 5 minutes after the thread starts. If the CPU occupation time of the thread is between [ α1, α2], for example, α1=5%, and α2=65%, within 5 minutes, the thread is considered to be running normally, and the application is executed correctly.
Further, determining the operating state of the target thread based on the keep-alive mechanism of the target thread includes: and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
For example, if the thread needs to feed the dog at intervals, the embedded operating system of the first terminal judges that the thread sends a heartbeat signal (or called dog feeding information), the thread is considered to run normally, and the application program is executed correctly.
The first terminal determines the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread, so that the thread of the application program can be correctly executed after modification.
In other aspects of the embodiments of the present invention, referring to fig. 9, step106, after the step of determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread, further includes:
step 107, the priorities of all threads and the time slices of all threads of the adjusted application program are stored in the application registry.
And 108, performing integrity protection on the application registry to generate an integrity check value.
And step 109, storing the application registry under the condition that the integrity check value passes verification, so that the application program runs the threads directly by using the priorities of all threads of the application program after adjustment and the time slices of all threads when running next time.
The first terminal rewrites the priority levels of all threads and the time slices of all threads of the adjusted application program into an application registry, performs integrity protection on the application registry, and generates an integrity check value. Wherein the application registry information includes thread information of the application program, the thread information including thread name, thread priority, thread entry function, thread time slice, and the like. The integrity check value generation method may use a HASH algorithm, such as SHA1, SHA256, SM3 algorithm, etc. After the embedded operating system of the first terminal verifies the check value, the application registry information is stored in the nonvolatile memory. When the first terminal is restarted or powered down, and the embedded operating system of the first terminal runs again, the thread is directly run by using the new thread priority and the thread time slice in the application registry, so that the thread analysis running time is saved.
In other aspects of embodiments of the present invention, the application installation file further includes a signature value, the signature value being derived based on the integrity protection and/or the source legitimacy protection of the second terminal. Wherein the integrity protection may use HASH algorithms such as SHA1, SHA256, SM3 algorithms, etc.; the source legitimacy protection can use signature methods, such as RSA, ECC, SM, asymmetric algorithm signature, AES, DES, SM, and other symmetric algorithm signatures.
Referring to fig. 10, after step 101, the step of receiving the application installation file sent by the second terminal further includes:
step 102, performing integrity verification on the signature value and/or performing source validity verification.
Specifically, referring to fig. 11, after receiving the application installation file, the first terminal analyzes the application code by an application installer in the embedded system of the first terminal, and analyzes whether the application installation file has a signature value. If the signature value exists, the integrity and source legitimacy of the signature value is verified by using a security module prior to writing the verification signature and integrity verification key value by an administrator; if the problem is not found, the analysis is continued, and if the problem is found, the application installation is exited. The security module may be in the form of a security chip or a security module, or may be in the form of software of a security APP on an embedded operating system.
The embodiment of the invention realizes the security verification of the application program installation file by carrying out the integrity verification on the signature value and/or carrying out the source validity verification.
On the other hand, the embodiment of the invention also provides a thread information adjusting method which is applied to the second terminal. The second terminal may be various terminals that can add information to the application download file, for example, the second terminal may be a server.
Referring to fig. 12, a thread information adjustment method according to an embodiment of the present invention includes:
Step 201, constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloading file runs correspondingly.
The second terminal constructs an application installation file based on the application download file and the addition information. The priority reference value is a thread priority minimum value set or specified by the second terminal for the application program corresponding to the application program downloading file. The priority dynamic range value is a maximum range value that increases on the basis of the priority reference value. Wherein, different application programs can be classified and graded, and the thread priority reference value and the priority dynamic range of each application program are set. For example, when the importance level of the application 1 is higher than that of the application 2, and the importance level is higher as the priority is lower, the priority reference value of the thread of the application 1 is set to 10, and the priority dynamic range value is set to 10; the priority reference value of the thread of the application 2 is 20 and the priority dynamic range value is 10.
The time slice reference value is a minimum time slice value set or specified by the second terminal for the thread of the application program corresponding to the running application program downloading file. The time slice dynamic range value is a maximum range value that increases on the basis of the time slice reference value.
Step 202, sending the application program installation file to a first terminal, so that the first terminal can adjust thread information based on the application program installation file.
And the second terminal sends the application program installation file to the first terminal so that the first terminal can adjust thread information based on the application program installation file. The specific process of thread information adjustment may refer to the related embodiment of the first terminal, which is not described herein.
Further, 201, constructing an application installation file based on the application download file and the addition information, including: and constructing an application program installation file based on the application program download file, the added information and the signature value.
Wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal. Specifically, the second terminal may be obtained by performing integrity protection and/or source validity protection on the signature value through the encryptor. Wherein the integrity protection may use HASH algorithms such as SHA1, SHA256, SM3 algorithms, etc.; the source legitimacy protection can use signature methods, such as RSA, ECC, SM, asymmetric algorithm signature, AES, DES, SM, and other symmetric algorithm signatures.
The embodiment of the invention realizes the encryption of the application program installation file by carrying out the integrity protection and/or the source legitimacy protection on the signature value, and improves the installation safety of the application program installation file.
Device embodiment
Referring to fig. 13, in another aspect, an embodiment of the present invention further provides a thread information adjustment device, which is applied to a first terminal, and the device includes:
the data acquisition module 1301 is configured to receive an application installation file sent by the second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
A thread priority adjustment module 1302, configured to adjust priorities of all threads of the application program based on the priority reference value and the priority dynamic range value;
the thread time slice adjustment module 1303 is configured to adjust time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value.
According to the embodiment of the invention, the priority of all threads of the application program is adjusted based on the priority reference value and the priority dynamic range value included in the application program installation file by receiving the application program installation file sent by the second terminal; the time slices of all threads of the application are adjusted based on the time slice reference values and the time slice dynamic range values included in the application installation file. By setting the information adding mode for the application program downloading file, the priority and time slice information of all threads in the application program corresponding to the application program downloading file can be adjusted or managed so as to meet the actual requirement of the application program operation and avoid the defect of disordered execution of the application program.
Optionally, the adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
And adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value.
Optionally, the determining the original thread priority range value includes:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
and determining an original thread priority range value based on the difference value between the original thread priority maximum value and the original thread priority minimum value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value is implemented by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
Optionally, adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
Optionally, in the case that the priority after the first thread adjustment of the application program is greater than the sum of the priority reference value and the priority dynamic range value, determining that the priority after the first thread adjustment of the application program is the sum of the priority reference value and the priority dynamic range value.
Optionally, the adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value includes:
calculating a time slice maximum based on the sum of the time slice reference value and the time slice dynamic range value;
Determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum value of the time slice; wherein the first thread is any one thread of all threads of the application program.
Optionally, the determining the time slice after the first thread adjustment of the application program based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice value includes:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
Optionally, the apparatus further includes:
the thread scheduling module is used for performing thread scheduling based on all threads of the adjusted application program;
The running state determining module is used for determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread;
the target thread is any one of all threads of the application program.
Optionally, the determining the running state of the target thread based on the CPU occupation time after the target thread is started includes:
And under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
Optionally, the determining the running state of the target thread based on the keep-alive mechanism of the target thread includes:
and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
Optionally, the apparatus further includes:
the first storage module is used for storing the priority levels of all threads of the adjusted application program and the time slices of all threads to the application registry;
The protection module is used for carrying out integrity protection on the application registry and generating an integrity check value;
and the second storage module is used for storing the application registry under the condition that the integrity check value passes verification, so that the application program runs next time, and the priority of all threads of the application program after adjustment and the time slices of all threads are directly utilized to run the threads.
Optionally, the application installation file further includes a signature value, where the signature value is obtained based on integrity protection and/or source legitimacy protection of the second terminal;
The apparatus further comprises:
And the verification module is used for carrying out integrity verification on the signature value and/or source validity verification.
The thread information adjusting device includes a processor and a memory, where the data acquiring module 1301, the thread priority adjusting module 1302, the thread time slice adjusting module 1303, and the like are stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
Referring to fig. 14, in another aspect, an embodiment of the present invention further provides a thread information adjustment device, applied to a second terminal, where the device includes:
a construction module 1401 for constructing an application installation file based on the application download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
and a sending module 1402, configured to send the application installation file to a first terminal, so that the first terminal performs thread information adjustment based on the application installation file.
Optionally, the constructing the application installation file based on the application download file and the added information includes:
constructing an application program installation file based on the application program downloading file, the added information and the signature value;
wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal.
The thread information adjusting apparatus includes a processor and a memory, the above-mentioned construction module 1401, the transmission module 1402, and the like are stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
Fig. 15 illustrates a physical structure diagram of an electronic device, as shown in fig. 15, which may include: processor 1510, communication interface (Communications Interface) 1520, memory 1530, and communication bus 1540, wherein processor 1510, communication interface 1520, memory 1530 communicate with each other via communication bus 1540. The processor 1510 may invoke logic instructions in the memory 1530 to perform a thread information adjustment method comprising: receiving an application program installation file sent by a second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs; adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value; the time slices of all threads of the application are adjusted based on the time slice reference value and the time slice dynamic range value. Or alternatively
Constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs; and sending the application program installation file to a first terminal so that the first terminal can adjust thread information based on the application program installation file.
Further, the logic instructions in the memory 1530 described above may be implemented in the form of software functional units and may be stored on a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In yet another aspect, the present invention provides a machine-readable storage medium having stored thereon a computer program which when executed by a processor is implemented to perform a thread information adjustment method, the method comprising: receiving an application program installation file sent by a second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs; adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value; the time slices of all threads of the application are adjusted based on the time slice reference value and the time slice dynamic range value. Or alternatively
Constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs; and sending the application program installation file to a first terminal so that the first terminal can adjust thread information based on the application program installation file.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (32)

1. A method for adjusting thread information, applied to a first terminal, the method comprising:
Receiving an application program installation file sent by a second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value;
Adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value;
The adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value;
the determining the original thread priority range value comprises the following steps:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
determining an original thread priority range value based on a difference between the original thread priority maximum value and the original thread priority minimum value;
Adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value, including:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one of all threads of the application program;
The determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is realized by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
2. The thread information adjustment method according to claim 1, wherein adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value includes:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
3. The thread information adjustment method according to claim 2, wherein the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, and the original thread priority minimum value is implemented by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
4. The thread information adjustment method according to claim 1, wherein adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value includes:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
5. The thread information adjustment method according to claim 4, wherein the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
6. The thread information adjustment method according to claim 5, wherein the priority after the first thread adjustment of the application is determined to be the sum of the priority reference value and the priority dynamic range value in the case where the priority after the first thread adjustment of the application is greater than the sum of the priority reference value and the priority dynamic range value.
7. The thread information adjustment method according to claim 1, wherein the adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value includes:
calculating a time slice maximum based on the sum of the time slice reference value and the time slice dynamic range value;
Determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum value of the time slice; wherein the first thread is any one thread of all threads of the application program.
8. The thread information adjustment method according to claim 7, wherein the determining the adjusted time slice of the first thread of the application program based on the magnitude relation between the original time slice of the first thread of the application program and the maximum time slice value comprises:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
9. The thread information adjustment method according to claim 1, wherein after the step of adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value, further comprising:
performing thread scheduling based on all threads of the adjusted application program;
Determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread;
the target thread is any one of all threads of the application program.
10. The thread information adjustment method according to claim 9, wherein determining the running state of the target thread based on the CPU occupation time after the start of the target thread includes:
And under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
11. The thread information adjustment method according to claim 9, wherein the determining the running state of the target thread based on the keep-alive mechanism of the target thread includes:
and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
12. The thread information adjustment method according to claim 9, wherein after the step of determining the running state of the target thread based on the CPU occupation time after the start of the target thread and/or based on the keep-alive mechanism of the target thread, further comprises:
Storing the priority of all threads of the adjusted application program and the time slices of all threads into an application registry;
Performing integrity protection on the application registry to generate an integrity check value;
and under the condition that the integrity check value passes verification, storing the application registry so as to enable the application program to run threads directly by utilizing the priority levels of all threads of the application program after adjustment and the time slices of all threads when the application program runs next time.
13. The thread information adjustment method according to any one of claims 1 to 12, wherein the application installation file further comprises a signature value, the signature value being obtained based on integrity protection and/or source legitimacy protection of the second terminal;
after the step of receiving the application installation file sent by the second terminal, the method further includes:
And carrying out integrity verification on the signature value and/or carrying out source validity verification.
14. A method for adjusting thread information, applied to a second terminal, the method comprising:
constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
sending the application program installation file to a first terminal so that the first terminal can adjust thread information based on the application program installation file;
The first terminal adjusts the priority of all threads of the application program based on the priority reference value and the priority dynamic range value;
The adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value;
the determining the original thread priority range value comprises the following steps:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
determining an original thread priority range value based on a difference between the original thread priority maximum value and the original thread priority minimum value;
Adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value, including:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one of all threads of the application program;
The determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is realized by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
15. The thread information adjustment method according to claim 14, wherein the constructing an application installation file based on the application download file and the addition information includes:
constructing an application program installation file based on the application program downloading file, the added information and the signature value;
wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal.
16. A thread information adjustment device, applied to a first terminal, comprising:
The data acquisition module is used for receiving an application program installation file sent by the second terminal; the application program installation file comprises an application program downloading file and adding information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
The thread priority adjustment module is used for adjusting the priorities of all threads of the application program based on the priority reference value and the priority dynamic range value;
The thread time slice adjusting module is used for adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value;
The adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value;
the determining the original thread priority range value comprises the following steps:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
determining an original thread priority range value based on a difference between the original thread priority maximum value and the original thread priority minimum value;
Adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value, including:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one of all threads of the application program;
The determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is realized by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
17. The thread information adjustment apparatus according to claim 16, wherein adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value, comprises:
Determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value and the original thread priority minimum value under the condition that the original thread priority range value is smaller than or equal to the priority dynamic range value; wherein the first thread is any one thread of all threads of the application program.
18. The thread information adjustment apparatus according to claim 17, wherein the determining the adjusted priority of the first thread of the application program based on the original priority of the first thread of the application program, the priority reference value, and the original thread priority minimum value is implemented by the following formula:
NewPriom=OldPriom+NewPrioBase-OldPrioMin;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, and OldPrioMin represents the minimum priority of the original thread.
19. The thread information adjustment apparatus according to claim 16, wherein adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value, and the priority dynamic range value, comprises:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the total number of all threads of the application program, and the original thread priority range value, when the original thread priority range value is greater than the priority dynamic range value, and the priority dynamic range value is less than the total number of all threads of the application program; wherein the first thread is any one thread of all threads of the application program.
20. The thread information adjustment apparatus of claim 19, wherein the determining the adjusted priority of the first thread of the application based on the original priority of the first thread of the application, the priority reference value, the original thread priority minimum value, the total number of all threads of the application, and the original thread priority range value is implemented by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*n/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application program, oldPrio m represents the original priority of the first thread of the application program, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum value, n represents the total number of all threads of the application program, and OldPrioRng represents the original thread priority range value.
21. The thread information adjustment apparatus according to claim 20, wherein the priority after the first thread adjustment of the application program is determined to be the sum of the priority reference value and the priority dynamic range value in the case where the priority after the first thread adjustment of the application program is greater than the sum of the priority reference value and the priority dynamic range value.
22. The thread information adjustment apparatus of claim 16, wherein the adjusting the time slices of all threads of the application program based on the time slice reference value and the time slice dynamic range value comprises:
calculating a time slice maximum based on the sum of the time slice reference value and the time slice dynamic range value;
Determining a time slice after the first thread of the application program is adjusted based on the magnitude relation between the original time slice of the first thread of the application program and the maximum value of the time slice; wherein the first thread is any one thread of all threads of the application program.
23. The thread information adjustment apparatus of claim 22, wherein the determining the adjusted time slice of the first thread of the application based on the magnitude relation between the original time slice of the first thread of the application and the maximum time slice value comprises:
And determining that the maximum time slice is the time slice after the first thread of the application program is adjusted under the condition that the original time slice of the first thread of the application program is greater than or equal to the maximum time slice.
24. The thread information adjustment device of claim 16, wherein the device further comprises:
the thread scheduling module is used for performing thread scheduling based on all threads of the adjusted application program;
The running state determining module is used for determining the running state of the target thread based on the CPU occupation time after the target thread is started and/or based on the keep-alive mechanism of the target thread;
the target thread is any one of all threads of the application program.
25. The thread information adjustment apparatus of claim 24, wherein determining the running state of the target thread based on the CPU occupation time after the start of the target thread comprises:
And under the condition that the CPU occupation time after the target thread is started is within the set threshold value range, determining that the target thread runs normally.
26. The thread information adjustment apparatus of claim 24, wherein the determining the operating state of the target thread based on the keep-alive mechanism of the target thread comprises:
and under the condition that the heartbeat signal sent by the target thread is received, determining that the target thread runs normally.
27. The thread information adjustment device of claim 16, wherein the device further comprises:
the first storage module is used for storing the priority levels of all threads of the adjusted application program and the time slices of all threads to the application registry;
The protection module is used for carrying out integrity protection on the application registry and generating an integrity check value;
and the second storage module is used for storing the application registry under the condition that the integrity check value passes verification, so that the application program runs next time, and the priority of all threads of the application program after adjustment and the time slices of all threads are directly utilized to run the threads.
28. The thread information adjustment device according to any one of claims 16 to 27, wherein the application installation file further comprises a signature value, the signature value being derived based on an integrity protection and/or a source legitimacy protection of the second terminal;
The apparatus further comprises:
And the verification module is used for carrying out integrity verification on the signature value and/or source validity verification.
29. A thread information adjustment device, applied to a second terminal, comprising:
the construction module is used for constructing an application program installation file based on the application program download file and the addition information; the adding information comprises a priority reference value, a priority dynamic range value, a time slice reference value and a time slice dynamic range value which are set for the thread of the application program of which the application program downloads the file and correspondingly runs;
The sending module is used for sending the application program installation file to the first terminal so that the first terminal can adjust thread information based on the application program installation file;
The first terminal adjusts the priority of all threads of the application program based on the priority reference value and the priority dynamic range value;
The adjusting the priority of all threads of the application program based on the priority reference value and the priority dynamic range value includes:
determining the priority range value of the original thread;
adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value;
the determining the original thread priority range value comprises the following steps:
the priority ordering is carried out on all threads of the application program so as to determine the maximum value of the priority of the original thread and the minimum value of the priority of the original thread;
determining an original thread priority range value based on a difference between the original thread priority maximum value and the original thread priority minimum value;
Adjusting the priorities of all threads of the application program based on the original thread priority range value, the priority reference value and the priority dynamic range value, including:
Determining a priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value, and the priority dynamic range value, if the original thread priority range value is greater than the priority dynamic range value, and if the priority dynamic range value is greater than or equal to the total number of all threads of the application program; wherein the first thread is any one of all threads of the application program;
The determining the priority of the first thread of the application program after adjustment based on the original priority of the first thread of the application program, the priority reference value, the original thread priority minimum value, the original thread priority range value and the priority dynamic range value is realized by the following formula:
NewPriom=NewPrioBase+(OldPriom-OldPrioBase)*NewPrioRng/OldPrioRng;
Wherein NewPrio m represents the adjusted priority of the first thread of the application, oldPrio m represents the original priority of the first thread of the application, newPrioBase represents the priority reference value, oldPrioBase represents the original thread priority minimum, newPrioRng represents the priority dynamic range value, and OldPrioRng represents the original thread priority range value.
30. The thread information adjustment apparatus as recited in claim 29, wherein the constructing an application installation file based on the application download file and the addition information comprises:
constructing an application program installation file based on the application program downloading file, the added information and the signature value;
wherein the signature value is obtained based on the integrity protection and/or the source legitimacy protection of the second terminal.
31. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the thread information adjustment method of any one of claims 1 to 13 when executing the program; or to implement the thread information adjustment method of any one of claims 14 to 15 when executing the program.
32. A machine readable storage medium having stored thereon a computer program, which when executed by a processor implements the thread information adjustment method of any one of claims 1 to 13; or to implement the thread information adjustment method of any one of claims 14 to 15 when executing the program.
CN202311516258.2A 2023-11-14 2023-11-14 Thread information adjustment method and device and electronic equipment Active CN117492958B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311516258.2A CN117492958B (en) 2023-11-14 2023-11-14 Thread information adjustment method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311516258.2A CN117492958B (en) 2023-11-14 2023-11-14 Thread information adjustment method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN117492958A CN117492958A (en) 2024-02-02
CN117492958B true CN117492958B (en) 2024-07-19

Family

ID=89681092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311516258.2A Active CN117492958B (en) 2023-11-14 2023-11-14 Thread information adjustment method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117492958B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111596936A (en) * 2020-05-12 2020-08-28 腾讯科技(深圳)有限公司 Application program updating method and device
US11314436B1 (en) * 2021-04-22 2022-04-26 Dell Products, L.P. Method and apparatus for dynamically adjusting differentiated share prioritization in a storage system
WO2023051233A1 (en) * 2021-09-30 2023-04-06 华为技术有限公司 Task scheduling method, device, apparatus and medium
CN117873658A (en) * 2023-12-11 2024-04-12 上海睿赛德电子科技有限公司 Method for adjusting APP thread priority in embedded system

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2934744B1 (en) * 2008-07-30 2010-08-13 Radiotelephone Sfr MULTIMODE TERMINAL WITH OPTIMIZED CONNECTIONS
US8904399B2 (en) * 2010-03-15 2014-12-02 Qualcomm Incorporated System and method of executing threads at a processor
US20120005457A1 (en) * 2010-07-01 2012-01-05 International Business Machines Corporation Using software-controlled smt priority to optimize data prefetch with assist thread
CN104899050B (en) * 2014-03-04 2018-12-18 广州猎豹网络科技有限公司 The method, apparatus and electronic equipment of application program are installed in the terminal
US20160378455A1 (en) * 2015-06-29 2016-12-29 Facebook, Inc. Methods and Systems for Installing an Application Version via Close-Range Communications
KR102052999B1 (en) * 2018-01-11 2019-12-06 한림대학교 산학협력단 Method and system for user priority decision in wireless body sensor network
CN108563494B (en) * 2018-04-04 2021-09-21 吉林省星途科技有限公司 Thread scheduling system and method with adaptive dynamic adjustment
CN116089098A (en) * 2021-11-05 2023-05-09 大唐移动通信设备有限公司 Thread endless loop detection method, device and apparatus
US12052748B2 (en) * 2021-11-12 2024-07-30 Qualcomm Incorporated Logical channel prioritization enhancements for jitter sensitive traffic
CN115934276A (en) * 2022-11-30 2023-04-07 维沃移动通信有限公司 Memory management method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111596936A (en) * 2020-05-12 2020-08-28 腾讯科技(深圳)有限公司 Application program updating method and device
US11314436B1 (en) * 2021-04-22 2022-04-26 Dell Products, L.P. Method and apparatus for dynamically adjusting differentiated share prioritization in a storage system
WO2023051233A1 (en) * 2021-09-30 2023-04-06 华为技术有限公司 Task scheduling method, device, apparatus and medium
CN117873658A (en) * 2023-12-11 2024-04-12 上海睿赛德电子科技有限公司 Method for adjusting APP thread priority in embedded system

Also Published As

Publication number Publication date
CN117492958A (en) 2024-02-02

Similar Documents

Publication Publication Date Title
US20180373523A1 (en) Application update method and apparatus
CN110597531B (en) Distributed module upgrading method and device and storage medium
JP6363796B2 (en) Dynamic code deployment and versioning
KR101571880B1 (en) Virtualized electronic apparatus virtual machine store and method for using virtual machine service
JP6316978B2 (en) Broadcast management information using fountain codes
US20060026429A1 (en) Method and system for setting up hosting environments in safety
KR20130027158A (en) Apparatus and method for management of optimized virtualization module in embedded system
JP5486611B2 (en) Parallel task application framework
JP2016515745A (en) Methods and devices for updating clients
US8640150B2 (en) Information processing terminal, information processing method, and program product
US11861357B2 (en) Selecting and sending subset of components to computing device prior to operating system install
EP3163489A1 (en) Token-based control of software installation and operation
US9208320B2 (en) Software distribution system and software distribution method
CN113330419A (en) Equipment application installation method and device
CN110493644B (en) Television application upgrading method, television terminal and server
CN115629820A (en) System secure starting method, chip system, storage medium and electronic equipment
CN105786636A (en) System repairing method and device
CN117492958B (en) Thread information adjustment method and device and electronic equipment
CN112199099B (en) Application updating method, device, server and storage medium
CN114006815B (en) Automatic deployment method and device for cloud platform nodes, nodes and storage medium
CN107688479B (en) Android system network cluster, construction method thereof, and Android system network cluster data processing method and system
CN114327574A (en) Differential upgrading method, electronic device and storage medium
CN116017403A (en) LPA automatic compiling method, system and medium for eSIM equipment
CN112882733B (en) Application updating method and device, electronic equipment and storage medium
JP4063573B2 (en) Device driver installation / execution method, installation / execution method, and program

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
GR01 Patent grant
GR01 Patent grant