Applications for mobile devices such as smart phones are becoming more and more complex and resource demanding. This is due to the rapid growth of multimedia data processing, gaming, 3D graphics modeling, and context-aware computation on mobile devices. Users want more and more functionality in their applications (“apps”), but such apps run on mobile devices that may have limited performance and limited battery power (before recharging is needed).
For a detailed description of various examples, reference will now be made to the accompanying drawings in which:
Certain terms are used throughout the following description and claims to refer to particular system components. As one skilled in the art will appreciate, different companies may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following discussion and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to . . . .” Also, the term “couple” or “couples” is intended to mean either an indirect or direct wired or wireless connection. Thus, if a first device couples to a second device, that connection may be through a direct connection or through an indirect connection via other devices and connections.
The mobile device 100 may store one or more applications (“apps”) 110 for use by a user of the mobile device 100. The apps may perform any of a variety of functions. Apps 110 may be implemented in a variety of programming language. In one implementation an app 110 is implemented in the Java programming language.
Each app 110 may comprise one or more modules. In the example of
For each software module hat executable on either the mobile device 100 or on the computing device 150, the mobile device 100 determines on which device that particular software module should be executed. This determination is made independently for each software module, so that one software module may be executed on the mobile device 100 while another software module may be executed on the computing device 150. In general, all software modules may be determined to be best executed on the mobile device, or all software modules may be determined to execute on the computing device 150. Further still, the determination may result in a mix of software module execution on both the mobile device 100 and the computing device 150.
Determining on which device to have a particular module executed is referred to as “offloading” the module. Any suitable technique for determining how to offload the software modules may be employed. In one example, the offloading decision is made based, on considerations of execution speed and power consumption. For a particular module of an app to be executed on the mobile device, the mobile device will consume power (e.g., battery power) to execute that module, and it will take the mobile device a certain amount of time to execute the module. On the other hand, the computing device could execute the same module and, in that case, the mobile device would not have to consume power to execute the module but would have to expend power to communicate with the computing device 150 (e.g., to send and receive wireless communications on its local wireless LAN or with respect to a base station). Further, the time to execute the module on the computing device 150 would also include the time required to transmit a request and data from the mobile device 100 to the computing device 150 and the time to receive any responses back to the mobile device from the computing device. In accordance with an implementation, the mobile device considers both power expenditure and speed issues to determine whether to offload a given module for execution on the computing device 150.
Equation (1) below compares the speed of executing the module on the mobile device versus the speed of executing the module on the computing device:
where tm is the computation time of the offloading candidate module on the mobile device (i.e., the amount of time it would take for the mobile device to execute the module), sm and ss are the computation speed of the candidate module on the mobile device and the computing device, respectively, d is the data transfer overhead (e.g., the quantity of data to be transferred between mobile device and computing device), and B is the bandwidth of the communication link between the mobile device and the computing device. The left-hand side of equation (1) above computes the amount of time the module will take to execute if offloaded to the computing device 150 plus the amount of time for data transfer between mobile device 100 and computing device 150. The right-hand side of equation (1) is the computation time of the module on the mobile device 100. The two computation times can be compared to determine on which device (mobile device 100 or computing device 150) the module would execute most expeditiously considering also the time required for data transmissions between the devices if the module were offloaded.
Equation (2) below analyzes the power consumption effects on the mobile device based on whether the mobile device or the computing device execute the module.
where Pw(B) represents the power consumption of the mobile device in transmitting and receiving data (e.g., via its wireless local area network or wireless communications with a base station), Pm is the power consumption of the mobile device. The power consumption may be a function of bandwidth—higher bandwidth communications generally result in higher power consumption of the mobile device. The left-hand side of equation (2) computes the energy expended by the mobile device 100 in exchanging data d with the computing device 150 if the module were offloaded to the computing device. In that case, the mobile device would only be required to send data to and receive data from the computing device and not expend energy in executing the module itself. The right-hand side of equation (2) computes the energy expended by the computing device in executing the module at a power consumption level of Pm for time tm.
Referring back to
The data required by equations (1) and (2) above are provided by the runt-time profiler 162 and the network profile 164 to the offload planner 160 which computes equations (1) and (2). In one example, the offload planner 160 makes a determination to offload the module if both the equalities in equations (1) and (2) favor execution on the computing device 150. That is, offloading to the computing device 150 may occur if:
it would be faster to execute the module on the computing device than on the computing device taking the data transfer time into account, and
power consumption on the mobile device would be less if the module were offloaded than if the module were executed on the mobile device
The following discussion assumes that a decision to offload a software module to the computing device 150 has indeed been made. In the example of
While executing thread R′ on the computing device 150 (e.g., while executing a module of an app that has been offloaded to the computing device), the thread R′ may need to access a hardware resource 180 on the mobile device 100. The hardware resource may include, for example, one or more hardware devices of the mobile device 100 such as a speaker, a display, a microphone, and a button. The display may be a non-touch or a touch sensitive display. The button may be a physical button provided on the display and/or may be a soft button implemented on the display itself (in the case in which the display is a touch-sensitive display). As described below, the thread R′ may access the hardware resource 180 using the JNI bridge 154 and JNI proxy 156 on the computing device 150, as well as the JNI proxy 170, JNI bridge 172 and native code 174 on the mobile device 100. The native code 174 on the computing device 100 may be implemented in a language other than the programming language of the app, which itself may be Java. Thus, the native code may not be Java code. The native code 174 may function to access the hardware resource 180 on the mobile device 100.
Referring still to
The JNI bridge 154 cross-references the JNI native code specified in the JNI call to the particular device—mobile device 100 or computing device 150. If the native code requested in the JNI call is located in the mobile device 100 (as determined by the JNI bridge 154), the JNI bridge 154 provides the JNI call to the JNI proxy 156 on the computing device to forward the JNI call to the JNI proxy 170 on the mobile device 100 to thereby cause the native code 174 on the mobile device to be accessed. The JNI proxies 156 and 170 may be pass-through logic elements which pass through a received JNI call. That is, the JNI proxies 156, 170 may not otherwise process the JNI calls.
The JNI bridge 172 on the mobile device 100 receives the JNI call from the JNI proxy 170. The JNI bridge 172 may have a data structure 173 such as a look-up table as well that cross-references native code specified in the JNI calls to their exact location (e.g., by address) in storage on the mobile device 100.
If the native code 174 generates a response, the response may be provided to the JNI proxy 170 which forwards the response to the JNI proxy 156 on the computing device. Thus, any response messages or data may be received by the JNI proxy on the computing device and provided back to the thread R′.
If, however, the JNI bridge 154 on the computing device 150 determines that that native code specified by the JNI call 153 is resident on the computing device 150 and not on the mobile device 100, the JNI bridge 154 on the computing device does not provide the JNI call to the JNI proxy 156 and, instead causes the native code 158 resident on the computing device 150 to be executed. The native code 158 on the computing device 150 may perform tasks other than accessing a hardware resource 180 on the mobile device 100.
The non-transitory storage device 210 may store machine instructions executable by the processor 200 of the respective mobile device 100 and computing device 150. The machine instructions may be executed to implement a JNI proxy 212, a JNI bridge 214 and native code 216. On the mobile device 100, the JNI proxy 212, a JNI bridge 214 and native code 216 correspond, respectively, to the JNI proxy 170, a JNI bridge 172 and native code 174. On the computing device 150, the JNI proxy 212, a JNI bridge 214 and native code 216 correspond, respectively, to the JNI proxy 156, a JNI bridge 154 and native code 158.
Using the example architecture of
Using the example architecture of
At 220, the method includes determining, for example, by the computing device 150 (using, for example, the JNI bridge 154) and based on a JNI call for native code, whether the native code associated with the JNI call is resident on the computing device 150 or on the mobile device 100. At 222, if the native code is resident on the computing device 150, the method includes executing the native code by the computing device. However, if the native code is resident on the mobile device 100, the method includes at 224 providing the JNI call to a JNI proxy 156 on the computing device 150 and at 226 forwarding, by the JNI proxy 156 on the computing device, the JNI call to the JNI proxy 170 on the mobile device. At 230, the native code is then executed on the mobile device 100.
At 220, the method includes determining, for example, by the computing device 150 and based on a JNI call for native code, whether the native code associated with the JNI call is resident on the computing device 150 or on the mobile device 100. At 222, if the native code is resident on the computing device 150, the method includes executing the native code by the computing device. However, if the native code is resident on the mobile device 100, the method includes at 224 providing the JNI call to a JNI proxy 156 on the computing device 150 and at 226 forwarding, by the JNI proxy 156 on the computing device, the JNI call to the JNI proxy 170 on the mobile device. At 228, the method includes providing the JNI call from the JNI proxy 170 of the mobile device 100 to the mobile device's JNI bridge 172. At 230, the native code is executed on the mobile device 100. At 232, the method includes the native code on the mobile device generating a response which is provided (at 234) to the computing device through the JNI proxy 170 on the mobile device 100 to the JNI proxy 156 on the computing device 150.
The above discussion is meant to be illustrative of the principles and various examples of the present subject matter. Numerous variations and modifications will become apparent to those skilled in the art once the above disclosure is fully appreciated. It is intended that the following claims be interpreted to embrace all such variations and modifications.
| Filing Document | Filing Date | Country | Kind |
|---|---|---|---|
| PCT/CN2014/090066 | 10/31/2014 | WO | 00 |