• No se han encontrado resultados

IV. FILOSOFIA DE ALARMAS PARA UNA CENTRAL TERMICA DE CICLO COMBINADO

3. ANUNCIACIÓN DE LAS ALARMAS Y RESPUESTA.

3.3. Aplicación para la presentación de las alarmas.

3.2.1 Model

Instead of using processes, we state our definitions in terms of agents that perform actions in the system; processes can aggregate the roles of several agents. We assume an asyn- chronous crash-recovery model in which agents communicate by exchanging messages, with no bounds on the time it takes for messages to be transmitted or actions to be exe- cuted. Messages can be lost or duplicated but not corrupted; agents can fail by stopping only and never perform incorrect actions. Agents are assumed to have some sort of local stable storage to keep their state in between failures so that finite periods of absence are not

distinguishable from excessive slowness. Although we assume agents may recover, they are not obliged to do so once they have failed. An agent is considered to be nonfaulty iff it never stops executing enabled actions.

3.2.2 Sequence Agreement

As briefly explained in the previous chapter, given two sets of agents, namely proposers and learners, the sequence agreement problem consists of ensuring that learners learn increasing prefixes of a single sequence built out of the proposed value. In order to deal more easily with sequences throughout the chapter, we introduce some useful notation. We represent a sequence s as the tuple of its elements hv1, v2, . . . , vni, where n is the length of s and

vi equals s[i ], the sequence’s ith element. We say that sequence s is a prefix of sequence

t , noted as s v t , iff the length of s is less than or equal to the length of t and, for all i from 1 to the length of s, s[i ] = t [i ]; s and t are equal iff s v t and t v s. The empty sequence hi has length zero and is a prefix of any other sequence. Sequence agreement’s safety properties can then be stated as follows, where learned [l ] refers to the prefix currently learned by learner l , initially hi.

Nontriviality For any learner l , learned [l ] contains only proposed values.

Stability For any learner l , if learned [l ] = s at some time, then s v learned [l ] at all later times.

Consistency For any pair of learners l1 and l2, either learned [l1] v learned [l2] or

learned [l2] v learned [l1].

The liveness requirement stated in the previous chapter, forcing every proposed value to be eventually learned by all learners is too strong for real systems. In an actual system, client applications propose commands and learn the result of their execution, tasks possibly associated with proposers and learners in our model. Since we cannot require clients not to fail, we define liveness in terms of another set of agents: the acceptors. Let a quorum be any finite set of acceptors large enough to ensure liveness. The liveness property of sequence agreement is defined as follows.

Liveness For any proposer p and learner l , if p, l and a quorum of acceptors are nonfaulty and p proposes value v , then eventually learned [l ] contains v .

3.2.3 Algorithms

In this section, we formally define sequence agreement algorithms and what it means for them to be collision-fast. The formal definitions we give are mostly borrowed from [Lam06b]; as in that work, we start by describing events.

An event is an action performed at some agent either spontaneously or triggered by the reception of a message. Each event e performed by agent eagent sends exactly one message

emsg, receivable by any agent, including itself. We assume that events are totally ordered at

the agents performing them, that is, we assume that each event e performed by agent eagent

is uniquely identified by the positive integer enum, indicating that e was the enumth event

performed by eagent. For an event e triggered by the reception of a message, we let ercvd

equal the triple hm, a, i i, where m is the received message, a is the agent that sent it, and i the index enum of m’s sending event e.

A scenario is the set of events performed in some single (partial) execution of an al- gorithm. For every event in a scenario, all other events that could have causally influ- enced it must also be in the scenario. To formally define a scenario, we let S be, for

any set S of events, the transitive closure of the relation → on S such that e → f iff either (i) eagent = fagent and enum ≤ fnum or (ii) f is a message-receiving event and

frcvd = hemsg, eagent, enumi.

Definition 3.1 (Scenario [Lam06b]) A scenario S is a set of events such that:

• for any agent a, the set of events in S performed by a consists of kaevents numbered

from 1 throughka, for some natural numberka;

• for every message-receiving event e ∈ S , there exists d ∈ S , d 6= e, such that ercvd = hdmsg, dagent, dnumi; and

• S is a partial order onS .

A scenario obtained by removing the last events of a scenario S , according to the precedence relation S, is called a prefix of S .1

Definition 3.2 (Prefix [Lam06b]) A subset S of a scenario T is a prefix of T , written S v T , iff for any events d in T and e in S , if d T e then d is in S .

1

For simplicity, we use the same nomenclature and notation to define the prefix relation between sequences, scenarios, and, as shown later, v-mappings. These sets are different and used in different contexts, which makes us believe this cannot be a source of confusion.

An algorithm can be seen as the set of non-empty scenarios it allows. However, we are only interested in algorithms that are compliant with our model. We define an asynchronous algorithmas follows, where Agents(S ) is the set of agents that performed events in S .

Definition 3.3 (Asynchronous Algorithm [Lam06b]) An asynchronous algorithm Alg is a set of scenarios such that:

• every prefix of a scenario in Alg is in Alg; and

• if T and U are scenarios of Alg and S is a prefix of both T and U such that Agents(T \ S ) and Agents(U \ S ) are disjoint sets, then T ∪ U is a scenario ofAlg .

We define a source of a scenario S as an event e ∈ S that is minimal in the ordering S, and we let the depth of an event be the number of message steps that precede the event.

Definition 3.4 (Event Depth [Lam06b]) The depth of an event e in a scenario S equals 0 ife is a source of S , otherwise it equals the maximum of

(i) the depths of all eventsd with dagent = eagentanddnum < enum, and

(ii) ife is an event that receives a message sent by event b, then 1 plus the depth of b.

We now must define what a collision-fast sequence agreement protocol is. For simplic- ity, the definition we present considers only scenarios in which values are proposed in the source events. As a result, an algorithm might be collision-fast according to this simplified definition even if it does not ensure the same delivery latency for non-source proposals. Nonetheless, we believe that algorithms that satify our definition can be usually adapted to ensure the same delivery latency for all values proposed in normal runs, as this is the case for our solution.

A normal scenario is one in which the execution starts by one or more proposers propos- ing values, messages are not lost or duplicated, timeouts do not occur, messages are received in FIFO order, and no event receives a message with depth lower than its own minus one, that is, message reception is not delayed for two message steps or more.

Definition 3.5 (Normal Scenario [Lam06b]) A scenario S is normal iff:

• the message sent by any single event is not received twice by the same agent; • every non-source event is a message receiving event;

• if d 1 and d 2 are events in S with d 1agent = d 2agent andd 1 S d 2, and e2 is an

event inS that receives the message sent by d 2, then there exists an event e1 in S withe1agent = e2agent ande1 S e2 such that e1 receives the message sent by d 1;

and,

• if d and e are events in S and e receives the messages sent by d , then edepthequals 1

plusddepth inS .

Our definition of collision-fast sequence agreement states that the values initially pro- posed are delivered in two message steps. In order to measure that, we use the definition below.

Definition 3.6 (Complete to Depth [Lam06b]) An agent a is complete to depth δ in a sce- nario S iff either δ = 0 or every agent in Agents(S ) is complete to depth δ − 1 and a receives every message sent by an event inS with depth less than δ.

We consider a sequence agreement algorithm to be collision-fast iff there is a set M of agents and a set P of at least two proposers such that all values initially proposed by any subset O of the proposers in P are delivered by a learner l when l is complete to depth 2 in a normal scenario in which no agent in M ∪ O ∪ {l } crashes. Our formal definition below is derived from the definition of Collision-fast Accepting in [Lam06b].

Definition 3.7 (Collision-fast Algorithm) An asynchronous sequence agreement algorithm Alg is collision-fast iff there is a set M of agents and a set P of proposers with at least two proposers such that, for every nonempty subset{p1, . . . , pk} of P with pi all distinct:

• for any proposable values v1, . . . , vkthere is a scenario{e1, . . . , ek} in Alg such that

eachei is a source event in whichpi proposesvi; and,

• for every learner l and every normal scenario S of Alg with Agents(S ) = {l , p1, . . . , pk} ∪ M that contains {e1, . . . , ek} as a prefix, if l is complete to depth 2

inS , then learned [l ] contains v1, . . . , vk.

Documento similar