Blockchain Technology Comprehension. A Survey On Distributed Systems -Part 2steemCreated with Sketch.

in #blockchain6 years ago (edited)

Introduction


On the previous post the CAP theorem was generally depicted, his consequences where described, and network system designer's strategy to circumvent CAP theorem limitations where briefly summarized.
Now we will dig further in the theoretical concepts underlying the CAP theorem. Consistency/Availability trade-offs on partitioned systems will
be shown to be particular cases of the more general Safety/Liveness trade-off in unreliable systems. Then the problem of consensus in distributed systems will be reviewed. Later, we will study what levels of synchrony are required to have both Safety and Liveness, and finally, we will discuss the degree of Consistency that can be achieved in an unreliable system.




Title image
Licensed under Creative Commons Attribution-Share Alike 4.0 International license. Source
Text divider

Safety and Liveness


When executing a program it can run a single isolated set of operations, or it can run several sets simultaneously. Thus, we have sequential programs and concurrent programs. A concurrent program is one in which several streams of operations are executed simultaneously, those streams can communicate and interfere with each other. Those sequences of instructions are called threads, that is why sequential programs are often called single-threaded programs

Even so, any program π can by specified in terms of its sets of atomic actions (Aπ) and a predicate (Initπ) that describes its possible initial states. An execution of such a program can be thought of as an infinite series of states:

σ = S 0 S1...

State S 0 satisfies Initπ, the program changes its actual state as the result of the application of a single atomic operation from Aπ to the current state. Following this reasoning, we have that a termination execution is one in which an infinite sequence is obtained by repeating the final state. That is, after some finite time we have a constant state on our infinite sequence.

Since a Property is a set of sequences of infinite states, and a program also defines a set of such sequences, it is said that a Property "holds" for a program if the set of infinite series of states defined by the program are contained within the Property.

Now, let S be the set of program states, S * the finite sequence of program states, and Sw the set of infinite sequences of program states. An execution of the program has to be contain in Sw, thus elements of Sw are also called program executions, and elements of S * are called partial program executions. When a execution σ is in property P it is denoted as σ|=P, and σi are the elements of the partial execution of σ containing the first i elements of execution σ.


Safety

For P to be a safety property, if P does not hold for an execution, then at some point some "bad thing" must happen. Thus, P is a safety property if the following holds:

(∀σ: σ ∈ Sw: σ|≠P ⇒ (∃i: 0 ≤ i: (∀β: β∈ Sw: σiβ |≠P)))

Then the definition stipulates that if "something bad" does occur, there is some identifiable point i at which it happens.


Liveness

For a property P to be a liveness property, we must verify that:

(∀α: α ∈ S * : (∃β: β∈ Sw: αβ|=P))

A liveness property states that when executing a program eventually the expected outcome does occur.

Once we are done considering these concepts, it is clear that Availability is a Liveness property. When we say that we have availability we state that eventually, we will receive a response from the network (something good eventually happens). Also, we can state that Consistency is a Safety property. Remember that we label a system as one with high consistency if the answer obtained from it is always what we were expecting (something bad never happens).

Text divider

Consensus


In an asynchronous system, there are three conditions that must be met in order to reach consensus. First, agreement: every process must output the same value; validity: every value output must have been provided as the input for some process; and termination: eventually, every process must output a value. From the above definitions of, it is clear that agreement and validity both states that for the property to hold, the expected outcome must occur! It is equivalent to stating that for the property to hold no unexpected outcomes occur, thus they are safety properties. Similarly, terminations conditions are clearly those of a liveness property.


Dealing with the Safety/Liveness trade-off: Synchrony

In order to determine what levels of reliability are required to avoid the inherent trade-off between safety and liveness, the degree of synchrony on a network should be analyzed. A synchronous network must have these characteristics: first, all the process within the network has a clock and all the clocks are synchronized; second, messages are delivered within a determined and known amount of time; and third, each process of the networks perform a task at an invariant and known rate. This system can be considered to operate in rounds of repeated and synchronized steps. In those rounds, each process sends some messages, receive the messages sent to them in that round, and perform some individual computation.

Consensus requires f + 1 rounds if up to f processes might crash in a synchronous network. In an asynchronous network, consensus is unfeasible if there is only one crash failure. Fortunately, a mean point is usually achieved for real systems. Most real systems reach Eventual Synchrony, it is achieved when a process has some periods of synchrony and some periods of asynchrony, such processes can reach consensus if the synchronous interval lasts long enough. Eventual synchronous system reaches consensus if at least f + 2 rounds are executed within the synchrony interval. Also, crash-fault tolerance is achieved if there are <n/2 crash failures, where "n" is the number of servers.

Some other approaches lead to the implementation of an Oracle, this process executes a leader election service and provides sufficient information to reach consensus in an asynchronous crash-prone system. Moreover, there is a perspective focused on establishing the lower reliability levels of linking between the process in the network and the minimal synchrony assumptions to reach consensus in an asynchronous system.


How consistent a lively, partition-prone network can be?

The consensus problem requires that an asynchronous and distributed set of process agree on a common value among themselves. Additionally, this has to be done in the presence of a number of faulty processes and all processes must output some value and terminate.

Set-agreement is a "weaker" agreement condition in which process must not agree on a single value but in a set of values. In this condition, each process begins with a certain value vi and eventually, every process outputs one of the initial values as the result of an execution. In k-set consensus, each process decides on a single value such that the set of agreed values in any run is of size at must k. K-set agreement can be solved if the number of crash failures is equal or lesser than k-1 and is the higher consistency that can be reached without giving up availability in a system with k-1 failures.


Final Thoughts

Distributed systems have major theoretical limitations, those limitations have to be dealt ingeniously to achieve the desired levels of reliability in blockchain technology. Major advances have been made from the initials operations with bitcoin to the present times. Several hundreds of projects have implemented subtle variations on consensus algorithms to reach the fittest balance of safety/liveness trade-off for their individual goals. A solid foundation on the theoretical concepts that determine the nature of this trade-off is a key aspect to fully understand the blockchain technology.


References

  • Seth Gilbert and Nancy Lynch. Perspectives on the CAP Theorem. IEEE Computer Society Press, February 2012.
  • S. Chaudhuri. More choices allow more faults: Set consensus problems in totally asynchronous systems. Information & Computation, 105(1):132–158, 1993
  • Fischer M, Lynch N, and Paterson N. Impossibility of Distributed Consensus with One Faulty Process, in "ACM Symposium on Principles of Database Systems". April 1985
  • Bowen Alpern and Fred B. Schneider. Recognizing safety and liveness. Distributed Computing September 1987, Volume 2, Issue 3, pp 117–126

Sort:  

Congratulations @jasb! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Brazil vs Belgium


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Hey bro! It's nice to know you are serious with this project, I really liked your post.
There is something that's not clear to me, you define concurrent programs as a multiple thread program. I imagine that like many programs executing itselves and interacting with each other, but if that's so, then you can count the states of a concurrent program as the sum of several sequential program states. Since sequential programs have a finite set of states then the sum of the states of a finite set of sequential programs is finite. But then why concurrent programs have infinite states, that's my doubt

I'm happy to know that you liked the post.

Ok, let's clarify it a little bit.
  1. The threads are series of instructions (a.k.a. statements) executed when running a program. The state is the current situation of the variables stored in memory by the program.
  2. A program can be determined by the set of operations allowed for that particular program and its initial state (much like how you determine the position of a body at any time if you know the position at t0 and the explicit expression of the function V(t) in classical mechanics).
  3. Changes on states of a program are the result of applying an atomic operation from (Aπ) to the previous state. For the initial execution the first operation is made on the initial state, then the second operation is executed over the result of the first operation and so on.
  4. The execution of any program (not just concurrent ones) can be thought of as a infinite series of states. Even if a program state is constant, it can be represented as an infinite series of the initial state σ = S0S0S0...
    So there is no such a finite series for a sequential program for a given execution. What do exist is a finite sequence for a partial execution of a program, this fact does not change if the program is sequential or concurrent.

I hope I have given a clearer explanation. If you have more questions make more comments without doubt.

cya.

Hi @jasb!

Your post was upvoted by utopian.io in cooperation with steemstem - supporting knowledge, innovation and technological advancement on the Steem Blockchain.

Contribute to Open Source with utopian.io

Learn how to contribute on our website and join the new open source economy.

Want to chat? Join the Utopian Community on Discord https://discord.gg/h52nFrV

Hello everyone, well I was reading your post @jasb and the comments too by @riemman-stielmit, well, I remember that importance of meeting the difference between Threads and Processes. If you want to programme a network you need to know what it will the resources (hardware) and the users that will use your network, why? because the threads are the lifejacket when your processing power is slow, and if the amount of user arrive faster than your machine can treat, you'll need implement threads indeed.

The Processes need more capacity of the hardware if you want to use in a light network, is easiest than Thread to implement, if you do something wrong only reach the process. Don't even think about the Threads (lol).

Well, @jasb when you refer to safety and liveness networks, do you only have in mind threads?

What is the central idea in Synchrony (Dealing with the Safety/Liveness trade-off)? It was confusing to me.

I'll expect your answers, see u

@plumesteemit

separadorplumesteemit.png

Congratulations @jasb! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got your First payout

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @jasb! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by jasb from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Congratulations @jasb! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @jasb! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.029
BTC 76354.05
ETH 3034.69
USDT 1.00
SBD 2.62