EOS parallel

Latency is the time it takes for one account to send a message to another account and then receive a response. The goal is to enable two accounts to exchange messages back and forth within a single block without having to wait 3 seconds between each message. To enable this, the EOS.IO software divides each block into cycles. Each cycle is divided into threads and each thread contains a list of transactions. Each transaction contains a set of messages to be delivered. This structure can be visualized as a tree where alternating layers are processed sequentially and in parallel.

  Block

    Cycles (sequential)

      Threads (parallel)

        Transactions (sequential)

          Messages (sequential)

            Receiver and Notified Accounts (parallel)

How EOS dPOS work

  • https://github.com/EOSIO/eos/blob/master/libraries/chain/include/eos/chain/types.hpp#L120
  • https://github.com/EOSIO/eos/blob/master/libraries/chain/include/eos/chain/config.hpp#L51
  • https://github.com/EOSIO/eos/blob/master/libraries/chain/include/eos/chain/global_property_object.hpp#L32
  • https://github.com/EOSIO/eos/blob/master/libraries/chain/chain_controller.cpp#L269
  • https://github.com/EOSIO/eos/blob/master/libraries/chain/chain_controller.cpp#L1430
  • https://github.com/EOSIO/eos/blob/master/libraries/chain/chain_controller.cpp#L1290
  • https://github.com/EOSIO/eos/blob/master/libraries/native_contract/native_contract_chain_administrator.cpp#L18
  • https://github.com/EOSIO/eos/blob/master/plugins/producer_plugin/producer_plugin.cpp#L282
  • https://github.com/EOSIO/eos/blob/master/plugins/producer_plugin/producer_plugin.cpp#L265
  • https://github.com/EOSIO/eos/blob/master/libraries/native_contract/producer_objects.cpp#L60

Using the EOS.IO software blocks are produced in rounds of 21. At the start of each round 21 unique block producers are chosen. The top 20 by total approval are automatically chosen every round and the last producer is chosen proportional to their number of votes relative to other producers. The selected producers are shuffled using a pseudorandom number derived from the block time. This shuffling is done to ensure that all producers maintain balanced connectivity to all other producers

References

  • https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md#deterministic-parallel-execution-of-applications
  • https://github.com/EOSIO/Documentation/blob/master/zh-CN/TechnicalWhitePaper.md#应用程序的确定性并行执行
    • https://github.com/BlockchainTranslator/EOS/blob/master/TechDoc/EOS.IO%20Technical%20White%20Paper.md