搜档网
当前位置:搜档网 › Querying composite events for reactivity on the Web

Querying composite events for reactivity on the Web

Querying Composite Events for Reactivity on

the Web

Fran?c ois Bry,Michael Eckert,and Paula-Lavinia P?a tr?a njan

University of Munich,Institute for Informatics

Oettingenstr.67,D-80538M¨u nchen

{bry,eckert,patranjan}@pms.ifi.lmu.de

http://www.pms.ifi.lmu.de

Abstract.Reactivity,the ability to detect events and respond to them

automatically through reactive programs,is a key requirement in many

present-day information systems.Work on Web Services re?ects the need

for support of reactivity on a higher abstraction level than just message

exchange by HTTP.This article presents the composite event query facil-

ities of the reactive rule-based programming language https://www.sodocs.net/doc/149562008.html,-

posite events are important in the dynamic world of the Web where

applications,or Web Services,that have not been engineered together

are composed and have to cooperate by exchanging event messages.

1Introduction

Reactivity,the ability to detect events or situations of interest and respond to them automatically through reactive programs,is a key requirement in many present-day information systems.The World Wide Web,undoubtedly by far the largest information system,has become a basis for many applications requir-ing reactivity,e.g.,in commerce,business-to-business,logistics,e-Learning,and information systems for biological data.

It is natural to represent events that are exchanged between Web sites as XML messages.The Web’s communication protocol,HTTP,provides an infras-tructure for exchanging events or messages.Still,until recently the Web has been commonly perceived as a passive collection of HTML and XML documents;re-activity had to be implemented largely“by hand”(e.g.,CGI scripts)and was limited to single Web sites(e.g.,?lling out forms on a shopping Web site). There is little support for reactivity on a higher abstraction level,e.g.,in the form of reactive programming languages.Research and standardization in the Web Services area re?ect the need to overcome what one might call the Web’s passiveness.

XChange[1–3]is a rule-based reactive language for programming reactive be-havior and distributed applications on the Web.Amongst other reactive behavior it aims at easing implementation and composition of Web Services.XChange is based on Event-Condition-Action rules(ECA rules).These specify that some action should be performed in response to some(class of)events(or situations of interest),provided that the condition holds.

2Bry,Eckert,and P?a tr?a njan

To specify situations that require a reaction,XChange provides event queries, which describe classes of events.But event queries do more:they also extract and make available data from the events’XML representation that is relevant for the particular reaction.Considering a tourism application,it is not only important to detect when a?ight has been canceled,but also to know its?ight number and similar information in the reaction to the event.

Often,the situations are not given by a single atomic event,but a temporal combination of events,leading to the notion of composite events and composite event queries.Support for composite events is very important for the Web:In a carefully developed application,designers have the freedom to choose events according to their goal.They can thus often do with only atomic events by representing events which might by conceptually composite with a single atomic event.In the Web’s open world however many di?erent applications which have not been engineered together are integrated and have to cooperate.Situations that require a reaction might not have been considered in the original design of the applications and thus have to be inferred from many atomic events.

Consider again a tourism scenario:an application might want to detect situ-ations where a traveler has already checked out of his hotel(?rst atomic event) but his?ight has been canceled(second atomic event).On the Web the con-stituent events are emitted from independent Web sites(the airline and the hotel),which have not designed together.Hence an application has to infer the composite event from the given atomic events.

Similar motivating scenarios for composite events are?ltering of stock trade reports,e.g.,“recognize situations where the NASDAQ rises10points and the Dow Jones falls5points”,or work-?ow-management,e.g.,“a student has ful?lled her degree-requirements if she has handed in her thesis and taken the?nal exams (which in turn can be a composite event).”

The remainder of this paper is structured as follows.We?rst give a short overview of XChange(Sect.2),and then explain the event query language in detail.We introduce the syntax and intuitive meaning of its language constructs (Sect.3),before turning to the formal semantics(Sect.4)and the event query evaluation(Sect.5).Conclusions(Sect.6)complete this article.

2XChange:ECA Rule-based Reactivity

XChange programs consist of ECA rules running locally at some Web site.In reaction to events,they can query and modify local and remote XML data and raise new events,which are sent as XML messages to other remote Web sites(in a push-manner).

XChange ECA rules have the general form Action–Event Query–Web Query.They specify to automatically execute the action(an update to a Web resource or rasing of a new event)as response to a situation speci?ed by the event query(a query over the stream of incoming event messages),provided the Web query(a query to persistent Web data)evaluates successfully.

Querying Composite Events for Reactivity on the Web3

UA917

2005-02-20 flight-cancellation[

number["UA917"]

date["2005-02-20"]

]

flight-cancellation{{

number[var N]

}}

Fig.1.An event message in XML and term representation,and an atomic event query Atomic event queries(queries to a single incoming event message)and Web queries rely on the query language Xcerpt[4].Also,update speci?cations are an extension to Xcerpt.Xcerpt queries describe patterns of the queried XML data and are represented in a term-like syntax.Fig.1depicts a small XML document, its term representation,and a query term against this data.In the term syntax, square brackets indicate that the order of child elements is signi?cant,while curly braces indicate it isn’t.Double braces or brackets indicate a partial match,i.e., other children may exists,while single braces or brackets indicate a total match, i.e.,no other children may exist.Queries can contain free variables(indicated by the keyword var)which are bound during the evaluation,which is based on a novel method called Simulation Uni?cation[5].

XChange can provide the following bene?ts over the conventional approach of using imperative programming languages to implement Web Services:

–ECA rules have a highly declarative nature,allow programming on a high level of abstraction,and are easy to analyze for both humans and machines (see[6],for example).

–Event queries,Web queries,and updates follow the same paradigm of speci-fying patterns for XML data,thus making XChange an elegant,easy to learn language.

–Both atomic and composite events can be detected,the latter being an im-portant requirement in composing an application from di?erent Web Services (cf.Sect.1)and relevant data extracted.

–Having an XML query language embedded in the condition part allows to access Web resources in a natural way.Also Xcerpt’s deductive rules allowing to reason with data and to query not only pure XML but also RDF[7].

–A typical reaction to some event is to update some Web resource;XChange provides an integrated XML update language for doing this.

–ECA rules of XChange enforce a clear separation of persistent data(Web resources with URIs)and volatile data(event messages,no URIs).The dis-tinction is important for a programmer:the former relates to state,while the latter re?ects changes in state.

3Event Queries and Composite Events

Event queries detect atomic events(receptions of single event messages)and composite events(temporal patterns in the reception of event messages)in the stream of incoming events and extract data in the form of variables bindings from them.

4Bry,Eckert,and P?a tr?a njan

3.1Atomic Events and Atomic Event Queries

Atomic events are received by XChange-aware Web sites as XML messages. Typically these messages will follow some standardized envelope format(e.g., SOAP format)providing information like the sender or the reception time of the message;in this paper we skip such details for the sake of brevity.

Atomic event queries are query terms(as introduced in the previous section). On reception of an incoming event message,XChange tries to simulation unify the query term and the message.If successful,this results in a set of substitutions for the free variables in the query.

3.2Composite Event Queries

Composite event queries are built from atomic(and smaller composite)event queries(EQ)by means of composition operators and temporal restrictions.They describe a pattern of events that have to happen in a some time https://www.sodocs.net/doc/149562008.html,posite events are sequences of atomic events that answer a given composite event query; they happen over a period of time and thus have a starting and ending time. Temporal Restrictions limit the time frame in which events are considered rel-evant.XChange supports absolute and relative temporal restrictions.Absolute restrictions are introduced by the keyword in and a time interval speci?ca-tion,e.g.,[1978-02-20..2005-02-20]following an(atomic or composite) event query.Answers to the event query are only considered if they happen in the speci?ed time interval.Relative restrictions are introduced by the keyword within and a speci?cation of a duration,e.g.,365days.They limit the duration (di?erence between starting and ending time)of answers to the event query.

XChange requires every(legal)composite event query to be accompanied by a temporal restriction speci?cation.This makes it possible to release each (atomic or semi-composed composite)event at each Web site after a?nite time. Thus,language design enforces the requirement of a bounded event lifespan and the clear distinction persistent vs.volatile data.

Composition Operators express a temporal pattern of atomic event occurrences. XChange provides a rich set of such composition operators,a selection of which is presented here.

Conjunctions of event queries detect instances for each speci?ed event query regardless of their order.They have the form:and{EQ1,...,EQ n}.

Inclusive Disjunctions of event queries detect instances of any of the speci?ed event queries.They have the form:or{EQ1,...,EQ n}.

Temporally Ordered Conjunctions of event queries detect successive instances of events:andthen[EQ1,...,EQ n]and andthen[[EQ1,...,EQ n]].

A total speci?cation(using[])expresses that only instances of the EQ i(i= 1,...,n)are of interest and are included in the answer.Instances of other events that possibly have occurred between the instances of the EQ i are not of interest and thus are not contained in the answer.In contrast,a partial speci?cation

Querying Composite Events for Reactivity on the Web5 (using[[]])expresses interest in all incoming events that have been received between the instances of the EQ i.Thus,all these instances are contained in the event query’s answer.

Example.The composite event query on the right side detects noti-?cations of?ight cancellations that are followed,within two hours of reception,by noti?cations that the airline is not granting accommoda-tion.Note the use of the variable P to make sure that the noti?cations apply to the same passenger.andthen[

flight-cancellation{{

number{var N},

passenger{var P} }},

no-accommodation{{

passenger{var P}, }}

]within2hours

Event Exclusions enable the monitoring of the non-occurrence of(atomic or composite)event query instances during an absolute time interval or the answer to another composite event query:without EQ during CompositeEQ or without EQ during[s..t].

Other operators include n times EQ to detect n occurrences of the same event,and m of{EQ1,...EQn}to detect occurrences of m instances in a given set of event queries.

4Semantics of Event Queries

Comparisons of(composite)event query languages such as[8]show that inter-pretation of similar language constructs can vary considerably.To avoid misin-terpretations,clear semantics are indispensable.

The notion of answers to event queries is twofold.An answer to some query consists of(1)a sequence s of atomic events that allowed a successful evaluation of the query on the one hand,and(2)a set of variable substitutionsΣon the other hand.Variable substitutions can in?uence the reaction to some event speci?ed in the remaining part of an XChange ECA rule.The sequence of events allows for events not being speci?ed in the query to become a part of the answer (e.g.,a partial andthen[[EQ1,EQ2]]returns not only answers to EQ1and EQ2but also any atomic events in-between)and gives answer closedness,i.e., the result of a query can be in turn queried by further queries.

We de?ne a declarative semantics for XChange’s event query language similar to a model-theoretic entailment relation.Unlike the traditional binary entailment relation|=,which relates models to queries(under some environment giving bind-ings for the free variables),however,our answering relation has to be ternary:it relates the stream of incoming event messages(which corresponds to a model), queries,and answers(as discussed above these include the“environment”Σ). The reason for the need of answers is that in our event query language answers cannot be simply obtained from queries by applying the variables substitutions to them,since they may contain events not having a corresponding constituent query.The answering relation is de?ned by induction on the structure of a query.

6Bry,Eckert,and P?a tr?a njan

This allows easy recursive evaluation of composite(event)queries,where each constituent query can be evaluated independently of the others.

We now give a formal account of the declarative semantics.

Answers An answer to an event query q is a tuple(s,Σ).It consists of a(?nite) sequence s of atomic events happening in a time interval[b..e]that allowed a successful evaluation of q and a corresponding set of substitutionsΣfor the

free variables of q.We write s= a1,...a n e

b to indicate that s begins at time

point begin(s):=b,ends at end(s):=e,and contains the atomic events a i=d r i i, which are data terms d i received at time point r i.We have b≤r1<...

Observe that the answer is an event sequence,and it is possible for instances of events not speci?ed in the query to be returned.For example,a partial match andthen[[a,b]]returns not only event instances of a and b,but also all atomic events happening between them.This cannot be captured with substitutions alone.

Substitution Sets The substitution setΣcontains substitutionsσ(partial func-tions)assigning variables to data terms.Assuming a standardisation of variable names,let V be the set of all free variables in a query having at least one de?n-ing occurrence.A variable’s occurrence is de?ning,if it is part of a non-negated sub-query,i.e.does not occur inside a without-construct,and thus can be as-signed a value in the query evaluation.LetΣ|V denote the restriction of all substitutionsσinΣto V.For triggering rules in XChange,we are interested only in the maximal substitution sets.

Event Stream For a given event query q,all atomic events received after its registration form a stream of incoming events(or,event stream)E.Events prior to a query’s registration are not considered,as this might require an unbounded event life-span.Thus,since it?ts better with the incremental event query eval-uation(described in the next section),we prefer the term“stream”to the term “history”sometimes used in related work.Formally,E is an event sequence(as s above)beginning at the query’s registration time.

Answering-Relation Semantics of event queries are de?ned as a ternary relation between event queries q,answers(s,Σ),and event stream E.We write q E(s,Σ) to indicate that q is answered by(s,Σ)under the event stream E.De?nition of E is by induction on q,and we give only a few exemplary cases here.

q is an atomic event query:

q E(s,Σ)i?there exist event sequences s1,...s n such that(1)q i E(s i,Σ)for all1≤i≤n,(2)s comprises all event sequences s1,...s n(denoted s= 1≤i≤n s i).

Querying Composite Events for Reactivity on the Web7 q=andthen[[q1,q2]]:

q E(s,Σ)i?(1)q2 E(s,Σ),(2)there is no answer(s1,Σ1)to q1(q1 E(s1,Σ1))such thatΣcontains substitutions for the variables V with de?ning occurrences that are also inΣ1(Σ|V?Σ1|V).

q=q within w:

8Bry,Eckert,and P?a tr?a njan

SetOfCompositeEvents evaluate(AndNode n,AtomicEvent a){

//receive events from child nodes

SetOfCompositeEvents newL:=evaluate(n.leftChild,a);

SetOfCompositeEvents newR:=evaluate(n.rightChild,a);

//compose composite events

SetOfCompositeEvents answers:=?;

foreach((s L,ΣL),(s R,ΣR))∈(newL×n.storageR)∪

(n.storageL×newR)∪

(newL×newR){

SubstitutionSetΣ:=ΣL ΣR;

if(Σ=?)answers:=answers∪new CompositeEvent(s L∪s R,Σ);

}

//update event storage

n.storageL:=n.storageL∪newL;

n.storageR:=n.storageR∪newR;

//forward composed events to parent node

return answers;

}

Fig.2.Implementation of a(binary)and inner node in pseudo-code

results to avoid recomputation when the next evaluation step is initiated by the next incoming event message.

Leaf nodes process an injected event message by trying to match it with their atomic event query(using Simulation Uni?cation).If successful,this results in a substitution setΣ=?,and the answer(s,Σ),where s is an event sequence containing only the one event message,is forwarded to the parent node.Inner nodes process events they receive from their children following the basic pattern: 1.attempt to compose composite events(s,Σ)(according to the operator the

inner node implements)from the stored and the newly received events, 2.update the event storage by adding newly received events that might be

needed in later evaluations,

3.forward the events composed in(1)to the parent node.

Fig.2sketches an implementation for the evaluation of a(binary)and in-ner node in java-like pseudo-code.Consider it in an example of evaluating the event query q=and{a{{var X}},b{{var X}}}within2h in Fig.3.(Keep in mind,Fig.2covers only the and-node;within is a separate node with a separate implementation)

In Fig.3,we now let event messages arrive at time points t=1,2,3.For simplicity,these are each one hour apart;this is of course not the normal case in practice and not an assumption made by the algorithm.

Fig.3(a)depicts receiving a{1,2}at time t=1.It does not match with the atomic event query b{{var X}}(right leaf in the tree).But it does match with the atomic event query a{{var X}}(left leaf)with substitution setΣ1and is propagated upwards in the tree as answer(s1,Σ1)to the parent node and (Fig.3(d)de?nes s i andΣi).The and-node cannot form a composite event from its input,yet,but it stores(s1,Σ1)for future evaluation steps.

At t=2we receive b{2,3}(Fig.3(b));it matches the right leaf node and (s2,Σ2)is propagated upwards.The and-node stores(s2,Σ2)and tries to form a

Querying Composite Events for Reactivity on the Web9

a{1,2} (a)t=1

b{2,3}

(b)t=2

a{3}

(c)t=3

s1= a{1,2} ,Σ1={{X→1},{X→2}};s2= b{2,3} ,Σ2={{X→2},{X→3}};

s3= a{1,2},b{2,3} ,Σ3={{X→2}};s4= a{3} ,Σ4={{X→3}};s5= b{2,3}a{4} ,Σ5={{X→3}}.

(d)De?nitions of s i andΣi

Fig.3.Incremental evaluation of an event query using bottom-up data?ow in a storage-augmented operator tree

composite event(s3,Σ3)from(s1,Σ1)and(s2,Σ2).To be able to compose the events they have to agree on the variables substitutions with a commonΣ3.This

can be computed as a(variant of a)natural join(⊥denotes unde?ned):Σ3=Σ1 Σ2={σ1∪σ2|σ1∈Σ1,σ2∈Σ2,?X.σ1(X)=σ2(X)∨σ1(X)=⊥∨σ2(X)=⊥}.Σ3now contains all substitutions that can be used simultaneously

in all atomic event queries in and’s subtree.Σ=?would signify that no such substitution exists and thus no composite event can be formed.In our case however there is exactly one substitution{X→2}and we propagate(s3,Σ3) to the within2h-node.This node checks that end(s3)?begin(s3)=1≤2and pushes(s3,Σ3)up(there is no need to store it).With this(s3,Σ3)reaches the top and we have our?rst answer to the event query q.

Fig.3(c)shows reception of another event message a{3}at t=3,which

results in another answer(s5,Σ5)to q.After the query evaluation at t=3, we can release(delete)the stored answer(s1,Σ1)from the operator tree:any composite event formed with use of(s1,Σ1)will not pass the within2h-node. Event deletion is performed by top-down traversal of the operator tree.Temporal restriction operator nodes put restrictions on begin(s)and end(s)for all answers (s,Σ)stored in their subtrees.In our example,all events(s,Σ)in the subtree of within2h must satisfy t?2≤begin(s),where t is the current time.

6Conclusions

This article has presented the event query facilities of the reactive rule-based language XChange.Event queries detect(composite)events in the stream of incoming event messages and extract data from them for use in the subsequent reaction.The event query language is tailored for the Web:Events are repre-sented as XML messages,so it is necessary to extract data from them with an

10Bry,Eckert,and P?a tr?a njan

XML query language.When composing Web Services or other reactive applica-tions in an ad-hoc manner,situations that require a reaction oftentimes are not given through a single atomic event,requiring support for composite events.

While composite event detection has been explored in the active database community,this work doesn’t consider or extract data contained in events.An important novelty in the XChange event query language are the free variables, which allow to“correlate”data from di?erent events during the composite event detection and to extract data in the form of variable bindings for use in the rest of a reactive rule.This work has de?ned declarative semantics for composite event queries in the presence of free variables.Existing approaches to composite event detection have been extended to incrementally evaluate such queries. Acknowledgments

This research has been funded by the European Commission and by the Swiss Federal O?ce for Education and Science within the6th Framework Programme project REWERSE number506779(https://www.sodocs.net/doc/149562008.html,).

References

1.Bry,F.,P?a tr?a njan,P.L.:Reactivity on the Web:Paradigms and applications of

the language XChange.In:Proc.20th ACM Symp.on Applied Computing.(2005) 2.Bailey,J.,Bry,F.,Eckert,M.,P?a tr?a njan,P.L.:Flavours of XChange,a rule-based

reactive language for the(Semantic)Web.In:Proc.Intl.Conf.on Rules and Rule Markup Languages for the Semantic Web.(2005)

3.P?a tr?a njan,P.L.:The Language XChange:A Declarative Approach to Reactivity

on the Web.PhD thesis,Institute for Informatics,University of Munich(2005) 4.Scha?ert,S.,Bry,F.:Querying the Web reconsidered:A practical introduction to

Xcerpt.In:Proc.Extreme Markup Languages.(2004)

5.Bry,F.,Scha?ert,S.:Towards a declarative query and transformation language

for XML and semistructured data:Simulation Uni?cation.In:Proc.Int.Conf.on Logic Programming.(2002)

6.Bailey,J.,Poulovassilis,A.,Wood,P.T.:Analysis and optimisation of event-

condition-action rules on https://www.sodocs.net/doc/149562008.html,puter Networks39(2002)

7.Berger,S.,Bry,F.,Bolzer,O.,Furche,T.,Scha?ert,S.,Wieser,C.:Querying

the standard and Semantic Web using Xcerpt and visXcerpt.In:Proc.European Semantic Web Conf.(2005)

8.Zimmer,D.,Unland,R.:On the semantics of complex events in active database

management systems.In:Proc.15th Int.Conf.on Data Engineering.(1999)

9.Scha?ert,S.:Xcerpt:A Rule-Based Query and Transformation Language for the

Web.PhD thesis,Institute for Informatics,University of Munich(2004)

10.Eckert,M.:Reactivity on the Web:Event queries and composite event detection in

XChange.Master’s thesis,Institute for Informatics,University of Munich(2005) 11.Forgy,C.L.:A fast algorithm for the many pattern/many object pattern match

problem.Arti?cial Intelligence19(1982)

12.Chakravarthy,S.,Krishnaprasad,V.,Anwar,E.,Kim,S.K.:Composite events for

active databases:Semantics,contexts and detection.In:Proc.20th Int.Conf.on Very Large Data Bases.(1994)

android系统开机启动流程分析

一,系统引导bootloader 加电,cpu执行bootloader程序,正常启动系统,加载boot.img【其中包含内核。还有ramdisk】 二,内核kernel bootloader加载kernel,kernel自解压,初始化,载入built-in驱动程序,完成启动。 内核启动后会创建若干内核线程,在后装入并执行程序/sbin/init/,载入init process,切换至用户空间(user-space) 内核zImage解压缩 head.S【这是ARM-Linux运行的第一个文件,这些代码是一个比较独立的代码包裹器。其作用就是解压Linux内核,并将PC指针跳到内核(vmlinux)的第一条指令】首先初始化自解压相关环境(内存等),调用decompress_kernel进行解压,解压后调用start_kernel启动内核【start_kernel是任何版本linux内核的通用初始化函数,它会初始化很多东西,输出linux版本信息,设置体系结构相关的环境,页表结构初始化,设置系 统自陷入口,初始化系统IRQ,初始化核心调度器等等】,最后调用rest_init【rest_init 会调用kernel_init启动init进程(缺省是/init)。然后执行schedule开始任务调度。这个init是由android的./system/core/init下的代码编译出来的,由此进入了android的代码】。 三,Init进程启动 【init是kernel启动的第一个进程,init启动以后,整个android系统就起来了】 init进程启动后,根据init.rc 和init. .rc脚本文件建立几个基本 服务(servicemanager zygote),然后担当property service 的功能 打开.rc文件,解析文件内容。【system/core/init/init.c】将service信息放置到service.list中【system/core/init/init_parser.c】。 建立service进程。【service_start(…) execve(…)】 在init.c中,完成以下工作 1、初始化log系统【解析/init.rc和init.%hardware%.rc文件,在两个 文件解析步骤2时执行“early-init”行动】 2、初始化设备【在/dev下创建所有设备节点,下载firmwares】 3、初始化属性服务器【在两个文件解析步骤2时执行“init”行动】

软件测试工程师笔试题及答案

测试工程师笔试题 一、计算机知识(30分) 1、在Linux系统中,一个文件的访问权限是755,其含义是什么 参考答案: 755表示该文件所有者对该文件具有读、写、执行权限,该文件所有者所在组用户及其他用户对该文件具有读和执行权限。 2、Linux中,如何从root用户切换到普通用户 参考答案:su su user1 切换到user1,但切换后的当前目录还是root访问的目录 su – user1 切换到user1,并且当前目录切换到user1的根目录下(/home/user1/) 3、简述一下C/S模式和B/S模式的区别 参考答案: c/s 是客户端/服务器架构 b/s 是浏览器/服务器架构 C/S模式有以下特点: S模式将应用与服务分离,系统具有稳定性和灵活性 S模式配备的是点对点的结构模式,适用于局域网,有可靠的安全性 3.由于客户端实现与服务器端的直接连接,没有中间环节,因此响应速度快 4.在C/S模式中,作为客户机的计算机都要安装客户机程序,一旦软件系统升级,每台客户机都要安装客户机程序,系统升级和维护较为复杂 B/S模式有以下特点: 1.系统开发、维护、升级方便 每当服务器应用程序升级时,只要在服务器上升级服务应用程序即可,用户计算机上的浏览器软件不需要修改,系统开发和升级维护方便 S模式具有很强的开放性 在B/S模式下,用户通过通用的浏览器进行访问,系统开放性好 S模式的结构易于扩展 由于Web的平台无关性,B/S模式的结构可以任意扩展,可以从包含一台服务器和几个用户的小型系统扩展成为拥有成千上万个用户的大型系统 4.用户使用方便 B/S模式的应用软件都是基于Web浏览器的,而Web浏览器的界面是类似的。对于无用户交换功能的页面。用户接触的界面都是一致的,用户使用方便 4、Windows操作系统中PATH环境变量的作用是什么 参考答案: PATH是Windows操作系统环境变量,PATH作用是用户在命令行窗口执行一个命令,则在PATH变量设置的目录下依次寻找该命令或对应的执行文件,若找到,则执行,若没有找到,则命令行窗口返回无效命令。 5、TCP和UDP有什么区别 参考答案: TCP-有连接,所以握手过程会消耗资源,过程为可靠连接,不会丢失数据,适合大数据量交换UDP-非可靠连接,会丢包,没有校验,速度快,无须握手过程

Android 开机启动流程

Android的开机流程 1. 系统引导bootloader 1) 源码:bootable/bootloader/* 2) 说明:加电后,CPU将先执行bootloader程序,此处有三种选择 a) 开机按Camera+Power启动到fastboot,即命令或SD卡烧写模式,不加载内核及文件系统,此处可以进行工厂模式的烧写 b) 开机按Home+Power启动到recovery模式,加载recovery.img,recovery.i mg包含内核,基本的文件系统,用于工程模式的烧写 c) 开机按Power,正常启动系统,加载boot.img,boot.img包含内核,基本文件系统,用于正常启动手机(以下只分析正常启动的情况) 2. 内核kernel 1) 源码:kernel/* 2) 说明:kernel由bootloader加载 3. 文件系统及应用init 1) 源码:system/core/init/* 2) 配置文件:system/rootdir/init.rc, 3) 说明:init是一个由内核启动的用户级进程,它按照init.rc中的设置执行:启动服务(这里的服务指linux底层服务,如adbd提供adb支持,vold提供SD卡挂载等),执行命令和按其中的配置语句执行相应功能 4. 重要的后台程序zygote 1)源码:frameworks/base/cmds/app_main.cpp等 2) 说明:zygote是一个在init.rc中被指定启动的服务,该服务对应的命令是/system/bin/app_process a)建立Java Runtime,建立虚拟机 b) 建立Socket接收ActivityManangerService的请求,用于Fork应用程序 c) 启动System Server 5. 系统服务system server 1)源码:frameworks/base/services/java/com/android/server/SystemServer.jav a 2) 说明:被zygote启动,通过SystemManager管理android的服务(这里的服务指frameworks/base/services下的服务,如卫星定位服务,剪切板服务等) 6. 桌面launcher 1)源码:ActivityManagerService.java为入口,packages/apps/launcher*实现 2) 说明:系统启动成功后SystemServer使用xxx.systemReady()通知各个服务,系统已经就绪,桌面程序Home就是在ActivityManagerService.systemReady()通知的过程中建立的,最终调用()启launcher 7. 解锁 1) 源码: frameworks/policies/base/phone/com/android/internal/policy/impl/*lock* 2) 说明:系统启动成功后SystemServer调用wm.systemReady()通知WindowManagerService,进而调用PhoneWindowManager,最终通过LockPatternKeyguardView显示解锁界面,跟踪代码可以看到解锁界面并不是一个Activity,这是只是向特定层上绘图,其代码了存放在特殊的位置

软件测试工程师笔试题目和答案

一、判断题 1.软件测试的目的是尽可能多的找出软件的缺陷。(Y) 2.Beta测试是验收测试的一种。(Y) 3.验收测试是由最终用户来实施的。(N) 4.项目立项前测试人员不需要提交任何工件。(Y) 5.单元测试能发现约80%的软件缺陷。(Y) 6.代码评审是检查源代码是否达到模块设计的要求。(N) 7.自底向上集成需要测试员编写驱动程序。(Y) 8.负载测试是验证要检验的系统的能力最高能达到什么程度。(N) 9.测试人员要坚持原则,缺陷未修复完坚决不予通过。(N) 10.代码评审员一般由测试员担任。(N) 11.我们可以人为的使得软件不存在配置问题。(N) 12.集成测试计划在需求分析阶段末提交。(N) 二、选择题 1.软件验收测试的合格通过准则是:(ABCD) A.软件需求分析说明书中定义的所有功能已全部实现,性能指标全部达到要求。B.所有测试项没有残余一级、二级和三级错误。 C.立项审批表、需求分析文档、设计文档和编码实现一致。 D.验收测试工件齐全。 2.软件测试计划评审会需要哪些人员参加?(ABCD) A.项目经理 B.SQA负责人

D.测试组 3.下列关于alpha测试的描述中正确的是:(AD) A.alpha测试需要用户代表参加 B.alpha测试不需要用户代表参加 C.alpha测试是系统测试的一种 D.alpha测试是验收测试的一种 4.测试设计员的职责有:(BC) A.制定测试计划 B.设计测试用例 C.设计测试过程、脚本 D.评估测试活动 5.软件实施活动的进入准则是:(ABC) A.需求工件已经被基线化 B.详细设计工件已经被基线化 C.构架工件已经被基线化 D.项目阶段成果已经被基线化 三、填空题 1.软件验收测试包括:正式验收测试,alpha测试,beta测试。 2.系统测试的策略有:功能测试,性能测试,可靠性测试,负载测试,易用性测试,强度测试,安全测试,配置测试,安装测试,卸载测试,文挡测试,故障恢复测试,界面测试,容量测试,兼容性测试,分布测试,可用性测试,(有的可以合在一起,分开写只要写出15就满分哦) 3.设计系统测试计划需要参考的项目文挡有:软件测试计划,软件需求工件和迭代计划。

分析Android 开机启动慢的原因

开机启动花了40多秒,正常开机只需要28秒就能开机起来。 内核的启动我没有去分析,另一个同事分析的。我主要是分析从SystemServer启来到开机动画结束显示解锁界面的这段时间,也就是开机动画的第三个动画开始到结束这段时间,这是个比较耗时阶段,一般都在17秒左右(见过牛B的手机,只需5秒)。 SystemServer分两步执行:init1和init2。init1主要是初始化native的服务,代码在sy stem_init.cpp的system_init,初始化了SurfaceFlinger和SensorService这两个native的服务。init2启动的是java的服务,比如ActivityManagerService、WindowManagerService、PackageManagerService等,在这个过程中PackageManagerService用的时间最长,因为PackageManagerService会去扫描特定目录下的jar包和apk文件。 在开机时间需要40多秒的时,从Log上可以看到,从SurfaceFlinger初始化到动画结束,要27秒左右的时间,即从SurfaceFlinger::init的LOGI("SurfaceFlinger is starting")这句Log到void SurfaceFlinger::bootFinished()的LOGI("Boot is finished (%ld ms)", long(ns 2ms(duration)) ),需要27秒左右的时间,这显然是太长了,但到底是慢在哪了呢?应该在个中间的点,二分一下,于是想到了以启动服务前后作为分隔:是服务启动慢了,还是在服务启动后的这段时间慢?以ActivityManagerService的Slog.i(TAG, "System now ready")的这句Log为分割点,对比了一下,在从SurfaceFlinger is starting到System now read y多了7秒左右的时间,这说明SystemServer在init1和init2过程中启动慢了,通过排查,发现在init1启动的时候,花了7秒多的时间,也就是system_init的LOGI("Entered system _init()")到LOGI("System server: starting Android runtime.\n")这段时间用了7秒多,而正常情况是400毫秒便可以初始化完,通过添加Log看到,在SensorService启动时,用了比较长的时间。 不断的添加Log发现,在启动SensorService时候,关闭设备文件变慢了,每次关闭一个/dev/input/下的设备文件需要100ms左右,而SensorService有60~70次的关闭文件,大概有7s左右的时间。 调用流程是: frameworks/base/cmds/system_server/library/system_init.cpp: system_init->SensorServi ce::instantiate frameworks/native/services/sensorservice/SensorService.cpp: void SensorService::onFi rstRef()->SensorDevice& dev(SensorDevice::getInstance()) hardware/libsensors/SensorDevice.cpp: SensorDevice::SensorDevice()->sensors_open hardware/libsensors/sensors.cpp: open_sensors->sensors_poll_context_t sensors_poll_context_t执行打开每个传感器设备时,遍历/dev/input/目录下的设备文件,以匹配当前需要打开的设备,遍历文件是在 hardware/libsensors/SensorBase.cpp的openInput下实现,如果打开的设备文件不是正在打开的设备文件,会执行下面语句的else部分: if (!strcmp(name, inputName)) { strcpy(input_name, filename); break;

基于MT6752的 android 系统启动流程分析报告

基于MT6752的Android系统启动流程分析报告 1、Bootloader引导 (2) 2、Linux内核启动 (23) 3、Android系统启动 (23) 报告人: 日期:2016.09.03

对于Android整个启动过程来说,基本可以划分成三个阶段:Bootloader引导、Linux kernel启动、Android启动。但根据芯片架构和平台的不同,在启动的Bootloader阶段会有所差异。 本文以MTK的MT6752平台为例,分析一下基于该平台的Android系统启动流程。 1、Bootloader引导 1.1、Bootloader基本介绍 BootLoader是在操作系统运行之前运行的一段程序,它可以将系统的软硬件环境带到一个合适状态,为运行操作系统做好准备,目的就是引导linux操作系统及Android框架(framework)。 它的主要功能包括设置处理器和内存的频率、调试信息端口、可引导的存储设备等等。在可执行环境创建好之后,接下来把software装载到内存并执行。除了装载software,一个外部工具也能和bootloader握手(handshake),可指示设备进入不同的操作模式,比如USB下载模式和META模式。就算没有外部工具的握手,通过外部任何组合或是客户自定义按键,bootloader也能够进入这些模式。 由于不同处理器芯片厂商对arm core的封装差异比较大,所以不同的arm处理器,对于上电引导都是由特定处理器芯片厂商自己开发的程序,这个上电引导程序通常比较简单,会初始化硬件,提供下载模式等,然后才会加载通常的bootloader。 下面是几个arm平台的bootloader方案: marvell(pxa935) : bootROM + OBM + BLOB informax(im9815) : bootROM + barbox + U-boot mediatek(mt6517) : bootROM + pre-loader + U-boot broadcom(bcm2157) : bootROM + boot1/boot2 + U-boot 而对MT6752平台,MTK对bootloader引导方案又进行了调整,它将bootloader分为以下两个部分: (1) 第1部分bootloader,是MTK内部(in-house)的pre-loader,这部分依赖平台。 (2) 第2部分bootloader,是LK(little kernel的缩写,作用同常见的u-boot差不多),这部分依赖操作系统,负责引导linux操作系统和Android框架。 1.2、bootloader的工作流程 1.2.1 bootloader正常的启动流程 先来看启动流程图:

[全]软件测试常见笔试题(附带答案)

软件测试常见笔试题(附带答案) 软件测试笔试题 一、选择题 1、对计算机软件和硬件资源进行管理和控制的软件是(D) A.文件管理程序 B.输入输出管理程序 C.命令出来程序 D.操作系统 2、在没有需求文档和产品说明书的情况下只有哪一种测试方法可以进行的(A) A.错误推测法测试 B.路劲分析测试 C.语句覆盖测试 D.条件覆盖测试 3、某测试人员通过执行测试软件测试的方法对当前功能进行了测试,该测试人员使用的测试方法为(C) A.静态测试

B.单元测试 C.黑盒测试 4、编写测试计划的目的是(ABC)多选题 A.使测试工作顺利进行 B.使项目参与人员沟通更舒畅 C.使测试工作更加系统化 D.软件工程以及软件过程的需要 E.软件过程规范化的要求 F.控制软件质量 5、关于软件测试与软件开发的认识,不正确的是(B) A.软件生命周期各个阶段都可能产生测试 B.软件测试是独立于软件开发的一个工作 C.软件开发的需求分析和设计阶段就应开始测试工作 D.测试越早进行,越有助于提高被测软件的质量 6、当一个应用程序窗口被最小化后该应用的程序将会出现一下哪种情况(D) A.被终止执行

B.继续在前台执行 C.被暂停执行 D.被转入后台执行 7、下列方法中,不属于黑盒测试的是?(A) A.基本路劲测试法 B.等价类测试法 C.边界值分析法 D.基于场景的测试方法 8、对于维护软件的人员来说,使用质量是【】的结果(C) A.功能性 B.可靠性 C.可维护性 D.效率 9、下列软件属性中,软件产品首要满足的应该是(A) A.功能需求 B.性能需求

C.可扩展性和灵活性 D.容错、纠错能力 10、单元测试中设计测试用例的依据是(D) A.概要设计规格说明书 B.用户需求规格说明书 C.项目计划说明书 D.详细设计规格说明书 二、判断题 1、单元测试通常应该先进行“人工走查”,再以白盒法为主,辅以黑盒法进行动态测试。(√) 2、软件测试就是为了验证软件功能实现的是否正确,是否完成既定目标的活动,所以软件测试在软件工程的后期才开始具体的工作(×) 3、发现错误多的模块,残留在模块中的错误也多。( √) 4、测试人员在测试过程中发现一处问题,如果问题影响不大,而自己又可以修改,应立即将此问题正确修改,以加快、提高开发的进程。(×) 5、单元测试通常应该先进行“人工走查”,再以白盒法为主,辅以黑盒法进行动态测试。

linux内核启动 Android系统启动过程详解

linux内核启动+Android系统启动过程详解 第一部分:汇编部分 Linux启动之 linux-rk3288-tchip/kernel/arch/arm/boot/compressed/ head.S分析这段代码是linux boot后执行的第一个程序,完成的主要工作是解压内核,然后跳转到相关执行地址。这部分代码在做驱动开发时不需要改动,但分析其执行流程对是理解android的第一步 开头有一段宏定义这是gnu arm汇编的宏定义。关于GUN 的汇编和其他编译器,在指令语法上有很大差别,具体可查询相关GUN汇编语法了解 另外此段代码必须不能包括重定位部分。因为这时一开始必须要立即运行的。所谓重定位,比如当编译时某个文件用到外部符号是用动态链接库的方式,那么该文件生成的目标文件将包含重定位信息,在加载时需要重定位该符号,否则执行时将因找不到地址而出错 #ifdef DEBUG//开始是调试用,主要是一些打印输出函数,不用关心 #if defined(CONFIG_DEBUG_ICEDCC)

……具体代码略 #endif 宏定义结束之后定义了一个段, .section ".start", #alloc, #execinstr 这个段的段名是 .start,#alloc表示Section contains allocated data, #execinstr表示Section contains executable instructions. 生成最终映像时,这段代码会放在最开头 .align start: .type start,#function /*.type指定start这个符号是函数类型*/ .rept 8 mov r0, r0 //将此命令重复8次,相当于nop,这里是为中断向量保存空间 .endr b 1f .word 0x016f2818 @ Magic numbers to help the loader

软件测试面试题与答案

软件测试面试题与答案尽供参考 一、判断题 1.软件测试的目的是尽可能多的找出软件的缺陷。(Y) 2.Beta测试是验收测试的一种。(Y) 3.验收测试是由最终用户来实施的。(N) 4.项目立项前测试人员不需要提交任何工件。(Y) 5.单元测试能发现约80%的软件缺陷。(Y) 6.代码评审是检查源代码是否达到模块设计的要求。(N) 7.自底向上集成需要测试员编写驱动程序。(Y) 8.负载测试是验证要检验的系统的能力最高能达到什么程度。(N) 9.测试人员要坚持原则,缺陷未修复完坚决不予通过。(N) 10.代码评审员一般由测试员担任。(N) 11.我们可以人为的使得软件不存在配置问题。(N) 12.集成测试计划在需求分析阶段末提交。(N) 二、选折 1.软件验收测试的合格通过准则是:(ABCD) A.软件需求分析说明书中定义的所有功能已全部实现,性能指标全部达到要求。B.所有测试项没有残余一级、二级和三级错误。 C.立项审批表、需求分析文档、设计文档和编码实现一致。 D.验收测试工件齐全。 2.软件测试计划评审会需要哪些人员参加?(ABCD) A.项目经理 B.SQA负责人 C.配置负责人 D.测试组 3.下列关于alpha测试的描述中正确的是:(AD) A.alpha测试需要用户代表参加 B.alpha测试不需要用户代表参加 C.alpha测试是系统测试的一种 D.alpha测试是验收测试的一种 4.测试设计员的职责有:(BC) A.制定测试计划

B.设计测试用例 C.设计测试过程、脚本 D.评估测试活动 5.软件实施活动的进入准则是:(ABC) A.需求工件已经被基线化 B.详细设计工件已经被基线化 C.构架工件已经被基线化 D.项目阶段成果已经被基线化 三、添空 1.软件验收测试包括:正式验收测试,alpha测试,beta测试。 2.系统测试的策略有:功能测试,性能测试,可靠性测试,负载测试,易用性测试,强度测试,安全测试,配置测试,安装测试,卸载测试,文挡测试,故障恢复测试,界面测试,容量测试,兼容性测试,分布测试,可用性测试,(有的可以合在一起,分开写只要写出15就满分哦) 3.设计系统测试计划需要参考的项目文挡有:软件测试计划,软件需求工件和迭代计划。 4.对面向过程的系统采用的集成策略有:自顶向下,自底向上两种。 5.(这题出的有问题哦,详细的5步骤为~~)通过画因果图来写测试用例的步骤为: (1)分析软件规格说明描述中,哪些是原因(即输入条件或输入条件的等价类),哪些是结果(即输出条件),并给每个原因和结果赋予一个标识符。 (2)分析软件规格说明描述中的语义,找出原因与结果之间,原因与原因之间对应的是什么关系?根据这些关系,画出因果图。 (3)由于语法或环境限制,有些原因与原因之间,原因与结果之间的组合情况不可能出现。为表明这些特殊情况,在因果图上用一些记号标明约束或限制条件。 (4)把因果图转换成判定表。 (5)把判定表的每一列拿出来作为依据,设计测试用例。 四、简答(资料是搜集整理的,感谢前辈的解题)无 1.区别阶段评审的与同行评审 同行评审目的:发现小规模工作产品的错误,只要是找错误; 阶段评审目的:评审模块阶段作品的正确性可行性及完整性 同行评审人数:3-7人人员必须经过同行评审会议的培训,由SQA指导 阶段评审人数:5人左右评审人必须是专家具有系统评审资格 同行评审内容:内容小一般文档< 40页,代码< 500行 阶段评审内容:内容多,主要看重点

Android开机启动流程样本

Android的开机流程 1. 系统引导bootloader 1) 源码: bootable/bootloader/* 2) 说明: 加电后, CPU将先执行bootloader程序, 此处有三种选择 a) 开机按Camera+Power启动到fastboot, 即命令或SD卡烧写模式, 不加载内核及文件系统, 此处能够进行工厂模式的烧写 b) 开机按Home+Power启动到recovery模式, 加载recovery.img, recovery.img包含内核, 基本的文件系统, 用于工程模式的烧写 c) 开机按Power, 正常启动系统, 加载boot.img, boot.img包含内核, 基本文件系统, 用于正常启动手机( 以下只分析正常启动的情况) 2. 内核kernel 1) 源码: kernel/* 2) 说明: kernel由bootloader加载 3. 文件系统及应用init 1) 源码: system/core/init/* 2) 配置文件: system/rootdir/init.rc, 3) 说明: init是一个由内核启动的用户级进程, 它按照init.rc中的设置执行: 启动服务( 这里的服务指linux底层服务, 如adbd提供adb支持, vold提供SD卡挂载等) , 执行命令和按其中的配置语句执行相应功能 4. 重要的后台程序zygote 1) 源码: frameworks/base/cmds/app_main.cpp等 2) 说明: zygote是一个在init.rc中被指定启动的服务, 该服务对应的命令是/system/bin/app_process

软件测试人员面试笔试题及答案

软件测试笔试试题 一、单选题 1.关于HTTP协议中状态码的表示,下列说法错误的是(A) A.1**:表示服务器错误 B.2**:表示请求成功地接收 C.3**:表示重定向 D.4**:表示客户端错误 2.在Linux中.要解包bugzilla.tar.gz并详细报告tar命令处理的文件名,应使用命令(A )A.tar –xvzf bugzilla.tar.gz B.tar –cvzf bugzilla.tar.gz C.tar –cvzf bugzilla.tar.gz D.tar –cxvf bugzilla.tar.gz 3.有如下C程序 #include void main() { int n; int s = 0; int t = 1; for( n = 1 ; n <= 20 ; n++) { _______ s += t; } printf(“%d\n”, s); } 若使该程序实现计算1!+ 2!…….+20!的功能,则在程序横线上应填语句(D ) A.n*=t B. n=n*(n-1) C. t=t*(n-1) D. t*=n; 4.有如下IP地址 (1)192.168.1.1 (2)10.10.0.0 (3)165.100.0.0 (4)202.255.0.255 则下列说法中正确的是(C ) A.(1)是C类地址可以直接出现在互联网上 B.(2)是A类地址,主机号为0.0,不可以直接出现在互联网上 C.(3)是B类地址,不可以直接出现在互联网上 D.(4)是D类地址,不可以直接出现在互联网上 5. 下列常用的测试用例设计技术中,不属于白盒测试技术的是(D ) A.信息流分析法 B.数据流分析法 C.逻辑覆盖测试和基本路径测试 D.状态图法

Android SystemBar启动流程分析

Android SystemBar启动流程分析 SystemBars的服务被start时,最终会调用该类的onNoService()方法。 @Override public void start() { if (DEBUG) Log.d(TAG, "start"); ServiceMonitor mServiceMonitor = new ServiceMonitor(TAG, DEBUG, mContext, Settings.Secure.BAR_SERVICE_COMPONENT, this); mServiceMonitor.start(); // will call onNoService if no remote service is found } @Override public void onNoService() { if (DEBUG) Log.d(TAG, "onNoService"); createStatusBarFromConfig(); // fallback to using an in-process implementation } private void createStatusBarFromConfig() { … mStatusBar = (BaseStatusBar) cls.newInstance(); … mStatusBar.start(); } BaseStatusBar是一个抽象类,故调用其子类的PhoneStatusBar的start 函数。 @Override public void start() { … super.start(); … } 子类的start又调用了父类的start public void start() { … createAndAddWindows(); … }

软件测试面试题答案

软件测试面试题答案 千锋老师掌握了大量的软件测试面试题答案,以下为比较典型的两个: 1、以windows对文件的复制粘帖功能为例,尽可能多地写出测试思路。 软件测试面试题答案: <1>基本功能测试:文件的复制粘贴功能,首先关键字“文件”,文件有不同的分类(图片、视频、音频、文档等),每个分类又有不同的类型(文档类型:txt doc execl pdf等),每个文件又有不同的大小,而且文件还有很多权限,是不是隐藏,是不是只是管理员可执行。选择不同分类的不同类型,不同大小的文件做测试资源。 比如:文档类型里面txt文件可以分为1.KB的txt文件、1MB的txt文件、

1GB的txt文件...... 下一个关键字复制粘贴复制有多种方式右击选择、Ctrl+C、拖动复制,对应粘贴也有各种方式。然后从哪复制,粘贴到哪,比如可以有本机硬盘、移动硬盘、优盘、内存卡、软盘、光盘、连接手机存储,复制到网络地址等等。 复制粘贴后文件是不是可用,文件权限是不是有变化。复制过去容量不够怎么处理?复制过后有重名文件怎么处理?复制过程中取消、关机、拔优盘怎么处理?复制过程能不能执行文件? <2>性能测试:复制粘贴功能性能怎么样?复制文件的速度可不可以接受?同时复制多个文件是不是可以完成?复制文件过程中占用CPU资源大不大,耗电量大不大? <3>兼容性测试:Windows7,Windows8,Windows8.1,Windows10等各种windows版本是不是都支持这个功能。 <4>交互测试:复制粘贴文件时,使用windows存储的其他功能是否有影响?比如播放本地的音频、视频、等同时复制文件是不是有影响。一边复制,一边粘贴是不是有影响。 2、已知String convert(String page)作用是将WEB页转码为方便移动设备查看的页面,为了确保转码的正确性,请设计相应测试策略。 软件测试面试题答案:

Android系统启动过程详解

Android系统启动过程详解 Android系统启动过程 首先Android框架架构图:(来自网上,我觉得这张图看起来很清晰) Linux内核启动之后就到Android Init进程,进而启动Android相关的服务和应用。 启动的过程如下图所示:(图片来自网上,后面有地址)

下面将从Android4.0源码中,和网络达人对此的总结中,对此过程加以学习了解和总结, 以下学习过程中代码片段中均有省略不完整,请参照源码。

一Init进程的启动 init进程,它是一个由内核启动的用户级进程。内核自行启动(已经被载入内存,开始运行, 并已初始化所有的设备驱动程序和数据结构等)之后,就通过启动一个用户级程序init的方式,完成引导进程。init始终是第一个进程。 启动过程就是代码init.c中main函数执行过程:system\core\init\init. c 在函数中执行了:文件夹建立,挂载,rc文件解析,属性设置,启动服务,执行动作,socket监听…… 下面看两个重要的过程:rc文件解析和服务启动。 1 rc文件解析 .rc文件是Android使用的初始化脚本文件(System/Core/Init/readm e.txt中有描述: four broad classes of statements which are Actions, Commands, Services, and Options.) 其中Command 就是系统支持的一系列命令,如:export,hostname,mkdir,mount,等等,其中一部分是linux 命令, 还有一些是android 添加的,如:class_start :启动服务,class_stop :关闭服务,等等。 其中Options是针对Service 的选项的。 系统初始化要触发的动作和要启动的服务及其各自属性都在rc脚本文件中定义。具体看一下启动脚本:\system\core\rootdir\init.rc 在解析rc脚本文件时,将相应的类型放入各自的List中: \system\core\init\Init_parser.c :init_parse_config_file( )存入到 action_queue、action_list、service_list中,解析过程可以看一下parse_config函数,类似状态机形式挺有意思。 这其中包含了服务:adbd、servicemanager、vold、ril-daemon、deb uggerd、surfaceflinger、zygote、media…… 2 服务启动 文件解析完成之后将service放入到service_list中。 文件解析完成之后将service放入到service_list中。 \system\core\init\builtins.c

AndroidL系统启动及加载流程分析

Android L系统启动及加载流程分析 1、概述 Android L的启动可以分为几个步骤:Linux内核启动、init进程启动、native系统服务及java系统服务启动、Home启动,主要过程如下图: 图1 整个启动流程跟4.4及之前的版本相差不多,只是有个别不同之处,本文我们主要分析Linux内核启动之后的过程。

2、启动过程分析 2.1 init进程启动 当系统内核加载完成之后,会启动init守护进程,它是内核启动的第一个用户级进程,是Android的一个进程,进程号为1,init进程启动后执行入口函数main(),主要操作为: 图2 AndroidL上将selinux的安全等级提高了,设为了enforcing模式,4.4上是permissive模式。 解析rc脚本文件,即init.rc脚本,该文件是Android初始化脚本,定义了一系列的动作和执行这些动作的时间阶段e aryl-init、init、early-boot、boot、post-fs等阶段。init进程main 函数中会根据这些阶段进行解析执行。AndroidL上为了流程更清晰,增加了charger(充电开机)、ffbm(工厂模式)、以及late-init阶段,实际上这些阶段是对其他阶段的组合执行,比如late-init:

2.2 ServiceManager的启动 servicemanager的启动就是init进程通过init.rc脚本启动的: 源码在frameworks/native/cmds/servicemanager/service_manager.c中,servicemanager是服务管理器,它本身也是一个服务(handle=0),通过binder调用,为native和Java系统服务提供注册和查询服务的,即某个服务启动后,需要将自己注册到servicemanager中,供其他服务或者应用查询使用。AndroidL上servicemanger中在处理注册和查询动作之前添加了selinux安全检测相关的处理。 2.3 SurfaceFinger、MediaServer进程启动 Android4.4以前,surfacefinger的启动根据属性system_init.startsurfaceflinger,决定是通过init.rc启动还是systemserver进程启动,之后的版本包括AndoridL都是通过init.rc启动的: 启动后会向servicemanager进程注册服务中,该服务启动时主要功能是初始化整个显

精选软件测试笔试题目及答案

精选软件测试笔试题目及答案 软件测试去面试的时候都会做哪些题目呢?下面是收集的精选软件测试笔试题目及答案,欢迎大家阅读。 1、集成测试也叫组装测试或者联合测试,请简述集成测试的主要内容? (1)在把各个模块连接起来的时候,穿越模块接口的数据是否会丢失; (2)一个模块的功能是否会对另一个模块的功能产生不利的影响; (3)各个子功能组合起来,能否达到预期要求的父功能; (4)全局数据结构是否有问题; (5)单个模块的误差累积起来,是否会放大,从而达到不能接受的程度。 2、简述集成测试与系统测试关系?

(1)集成测试的主要依据概要设计说明书,系统测试的主要依据是需求设计说明书; (2)集成测试是系统模块的测试,系统测试是对整个系统的测试,包括相关的软硬件平台、网络以及相关外设的测试。 3、软件测试的文档测试应当贯穿于软件生命周期的全过程,其中用户文档是文档测试的重点。那么软件系统的用户文档包括哪些? 用户手册 安装和设置指导 联机帮助 指南、向导 样例、示例和模板 授权/注册登记表 最终用户许可协议

4、软件系统中除用户文档之外,文档测试还应该关注哪些文档? 开发文档 软件需求说明书 数据库设计说明书 概要设计说明书 详细设计说明书 可行性研究报告 管理文档 项目开发计划 测试计划 测试报告

开发进度月报 开发总结报告 5、简述软件系统中用户文档的测试要点? (1)读者群。文档面向的读者定位要明确。对于初级用户、中 级用户以及高级用户应该有不同的定位 (2)术语。文档中用到的术语要适用与定位的读者群,用法一致,标准定义与业界规范相吻合。 (3)正确性。测试中需检查所有信息是否真实正确,查找由于 过期产品说明书和销售人员夸大事实而导致的错误。检查所有的 目录、索引和章节引用是否已更新,尝试链接是否准确,产品支 持电话、地址和邮政编码是否正确。 (4)完整性。对照软件界面检查是否有重要的分支没有描述到,甚至是否有整个大模块没有描述到。 (5)一致性。按照文档描述的操作执行后,检查软件返回的结 果是否与文档描述的相同。 (6)易用性。对关键步骤以粗体或背景色给用户以提示,合理

android开机启动流程简单分析

android开机启动流程简单分析 android启动 当引导程序启动Linux内核后,会加载各种驱动和数据结构,当有了驱动以后,开始启动Android系统同时会加载用户级别的第一个进程init(system\core\init\init.cpp)代码如下: int main(int argc, char** argv) { ..... //创建文件夹,挂载 // Get the basic filesystem setup we need put together in the initramdisk // on / and then we'll let the rc file figure out the rest. if (is_first_stage) { mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"); mkdir("/dev/pts", 0755); mkdir("/dev/socket", 0755); mount("devpts", "/dev/pts", "devpts", 0, NULL); #define MAKE_STR(x) __STRING(x) mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)); mount("sysfs", "/sys", "sysfs", 0, NULL); } ..... //打印日志,设置log的级别 klog_init(); klog_set_level(KLOG_NOTICE_LEVEL); ..... Parser& parser = Parser::GetInstance(); parser.AddSectionParser("service",std::make_unique()); parser.AddSectionParser("on", std::make_unique()); parser.AddSectionParser("import", std::make_unique()); // 加载init.rc配置文件 parser.ParseConfig("/init.rc"); } 加载init.rc文件,会启动一个Zygote进程,此进程是Android系统的一个母进程,用来启动Android的其他服务进程,代码: 从Android L开始,在/system/core/rootdir 目录中有4 个zygote 相关的启动脚本如下图:

相关主题