A Probabilistic Approach to Consistency Checking for ... - CiteSeerX

10 downloads 22962 Views 199KB Size Report
2Department of Computer Science and Technology. Nanjing University, Nanjing China ... users are often willing to accept certain degree of ... cost. Keywords pervasive computing, context-aware, context consistency, consistency constraints,.
A Probabilistic Approach to Consistency Checking for Pervasive Context Yu Huang1,2, Xiang Ma2, Xianping Tao1,2, Jiannong Cao3, Jian Lu1,2 1 State Key Laboratory for Novel Software Technology Nanjing University, Nanjing China 2 Department of Computer Science and Technology Nanjing University, Nanjing China {yuhuang,txp,lj}@nju.edu.cn [email protected] 3 Internet and Mobile Computing Lab, Department of Computing Hong Kong Polytechnic University, Hong Kong China [email protected] Abstract Context-awareness is a key issue in pervasive computing. Context-aware applications are prone to the context consistency problem, where applications are confronted with conflicting contexts and cannot decide how to adapt themselves. In pervasive computing environments, users are often willing to accept certain degree of context inconsistency, as long as it can reduce the consistency maintenance cost, e.g., query delay and battery power. However, existing consistency maintenance schemes do not enable the users to make such tradeoffs. To this end, we propose the Probabilistic Consistency Checking for Pervasive Context (PCCPC) algorithm. Detailed performance analysis shows that PCCPC enables the users to check consistency over arbitrarily specified ratio of context. We also conduct experiments to study the cost reduced by probabilistic checking. The analytical and the experimental results show that PCCPC enables the users to efficiently make tradeoffs between context consistency and the associated checking cost. Keywords pervasive computing, context-aware, context consistency, consistency constraints, probabilistic consistency checking

1. Introduction The widespread adoption of portable devices has the potential to support truly pervasive computing [13]. Pervasive computing applications often need to be context-aware, using various kinds of context, such as location, time, etc., to adapt to the evolving environment [3, 5]. For example, a student may use his smart phone to register online for the courses at the beginning of a semester. The application may adaptively recommend courses according to the student’s major, grade and the courses he studied before. To provide context-aware services, applications need to be able to correctly understand their environments. This poses a natural requirement on consistent context [1,14, 15], which delivers the expectation of unambiguously perceiving surrounding environments, such that applications can correctly offer services. The context of a computation task refers to any information that characterizes a situation related to the interaction between humans, applications, and the surrounding environment [3]. Context consistency is maintained when there is no contradiction in the context of a computation task [14,15]. Otherwise, context inconsistency occurs. In pervasive computing environments, applications are often confronted with inconsistent context, mainly because: z Devices for context collection often have

limited accuracy, which leads to the intrinsic inaccuracy of context. z Context may quickly become obsolete, since the pervasive computing environment is quite dynamic. Moreover, contexts are often geographically distributed and wireless communications are prone to failures, which may prevent contexts from being timely updated. z Pervasive computing applications often adopt context reasoning schemes, which may lead to contradicting context. The context consistency problem occurs in many context-aware systems, where applications are confronted with conflicting context and cannot decide how to adapt themselves [3,4,9,12]. We argue that users may be willing to accept certain degree of context inconsistency in many pervasive computing scenarios, due to the following observations: z It is often infeasible or too expensive to definitely guarantee strong data consistency in pervasive computing environments [2, 11]. z Users may be willing to sacrifice certain degree of data consistency, in order to reduce the associated maintenance cost [7,11]. However, existing consistency maintenance schemes do not enable the users to make tradeoffs between context consistency and the consistency maintenance cost [1,14,15]. To this end, we propose the Probabilistic Consistency Checking for Pervasive Context (PCCPC) algorithm. PCCPC checks consistency over a random portion of all the contexts. Detailed performance analysis enables PCCPC to check consistency over arbitrarily specified portion of context, thus enabling the users to precisely sacrifice certain degree of context consistency. Experiments are also conducted to study the relationship between the consistency sacrificed and the cost reduced. Based on both theoretical analysis and experimental evaluation, we show that PCCPC enables the users to flexibly make tradeoffs between context consistency and the associated checking cost. The rest of this paper is organized as follows. Section 2 provides an overview of the existing work. Section 3 presents design and analysis of PCCPC, and Section 4 presents the experimental

evaluation. In Section 5, we conclude the paper with a summary and the future work.

2. Related Work Checking of context consistency is more complicated than that of cache consistency [6,7,8]. Cache consistency only cares whether data objects are the same, while context consistency focuses on whether the user-specified semantic constraints are satisfied [14,15]. The context consistency problem occurs in many context-aware systems, such as Aura [4], Context Toolkit [3], Gaia [12] and EgoSpace [9]. In the seminal work on context consistency maintenance of Xu et al., context and consistency constraints are modeled by tuples. Consistency checking is based on matching of elements in the tuples. In [1], Bu et al. proposed an ontologybased scheme for context consistency maintenance. An incremental consistency checking schemes is proposed in [15], in which consistency constraints are modeled by first order logic. Incremental checking is triggered whenever existing context is deleted or new context is added. The existing schemes discussed above cannot enable the users to make tradeoffs between context consistency and the associated cost. The cost-effectiveness of such schemes can still be improved, especially when the users may be willing to accept certain degree of context inconsistency in pervasive computing scenarios.

3. Probabilistic Consistency Checking for Pervasive Context In this section, we present the Probabilistic Consistency Checking for Pervasive Context (PCCPC) algorithm. We fist describe how context consistency constraints are represented. Then we present the design of PCCPC. Analysis on how PCCPC can be configured to check consistency constraints over specified portion of context is presented at the end of this section. 3.1. Consistency Constraint Representation PCCPC adopts first order logic (FOL) to represent context consistency constraints, as proposed in [10, 15]. Specifically, a consistency

constraint is a FOL formula, which can be recursively defined as follows: formula ::= ∀ var ∈ cpattern( formula ) | ∃ var ∈ cpattern ( formula ) | ( formula ) ∧ ( formula ) | ( formula ) ∨ ( formula ) | ( formula) → ( formula) | ¬( formula) bfunction(var,..., var) Representation of consistency constraints by FOL allows any context modeling. It only requires the context model to provide the abstraction of context instance and context pattern, in order to conduct the “ ∀ ” and “ ∃ ” operations. Specifically, a context instance is a piece of context information, while a context pattern is a collection context instances with certain common features. Boolean function bfunction() is defined over context instances, and returns true or false. Take the constraint “there does not exist a course which has enrolled more than 75 students” as an example. It can be represented as: ¬∃c ∈ pat1 ( stu _ num(c)) . Here, context pattern pat1 contains information of each course, and binary function stu_num(c) returns true if course c has more than 75 students. FOL can represent most context consistency constraints in pervasive computing applications. Please refer to [15, 16, 10] for more examples. To facilitate consistency checking, the consistency constraints can be converted to a consistency computation tree (CCT) as follows. All Boolean functions are converted to leaf nodes, while other operators are converted to internal nodes. The “ ∀ ” and “ ∃ ” operators have one child node for each instance in the associated context pattern. For example, the CCT of the constraint ¬∃c ∈ pat1 ( stu _ num(c)) mentioned above is shown in Fig 1.

¬ ∃c ∈ pat1 C1

stu _ num(C1 )

C2 stu _ num(C2 )

Cn

...

stu _ num(Cn )

Fig 1. CCT of the constraint “there does not exist a course which has enrolled more than 75 students” A more detailed example of consistency rules and the corresponding CCT can be found in Section 4.1. 3.2. Probabilistic Consistency Checking By transforming the consistency constraints in FOL to the CCT, we can conduct deterministic checking of context consistency based on postorder traversal of the CCT. Probabilistic consistency checking differs from deterministic consistency checking in how the child nodes of the “ ∀ ” and “ ∃ ” operators are visited. In deterministic checking, the “ ∀ ” and “ ∃ ” operators are conducted on all context instances in one context pattern, while PCCPC checks each context instance in the pattern uniformly at random, with user-specified probability p. Child nodes of other operators are definitely visited. Thus, by sampling the context instances instead of definitely checking all of them, PCCPC reduces the checking cost, at the cost of sacrificing certain context consistency. Pseudo code of PCCPC is listed below: Algorithm PCCPC (I) Color every CCTNode white; (II) return DFS(root) bool DFS(CCTNode u) (1) IF (u is a leaf node) (1.1) Instantiate the binary function by context instances along the path from the leaf node to the root and calculate the return value; (1.2) IF(return value = FALSE) report inconsistent context instances identified; (1.3) Return value of the binary function; (2) u.color := gray; (3) FOR (each child node v and v.color = white)

(3.1) IF(u.operation = “ ∀ ” or “ ∃ ”) DFS(v) with probability p; (3.2) ELSE DFS(v) (4) u.color=black; (5) Return the value calculated based on the operation associated with node u and the returned values of child nodes;

Thus, the minimum value of p which makes PCCPC satisfies the user-specified ratio p0 is the root of function:

f ( p) =

∑p

lv ( w )

w∈LN ( CCT )

∑1

− p 0 = 0 (1)

w∈LN ( CCT )

3.3. Analysis Using PCCPC, the users need to flexibly and precisely specify the ratio of context which should be checked. This means that users need to specify the ratio p0 of leaf nodes in the CCT which should be covered by the consistency checking. By precisely specify the ratio p0, users sacrifice certain degree of context consistency to reduce the checking cost. In this section, we derive how the probability p of the PCCPC algorithm should be configured, given the user-specified consistency requirement p0. According to the design of PCCPC, the probability that a leaf node w is visited is plevel(w). Here, level(w) is defined as the number of “ ∀ ” or “ ∃ ” operators along the path from w to the root of CCT. Let LN(CCT) denote the set of leaf nodes in CCT. For user-specified probability p, the expected ratio of leaf nodes visited is:

∑p ∑1

lv ( w )

w∈LN ( CCT )

,

w∈LN ( CCT )

which should be no less than the user specified value p0 , 0 ≤ p0 ≤ 1. We define:

f ( p) =

∑p

lv ( w )

w∈LN ( CCT )

∑1

− p0 .

w∈LN ( CCT )

Thus, the consistency requirement is

∑p ∑1

lv ( w )

f ( p) =

w∈LN ( CCT )

− p0 ≥ 0 .

w∈LN ( CCT )

Since the cost for consistency checking decreases as the value of p decreases. We need to calculate the minimum p which satisfies the consistency requirement. Note that for 0 ≤ p ≤ 1: f ( p ) < 0, f (1) > 0, f ' ( p ) > 0 1. 1

The path from a leaf node to the root may not contain

Given p0, the equation can be easily solved by binary searching the value p which makes f(p) approach zero. Function f(p) can be easily obtained by checking the “ ∀ ” or “ ∃ ” operators in the consistency constraint. Thus, given the consistency constraints and consistency requirements p0, users can easily obtain Equation (1) and the value p which makes PCCPC check the consistency constraints over arbitrarily specified ratio p0 of context instances. In the following section, we further investigate the cost reduced by sacrificing certain degree of context consistency by experiments.

4. Experimental Evaluation In this section, we evaluate PCCPC by experiments. We first describe the experiment methodology. Then we discuss the evaluation results. 4.1. Experiment Methodology The experiments are designed and configured based on the scenario, where all sophomore students majoring in computer science register for the courses of the coming semester. Context pattern pat1 contains the information of each course available, and pat2 contains the information of each student. The total number of students is 150. There are 20 courses of three types: 6 compulsory courses, 4 optional courses in computer science and 10 optional courses in other majors. The application can provide smart course registration services, being aware of its context, i.e., information of the courses and the students. The course registration application sets the

the “ ∀ ” or “ ∃ ” operators, i.e., such nodes will be definitely visited. We prune such leaf nodes in the analysis and focuses on leaf nodes which will be probabilistically visited by PCCPC.

following consistency constraints to ensure that it can correctly adapt itself in different context: 1. The student can register for a course only when he has studied the pre-requisite course. 2. Each student has at least one optional course in other majors. 3. For any optional course, the maximum number of students is 75. 4. The student must obtain no less than 12 credits in one semester. According to Section 3.1, the consistency constraints are represented in FOL as follows: 1. ∀s ∈ pat 2 (∀c ∈ pat1 (crs _ req( s, c))) 2. 3.

∀s ∈ pat2 S1

∧ Rule 1

Rule 2

Rule 3

Rule 4

Fig. 2. CCT of four consistency constraints

...

∀c ∈ pat1

crs _ rep

...

crs _ rep

∀c ∈ pat1

...

crs _ rep

crs _ rep

Fig. 3. CCT of Constraint 1. ∀s ∈ pat2 S1

∀s ∈ pat 2 (∃c ∈ pat1 (non _ mjr ( s, c))) ¬∃c ∈ pat1 ( stu _ num(c)) ¬∃s ∈ pat 2 (credit ( s ))

4. All the binary functions associated are: z crs_req(s ∈ pat2, c ∈ pat1): return true if student s has studied the pre-requisite course(s) of course s, otherwise return false. z non_mjr(s ∈ pat2, c ∈ pat1): return true if student s has studied course c and c is a nonmajor course, otherwise return false. z stu_num(c ∈ pat1): return true if the number of students who has registered for course c is less than 75, otherwise return false. z credit(s ∈ pat2): return true if student s has registered sufficient courses to obtain 12 credits for one semester, otherwise return false. The CCT of all the constraints in our scenario is listed in Fig. 2~5.

Sn

Sn

...

∃c ∈ pat1

non _ mjr

...

non _ mjr

∃c ∈ pat1

non _ mjr

...

non _ mjr

Fig. 4. CCT of Constraint 2.

¬

¬

∃c ∈ pat1

∃s ∈ pat 2

C1

stu _ num

Cn

...

stu _ num

Sn

S1

credit

...

credit

Fig. 5. CCT of Constraint 3 & 4 In the first experiment, we evaluate our theoretical analysis on PCCPC. We calculate the ratio of leaf nodes covered by PCCPC by both Equation (1) and by experiments. Then we compare the results. In the second experiment, we study ratio of inconsistent context instances detected by PCCPC and the associated checking cost. The following performance metrics are used in the evaluation: z Checking ratio: ratio of inconsistent context instances identified by PCCPC to the total number of inconsistent context instances. z Cost ratio: ratio of traversal cost of PCCPC to that of deterministic traversal of CCT. 4.2. Consistency Checking over User-specified Ratio of Context In this experiment, we reduce parameter p of PCCPC from 100% to 60% and obtain the ratio of

leaf nodes covered, from both theoretical analysis and experiments, as shown in Table 1. The evaluation results show that our theoretical analysis on the ratio of leaf node coverage is quite accurate. This enables the users to arbitrarily specify the ratio of leaf nodes covered in advance and flexibly trade context consistency for reduced checking cost. Table 1. Ratio of leaf nodes covered by both analysis (Ana) and experiments (Exp) p (%) 100 96 92 88 84 80 76 72 68 64 60

Ana (%) 100 92.30 84.89 77.86 71.05 64.48 58.31 52.84 46.86 41.70 36.73

Exp (%) 100 92.25 84.82 77.70 70.89 64.39 58.20 52.33 46.77 41.52 36.59

4.3. Cost of Probabilistic Checking In this experiment, we decrease the parameter p in PCCPC from 100% to 60%, and study the context consistency sacrificed (checking ratio) and the cost reduced (cost ratio). We find that when p is close to 100%, the checking ratio is also very close to the cost ratio, as shown in Fig. 6. This means that the portion of cost saved is quite close to the inconsistency introduced in probabilistic checking. We also find that when p decreases, the difference between the checking ratio and the cost ratio increases. This means that when the value of p is less (around 60%~80%), more checking cost can be saved. This shows that as long as the users can accept the inconsistency introduced, parameter p should be reduced to save the checking cost.

Fig. 6. Cost of probabilistic checking

5. Conclusion and Future Work In this paper, we study the problem of context consistency checking in pervasive computing environments. The contributions of this paper are three fold: (1) we proposed the Probabilistic Consistency Checking for Pervasive Context algorithm; (2) we show how to configure PCCPC to cover user-specified ratio of context by theoretical analysis; (3) we conduct extensive experiments and demonstrates the costeffectiveness of the proposed PCCPC algorithm. In our future work, we will study decentralized context consistency checking in pervasive computing environments. We will also study how to resolve inconsistent context instances identified by the checking algorithm.

Acknowledgements This work is supported by the National Natural Science Foundation of China(No. 60736015, 60721002) and the National High-Tech Research and Development 863 Program of China(No. 2007AA01Z178).

References [1] Y. Bu, J. Li, S. Chen, X. Tao and J. Lu, Context Consistency Management Using Ontology Based Model, in proc. of the 2nd International Workshop on Pervasive Information Management (PIM), in conjunction with the 10th International Conference on Extending Database Technology (EDBT), LNCS 4254, Springer, 2006. [2] P. Cao and C. Liu, Maintaining Strong Cache Consistency in the World Wide Web, IEEE Trans. On Computers, 47(4): 445-457, 1998. [3] A. K. Dey, D. Salber, and G. D. Abowd, A conceptual framework and a toolkit for supporting the rapid prototyping of context-aware applications, Human-Computer Interaction, vol. 16, pp. 97-166, 2001. [4] D. Garlan, D. Siewiorek, A. Smailagic and P. Steenkiste, Project Aura: Toward Distraction-Free Pervasive Computing, IEEE Pervasive Computing, V.1, Issue 2, pp.22-31, Apr. 2002. [5] K. Henricksen, J. Indulska, A Software Engineering Framework for Context-Aware Pervasive Computing, in proc. of the 2nd Annual IEEE Intl. Conf. on

Pervasive Computing and Communications (PerCom), 2004. [6] Y. Huang, J. Cao and B. Jin, A Predictive Approach to Achieving Consistency in Cooperative Caching in MANET, in Proc. of the 1st Intl. Conf. on Scalable Information Systems, P2PIM Workshop Session, ACM Press, New York, USA, 2006. [7] Y. Huang, J. Cao, Z. Wang, B. Jin and Y. Feng, Achieving Flexible Cache Consistency for Pervasive Internet Access, in proc. of the 5th Annual IEEE Intl. Conf. on Pervasive Computing and Communications (PerCom), pp.239-250, 2007. [8] Y. Huang, B. Jin, J. Cao, G. Sun and Y. Feng, A Selective Push Algorithm for Cooperative Cache Consistency Maintenance in MANETs, in proc. of the IFIP International Conference on Embedded and Ubiquitous Computing (EUC), LNCS 4808, Taiwan, China, Dec. 2007. [9] Christine Julien, Gruia-Catalin Roman. Egocentric Context-Aware Programming in Ad Hoc Mobile Environments. In proc. of the 10th International Symposium on the Foundations of Software Engineering (FSE 2002), Charleston, USA, Nov 2002. [10] C. Nentwich, L. Capra, W. Emmerich, A. Finkelstein, xlinkit: A Consistency Checking and Smart Link Generation Service, ACM Trans. on Internet Technology, 2(2): pp.151-185, 2002. [11] J. Payton, C. Julien, G. Roman, Automatic Consistency Assessment for Query Results in Dynamic

Environments, in prof. of the the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineering (ESEC/FSE), 2007. [12] M. Roman, C. Hess, R. Cerqueira, A. Ranganathan, R. H. Campbell, K. Nahrstedt, A Middleware Infrastructure for Active Spaces, IEEE Pervasive Computing, vol. 1, no. 4, pp.74-83, 2002. [13] M. Weiser, The Computer for the 21st Century, Scientific American, 265(3),pp.94-104,1991. [14] C. Xu and S.C. Cheung, Inconsistency Detection and Resolution for Context-Aware Middleware Support, in proc. of the Joint 10th European Software Engineering Conference and 13th ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE), pp. 336-345, Lisbon, Portugal, Sep 2005. [15] C. Xu, S.C. Cheung and W.K. Chan, Incremental Consistency Checking for Pervasive Context, in Proc. of the 28th Intl. Conf. on Software Engineering(ICSE), 2006. [16] C. Xu and S.C. Cheung, Decentralized Constraint Checking for Pervasive Computing, in proc. of the 6th Annual IEEE International Conference on Pervasive Computing and Communications (Percom, PhD forum), pp. 45-48, Hong Kong, China, Mar 2008.