Total order and partial order

Relations on the set

Suppose A is a set {1,2,3}; R is a relation on a set A, for example {<1,1>, <2,2>, <3,3>, <1,2>, <1, 3>, <2,3>}
reflexivity: take any element a in an x, if there <x, x> in R, then R is reflexive.
Symmetry: A two take any element x in, y, if <x, y> in the relationship between R, then the <y, x> also in relation R, then R is symmetric.
Antisymmetry: A take any two elements x, y (x = y! ), If <x, y> in the relationship between R, then the <y, x> is not the relationship R, then R is antisymmetric.
Transitivity: A take any three elements x, y, z, if <x, y>, <y , z> in the relationship between R, then <x, z> are relations R, then R is transitive .

And the whole concept of partial order sequence

Partial order: R non-empty set of relations A, if R is reflexive, anti-symmetric, and the transmission, R is a partial order relation called the A.
Partial sequence defined: Let R is a binary relation on a set A, if R satisfies:
Ⅰ reflexive: for any x∈A, there xRx;
Ⅱ inversion symmetry (i.e. antisymmetric relation): for any x, y∈A, if xRy, and yRx, then Y = X;
ⅲ transitive: for any x, y, z∈A, if xRy, and yRz, the xRz. R is called partial order on A.

Total Order: If R is a partial order on A, then for any x in the set A, Y, have x <= y, or y <= x, it must be one, it is called R total order on a.
Definition of total order: Let the set has a total order on X, if we, the following statements with ≤ express this relationship for X all a, b and c holds:
if a ≤ b and b ≤ a then a = B (antisymmetry)
if a ≤ b and b ≤ c then a ≤ c (transitivity) a ≤ b or b ≤ a (complete)
Note: complete itself also includes reflexivity. Therefore, the total order must be a partial order

So you can see, a total order is also a partial order. Exactly partial order spade, the key lies in the anti-symmetry, that is, <x, y> in relation R, then <y, x> is not on the relationship between R, then I ask you, <y, x> relations what is unknown. So partial order is that you set A = {1,2,3,4}, according to a relationship of some elements of R are you have not. Well, since you do not know <y, x>, then the total order, it is one more condition, have x <= y, or y <= x, it must be one.

For example

Partial Order example:
Suppose A = {1,2,3,4}, R is assumed relation on a set A: {<1,1>, < 2,2>, <3,3>, <4,4 >, <1,2>, <1,4>, <2,4>, <3,4>}, then:
reflexivity: see <1,1>, <2,2>, <3 3>, <4,4> in R are satisfied.
Antisymmetry: Because <1,1>, <2,2>, <3,3>, <4,4> not x = y, it is not considered the four, to <1>, there! <2,1> is not R; for <2,4> has <4,2> is not R; for <3,4> has <4,3> R, is not satisfied.
Transitivity: <1,1> <1,2> in R, and <1,2> in R; <1,1> <1,4> in R, and <1,4> in R ; <2,2> <2,4> in R, and <2,4> in R; <3,3> <3,4> in R, and <3,4> in R; et and other meet. So that R is a partial order.

Total Order example:
Suppose A = {a, b, c }, assuming R is a relation on a set A: {<a, a> , <b, b>, <c, c>, <a, b>, <a, c>, <b , c>} and as described above, may prove reflexive, anti-symmetric, transitive, so is the partial sequence, because there is <a, b>, <a , c> , <b, c>, have a relationship that is twenty-two, is satisfied for an arbitrary set of x in a, y, both x <= y, or y <= x, it must be one, so is the total order.

application

What is the use of this concept:
in "Time, Clocks, and the Ordering of Events in a Distributed System" in the introduction to the paper, we generally define how a thing is happening before the other, very simple, look at the time to get away in this stand-alone or single-server, single Nucleation is no problem.
However, in a distributed computer system, assuming there are A, B two servers, their native time may not be synchronized, or differential, or says no, then this time, it is hard to define the A server the first occurrence of this request, the request or the server B occurs first. Therefore, inside the paper, Lamport is defined as:
(. 1) the If A and B are Events in The Same Process, and A Comes before B, the then A -> B.
(2) the If A IS The sending of A Message by One The B and IS Receipt Process of The Same by Another Process Message, the then A -> B.
(. 3) the If A-> B and B-> C the then A -.> Two DISTINCT Events A and C B to BE are Said Concurrent . if a non -> b and b non -> a
we assume that there will be no last sentence:
Two Events A DISTINCT and b are of Said Concurrent to bE IF A non -> b and b non -> a

As shown below:
Here Insert Picture Description
Here we can see three processors, you may be considered three servers, this time, p3 P server processes a request, Q q3 server also handles a request, and the request has nothing to do both then after whoever they who, though q3 first appears to be, but before the p4 server node P does not know the actual server running Q q3 time ah, so this time, Lamport added a condition, in this case (P before p4 server node) these two events p3 and q3 be concurrent.

This algorithm above is how to achieve it: in fact, it is not difficult for single-core processors, each event counter i ++ can be. For different processors, causal, when sending a message, but also his own count this pass over, and then another processor fetches Math.max (currentValue, pass over the count) +1 to.

Then this count there is a problem, counting server A and server B may have a physical moment it is equal, equal how to do, given the definition of Lamport it is equal to the number we look at comparing the size of two servers.

to sum up

Through the above, it is possible to perceptual awareness, partial order is actually you do not consider the whole, a total order is what you need to catch some lower relationship, so that all the circumstances apply.

Released six original articles · won praise 4 · Views 1007

Guess you like

Origin blog.csdn.net/qq_37703846/article/details/103442742