Disclosure of Invention
The present invention aims to provide a method, a system and a storage medium for controlling CPU expansion based on a mobile terminal, aiming at expanding the number of CPU cores of a first mobile terminal and increasing the computing power and processing speed of the first mobile terminal by accessing a plurality of application layers to the first mobile terminal in use.
The technical scheme adopted by the invention for solving the technical problem is as follows:
a method for controlling CPU extension based on a mobile terminal comprises the following steps:
the first mobile terminal set as an active terminal is in communication connection with the second mobile terminal set as a passive terminal in a wired or wireless mode;
setting any core CPU in the active terminal and the passive terminal as a scheduling CPU in advance to perform instruction scheduling, wherein the active terminal sends an instruction for starting the CPU to expand an active driving component to the passive terminal;
and after the passive terminal receives and executes the instruction for starting the CPU expansion active driving component, finishing the CPU expansion passive mode, and accessing the active terminal into a plurality of virtual application layer CPUs expanded by the passive terminal.
The method for controlling the CPU extension based on the mobile terminal is characterized in that the first mobile terminal and the second mobile terminal have the same CPU architecture and are both 4-core CPUs.
The CPU extension control method based on the mobile terminal is characterized in that the wired mode comprises USB connection, and the wireless mode comprises WLAN connection or Bluetooth connection.
The method for controlling the CPU expansion based on the mobile terminal, wherein the first mobile terminal set as the active terminal and the second mobile terminal set as the passive terminal are in communication connection in a wired or wireless mode, comprises the following steps:
setting a first mobile terminal and a second mobile terminal with the same CPU architecture as an active terminal and a passive terminal respectively in advance; the active terminal is used for expanding a CPU kernel, and the passive terminal is used for providing a virtual CPU kernel;
and the active terminal and the passive terminal are in communication connection in a wired or wireless mode.
The method for controlling the CPU extension based on the mobile terminal comprises the following steps that any core CPU in the active terminal and the passive terminal is set as a scheduling CPU in advance to perform instruction scheduling, and the active terminal sends a CPU extension active driving component starting instruction to the passive terminal:
setting any core CPU of 4-core CPUs in the active terminal as an active scheduling CPU in advance, and setting any core CPU of 4-core CPUs in the passive terminal as a passive scheduling CPU;
the active terminal sends a command for starting a CPU to expand an active driving component to the passive terminal through the active scheduling CPU;
and the passive terminal receives the instruction of starting the CPU to expand the active driving component through the passive scheduling CPU.
The method for controlling the CPU extension based on the mobile terminal is characterized in that after the passive terminal receives and executes the instruction for starting the CPU extension active driving component, the CPU extension passive mode is completed, and the active terminal is accessed into a plurality of virtual application layer CPUs extended by the passive terminal, and the method comprises the following steps:
after the passive terminal receives the instruction of starting the CPU expansion active driving component through the passive scheduling CPU, executing the instruction of starting the CPU expansion active driving component;
the passive terminal reserves a kernel driver-level Linux core component, closes an Android system, completes a CPU extension passive mode and virtualizes 3 application layer CPUs;
and when the passive terminal completes the CPU extension passive mode, the active terminal accesses 3 virtual application layer CPUs extended by the passive terminal to complete the CPU extension active mode and control the active terminal to be switched to 6-core CPUs.
The method for controlling the CPU extension based on the mobile terminal, wherein after the passive terminal receives and executes the instruction for starting the CPU extension active driving component, the CPU extension passive mode is completed, and after the active terminal accesses a plurality of virtual application layer CPUs extended by the passive terminal, the method further comprises the following steps:
when the active terminal needs to recover a normal operation mode, the active terminal sends a disengagement instruction to the passive scheduling CPU of the passive terminal through the active scheduling CPU;
and the passive terminal transfers the codes which are distributed to the virtual application layer CPU to work back to the CPU of the active terminal, so that the separation operation of the active terminal and the passive terminal is completed.
According to the method for controlling the CPU expansion based on the mobile terminal, after the active terminal and the passive terminal finish the separation operation, the active terminal clears the virtual application layer CPU, and in the existing process, the local CPU takes over the position of the virtual application layer CPU to continue to operate the system.
A mobile terminal-based CPU extension control system, wherein the system comprises:
the mobile terminal comprises a first mobile terminal and a second mobile terminal, wherein the first mobile terminal is set as an active terminal;
the second mobile terminal is set as a passive terminal;
the active terminal is used for being in communication connection with the passive terminal in a wired or wireless mode;
the active terminal sends a command for starting a CPU to expand an active driving component to the passive terminal;
the passive terminal receives and executes the instruction for starting the CPU expansion active driving component, and then completes the CPU expansion passive mode;
and the active terminal is accessed to a plurality of virtual application layer CPUs extended by the passive terminal.
A storage medium, wherein the storage medium stores a mobile terminal control based CPU extension program, which is executed by a processor to implement the mobile terminal control based CPU extension method.
The invention provides a method, a system and a storage medium for controlling CPU expansion based on a mobile terminal, wherein a first mobile terminal set as an active terminal is in communication connection with a second mobile terminal set as a passive terminal in a wired or wireless mode; setting any core CPU in the active terminal and the passive terminal as a scheduling CPU in advance to perform instruction scheduling, wherein the active terminal sends an instruction for starting the CPU to expand an active driving component to the passive terminal; and after the passive terminal receives and executes the instruction for starting the CPU expansion active driving component, finishing the CPU expansion passive mode, and accessing the active terminal into a plurality of virtual application layer CPUs expanded by the passive terminal. The CPU of the idle second mobile terminal is accessed to the first mobile terminal in use by virtualizing a plurality of application layers, so that the number of CPU kernels of the first mobile terminal is expanded, and the computing capacity and the processing speed of the first mobile terminal are increased.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Example one
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for controlling CPU expansion based on a mobile terminal according to a first preferred embodiment of the present invention. As shown in fig. 1, a method for controlling CPU expansion based on a mobile terminal includes the following steps:
step S100, a first mobile terminal set as an active terminal and a second mobile terminal set as a passive terminal are in communication connection in a wired or wireless mode.
In the embodiment of the present invention, the first mobile terminal and the second mobile terminal have the same CPU architecture, and the present invention is preferably a 4-core CPU (of course, the first mobile terminal and the second mobile terminal may also be 2, 6, or 8 cores); the wired mode comprises USB connection, the wireless mode comprises WLAN connection or Bluetooth connection, and the connection mode can be other effective connection modes.
Specifically, step S100 specifically includes the following steps:
s101, a first mobile terminal and a second mobile terminal with the same CPU architecture are set as an active terminal and a passive terminal respectively in advance; the active terminal is used for expanding a CPU kernel, and the passive terminal is used for providing a virtual CPU kernel;
and S102, the active terminal and the passive terminal are in communication connection in a wired or wireless mode.
Step S200, any core CPU in the active terminal and the passive terminal is set as a scheduling CPU in advance to perform instruction scheduling, and the active terminal sends an instruction for starting the CPU to expand the active driving component to the passive terminal.
In the embodiment of the invention, 1 CPU is stripped as a scheduling unit for an active terminal, and the active scheduling unit is specially responsible for monitoring communication information from a CPU extension drive passive mode in a connection mode opposite terminal and for assembling a cross-terminal instruction set and scheduling a virtual CPU. And (3) stripping 1 CPU as a scheduling unit for the passive terminal, wherein the passive scheduling unit is specially responsible for monitoring communication information from a CPU extension driving active mode in a connection mode opposite terminal and for scheduling the CPU from the active mode to be converted into local.
When the running and processing capacity of the CPU of the active terminal needs to be improved, the number of the CPU kernels of the active terminal needs to be increased, and then the active terminal can send a command for starting the CPU to expand the active driving component to the passive terminal to control the passive terminal to run the virtual CPU.
Specifically, step S200 specifically includes the following steps:
s201, setting any core CPU of 4-core CPUs in the active terminal as an active scheduling CPU in advance, and setting any core CPU of 4-core CPUs in the passive terminal as a passive scheduling CPU;
s202, the active terminal sends a command for starting a CPU to expand an active driving component to the passive terminal through the active scheduling CPU;
s203, the passive terminal receives the instruction of starting the CPU to expand the active driving component through the passive scheduling CPU.
Step S300, after the passive terminal receives and executes the instruction for starting the CPU to expand the active driving component, the CPU expansion passive mode is completed, and the active terminal is accessed to a plurality of virtual application layer CPUs expanded by the passive terminal.
In the embodiment of the invention, the passive terminal executes the instruction for starting the CPU expansion active drive component, reserves a kernel drive level Linux core component, closes an Android system, completes a CPU expansion passive mode, virtualizes 3 application layer CPUs, accesses the 3 virtual application layer CPUs expanded by the passive terminal, completes a CPU expansion active mode, and controls the active terminal to be switched to a 6-core CPU, so that processes running in an application layer of the active terminal can have an arithmetic capability equal to 6 cores, and can be expanded to 8 cores (without a scheduling unit) at most, but the performance may not be as high as that of 6 cores (virtual) in the last step.
That is, specifically, step S300 includes the steps of:
s301, after the passive terminal receives the CPU expansion active driving component starting instruction through the passive scheduling CPU, executing the CPU expansion active driving component starting instruction;
s302, the passive terminal reserves a kernel driver-level Linux core component, closes an Android system, completes a CPU extension passive mode and virtualizes 3 application layer CPUs;
and S303, after the passive terminal completes the CPU extension passive mode, the active terminal accesses 3 virtual application layer CPUs extended by the passive terminal to complete the CPU extension active mode, and controls the active terminal to be switched to a 6-core CPU.
Further, after the passive terminal receives and executes the instruction for starting the CPU to expand the active driving component, the method completes the CPU expansion passive mode, and after the active terminal accesses the plurality of virtual application layer CPUs expanded by the passive terminal, the method further includes: when the active terminal needs to recover a normal operation mode, the active terminal sends a disengagement instruction to the passive scheduling CPU of the passive terminal through the active scheduling CPU; and the passive terminal transfers the codes which are distributed to the virtual application layer CPU to work back to the CPU of the active terminal, so that the separation operation of the active terminal and the passive terminal is completed.
Because a part of tasks on the active terminal may be distributed to the virtual CPU to work, if the user needs to break away according to the actual situation, the user should inform the active terminal first, so that the active terminal initiates the process of breaking away, and the passive terminal transfers the codes distributed to the virtual CPU to the original CPU of the active terminal (i.e. ensuring that no code to be executed is hung on the virtual CPU), and then the codes can be broken away; rather than directly by disconnecting the active and passive terminals.
In addition, after the active terminal and the passive terminal finish the separation operation, the active terminal clears the virtual application layer CPU, and in the existing process, the local CPU takes over the position of the virtual application layer CPU to continue operating the system.
Example two
An embodiment of the present invention further provides a system for controlling CPU expansion based on a mobile terminal, as shown in fig. 2, the system includes:
a first mobile terminal 10, the first mobile terminal 10 being configured as an active terminal;
a second mobile terminal 20, the second mobile terminal 20 being configured as a passive terminal;
the active terminal is used for being in communication connection with the passive terminal in a wired or wireless mode; the active terminal sends a command for starting a CPU to expand an active driving component to the passive terminal; the passive terminal receives and executes the instruction for starting the CPU expansion active driving component, and then completes the CPU expansion passive mode; and the active terminal is accessed to a plurality of virtual application layer CPUs extended by the passive terminal.
EXAMPLE III
A storage medium, wherein the storage medium stores a mobile terminal control based CPU extension program, which is executed by a processor to implement the mobile terminal control based CPU extension method.
In summary, the present invention discloses a method, a system and a storage medium for controlling CPU expansion based on a mobile terminal, wherein a first mobile terminal configured as an active terminal and a second mobile terminal configured as a passive terminal are in communication connection in a wired or wireless manner; setting any core CPU in the active terminal and the passive terminal as a scheduling CPU in advance to perform instruction scheduling, wherein the active terminal sends an instruction for starting the CPU to expand an active driving component to the passive terminal; and after the passive terminal receives and executes the instruction for starting the CPU expansion active driving component, finishing the CPU expansion passive mode, and accessing the active terminal into a plurality of virtual application layer CPUs expanded by the passive terminal. The CPU of the idle second mobile terminal is accessed to the first mobile terminal in use by virtualizing a plurality of application layers, so that the number of CPU kernels of the first mobile terminal is expanded, and the computing capacity and the processing speed of the first mobile terminal are increased.
Of course, it can be understood by those skilled in the art that all or part of the processes in the method of the above embodiments can be implemented by instructing relevant hardware (such as a processor, a controller, etc.) based on the mobile terminal control CPU extension program, where the program can be stored in a computer readable storage medium, and the program can include the processes of the above method embodiments when executed. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.