Automatic Optimizer Generation Method Based on Location and Context Information to Improve Mobile Services

Several location-based services (LBSs) have been recently developed for smartphones. Among these are proactive LBSs, which provide services to smartphone users by periodically collecting background logs. However, because they consume considerable battery power, they are not widely used for various LBS-based services. Battery consumption, in particular, is a significant issue on account of the characteristics of mobile systems. This problem involves a greater service restriction when performing complex operations. Therefore, to successfully enable various services based on location, this problem must be solved. In this paper, we introduce a technique to automatically generate a customized service optimizer for each application, service type, and platform using location and situation information. By using the proposed technique, energy and computing resources can bemore efficiently employed for each service. Thus, users should receive more effective LBSs on mobile devices, such as smartphones.


Introduction
Recently, several location-based services (LBSs) have been developed for smartphones.Of these, proactive LBSs provide services to smartphone users based on periodically collected background logs.However, since these services consume considerable battery power, it is difficult to widely use them for various LBSs on account of the characteristics of mobile devices with constrained batteries.Therefore, to successfully provide various services based on localization, the problem of overcoming the limited resources of mobile devices must be solved.
In addition, mobile devices have various platforms and require different development approaches depending on the platform.The smart cross-platform is a virtual machinebased solution that can run the same content on various smart devices.If the smart cross-platform is used to provide LBSs, it is not necessary to perform separate development for each platform.However, because the smart cross-platform has a virtual machine-(VM-) based execution environment, the performance of a program running in a VM is lower than that of a general native-code base.
In this paper, we introduce a technique to automatically generate a customized optimizer for each application, service type, and platform using location and situation information.By using the proposed technique, energy and computing resources can be more efficiently employed for each service.Thus, users can receive more effective LBSs on mobile devices, such as smartphones.
The remainder of this paper is organized as follows.In Section 2, we examine context-based optimization, characteristics of the existing smart cross-platform, the smart VM, and existing optimization techniques.Section 3 describes the code optimizer generator proposed in this paper.In Section 4, we demonstrate the performance of the optimizer.Finally, in Section 5, we present our conclusions.

Context-Based Optimization Algorithms.
To optimize energy consumption in LBSs, Ben Abdesslem et al. [1] proposed SensLess.This algorithm uses an accelerometer to detect motion and stasis, thereby deactivating localization.Therefore, energy consumed by unnecessary localization is reduced.Nevertheless, the accelerometer must be operated at all times.Zhuang et al. [2] proposed sensor substitution and sensor suppression techniques to reduce energy consumption.The sensor substitution dynamically selects the localization method according to the automatically defined M-area whenever Global Positioning System coordinates are not available.In addition, sensor suppression technology requires continuous monitoring of the sensor, such as SensLess, by disabling localization using an accelerometer and a digital compass.Kim et al. [3] proposed the SenLoc algorithm.It prevents unnecessary energy consumption by more accurately detecting movement of a device with a threeaxis accelerometer instead of simple movement.However, it can only be used in a stable Wi-Fi environment.
On the other hand, in the LBS, it is important to use a cloud to apply key personal information in accordance with each service.Therefore, effective retrieval of encrypted data is very important.Meanwhile, Fu et al. [4] proposed an effective technique for synonym-based multikeyword ranked searching over encrypted cloud data.

Virtual Machine Execution and Native Execution Method.
In terms of content execution, a difference exists between the VM execution method and the native execution method.First, since the VM execution method has hardwareindependent characteristics, it is easy to execute contents even if the hardware is changed.Moreover, contents can be easily transplanted to various hardware platforms.In addition, even if there is an error in the content, the target system can be continuously operated.On the other hand, owing to the software execution limitation, the performance of complex algorithms is poorer than those of native methods.

Smart Cross-Platform and SVM. Smart Virtual Machine
(SVM) [5,6] is a stack-based VM solution that can be loaded on a smart device to download and run dynamic applications on a platform-independent basis.SVM is designed to use the Smart Intermediate Language (SIL), an intermediate language that can accommodate both sequential and objectoriented languages.It has the advantage of being able to accommodate C/C++ and Java languages, as well as the Objective C language used by the iOS mobile operating system.
Figure 1 shows the overall system configuration of SVM with the smart cross-platform.
SVM and the smart cross-platform system consist of three parts: a compiler that compiles an application to generate a Standard Archive Format-(SAF-) formatted file consisting of SIL code, an assembler that converts the SAF file into an executable format, and a VM that receives and executes files in Smart Executable Format (SEF) format [7].The smart cross-platform system is designed to be hierarchical and to minimize the burden on repurposing processes for other devices and operating environments.The SIL file from the compiler/translation process is converted into the SEF format through the assembler; SVM accepts the SEF as input and executes the program.

Location/Context Information-Based Automatic Optimization Model
In this paper, we introduce a technology that provides optimal execution performance by customizing various LBSs on mobile devices.The customized LBS optimization technology for mobile devices generates a pattern for each LBS using the application, context, and location information.It then optimizes the VM configuration and the application code to enable the corresponding service to be optimally executed.
Figure 2 shows the LBS execution model using the proposed technique.
The service model for each mobile device using LBS is shown in Figure 3.This section introduces the service  optimizer generator (SOG) and the VM configuration for a suitable LBS algorithm on the target service with the deterministic finite automata-(DFA-) based optimization table for generating context-and application-level code optimization.The SOG proposed in this paper generates a DFA that recognizes a user-defined pattern.The optimizer optimizes the input code using it.On account of the decisive automata, the optimizer can rapidly process the input code.

Service Optimizer Generator System
Model.The service optimizer generator consists of a scanner, parser, gathered information, calculated  0 , the created DFA, and a write table.The scanner is the first procedure of the compiler.It creates tokens, which are syntactically significant minimum units.In other words, it receives a pattern description as an input and generates a series of tokens [8,9].The parser receives the token output from the scanner, checks for errors, and creates sentences according to the program syntax to generate an abstract syntax tree (AST).The information-gathering stage involves collecting information of optimal localization methods, as well as context/application-level optimization information, to comprise the pattern description content.The content is traversed into a tree structure through the scanner and parser.The data structure is a two-dimensional layout with an integrated linked list.It is converted into a data structure wherein the pattern information and look-ahead assertion are integrated to calculate the  0 .The stage of "making" the DFA turns the calculated  0 into a DFA format.
The DFA normalization process involves repetitions of "Calculating  0 " and "Making DFA" stages.Since the resultant DFA is normalized, optimization actions are easily performed.In other words, the DFA-type backtracking task is not necessary.Figure 4 shows the model of the code optimizer generation model using the DFA table from SOG.
To distinguish the instruction code sets, the replace parts, pattern parts, and pattern descriptions are described with the separator "&." Accordingly, the instruction code sets of the pattern part are described.The instruction code sets are described with instructions, parameters, and the separator "/."In addition, the localization algorithm type can be SensLess, SenLoc, Zhuang's localization algorithm, and so forth.These have been demonstrated in related studies [2][3][4].4 shows the structure of the code optimizer using the DFA optimization table, as shown in Box 2. The structure is generated from SOG through an optimization pattern description created with application, location, and context information.The code optimizer consists of five modules: a DFA optimization table, driving routine, code reader, code writer, and an instruction list.

Code Optimizer Using DFA Optimization
First, when the user creates a pattern by employing the pattern specification grammar introduced in Box 1, the SOG generates a DFA-based optimization table corresponding to the pattern.
The DFA table consists of respective state and instruction sets for the code.The program input by the optimizer attempts to match with optimization instruction pattern using the instruction read by the predefined driving routine and the information recorded in the DFA optimization table.The code input unit analyzes the instruction of the inputted SAF code and converts it into a list of instructions comprised of a double connected list.In the instruction list, the optimized code table and instruction partial substitution matched by the driving routine are replaced with optimization instructions.It thus generates an optimized SAF code.
Box 3 presents part of the DFA optimization table generated by SOG.As shown in the source code of the generated DFA table in Box 3, the next states to transit according to the input instruction are recorded for each target state.
Table 1 outlines data of the SIL code converted through the implemented optimizer.The input programs are a hash algorithm and tower of Hanoi algorithm source.The data show that the operator, parameter abbreviation, and control instruction for referencing the array variable were changed to the optimized SIL instruction.
The results of comparing the pattern matching performance with the string-pattern matching and tree-pattern  matching-based optimizer showed the same pattern as the DFA-based optimizer generated through SOG.Since the generated code optimizer performed pattern matching based on DFA, the input program could be rapidly analyzed by converting the SIL code optimization pattern into a deterministic finite automata.Furthermore, the search time was decreased by 18% and 6%, respectively, compared with the conventional stringpattern matching and tree-pattern matching [10][11][12].Additionally, because the DFA table was generated using the SOG, an optimizer for performing the optimization code pattern matching according to the pattern definition could be automatically generated.

Conclusions
In this paper, we proposed a method to generate an automatic optimizer from user-defined pattern information based on location and context information.It can effectively support LBS and improve the performance of smart cross-platform VMs.Because the pattern is represented by DFA, it shows faster optimization performance compared to existing stringpattern matching and tree-pattern matching.This makes it easy to modify or add the pattern information of the optimizer.
Moreover, the optimizer is automatically generated by the SOG; therefore, a separate optimizer correction due to the pattern change does not occur.In this study, we used DFA for fast pattern matching, which means that the expression level of the pattern had a limit that could not extend beyond the regular language.To solve this problem, we defined an area for describing a separate evaluation method in the optimization pattern.
In this paper, we introduced a technique for automatically generating a customized optimizer for each application, service type, and platform using location and context information.The proposed technique can more efficiently use more energy and computing resources for each service.Thus, users can obtain more effective LBSs on mobile devices, such as smartphones.
Our future studies will be based on the optimization pattern of the peephole level, which was limited in this study.In addition, the pattern technique that can apply the data flow will be expanded and developed.Using these studies, we will apply higher-level optimization techniques to a novel optimizer.

Figure 1 :
Figure 1: System model of smart cross-platform.

Figure 3 :
Figure 3: Configuration of the service optimizer generator.

Table .
Figure