Giter Site home page Giter Site logo

mittp_lab's Introduction

Результати досліджень

Перевірено декілька варіантів симуляції з використанням потоків на прикладі go.

  1. Без будь якої сихронізації
  2. Синхронізація на рівні кожної зміни
  3. ... на рівні усього списку клітин
  4. ... на рівні кожної з клітин що змінюються
  5. ... на рівні лише одної з клітин що змінюються
  6. Використовуючи паттерн producer/consumer

Результати симуляцій: 1.

Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 2278503 [66634, 269937, 207549, 240919, 270283, 379308, 404751, 192576, 221629, 25002]
Current cells state: 4721121 [132549, 546002, 418559, 510278, 571608, 782528, 830916, 408048, 468887, 51746]
Total cell count after simulation: 4721121

race-condition

Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 1 [0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 3 [1, 0, 0, 0, 0, 0, 0, 2, 0, 0]
Current cells state: 3 [0, 1, 0, 0, 0, 1, 1, 0, 2, 0]
Total cell count after simulation: 5

Протягом симуляції стан клітин не корректний, але у кінці симуляції завжди повертається до корректного стану (eventual consistency).

Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 5 [2, 0, 0, 1, 1, 0, 0, 1, 0, 0]
Current cells state: 5 [1, 1, 0, 0, 0, 1, 0, 1, 1, 0]
Total cell count after simulation: 5
Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 5 [0, 0, 1, 1, 1, 1, 1, 0, 0, 0]
Total cell count after simulation: 5

Логгер заблоковано назавжди, адже він не може отримати доступ одразу до усіх клітин і зробити снапшот (starvation).

Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 378667 [104, 275971, 26406, 23, -294, 38176, 38659, -103, -357, 82]
Current cells state: 769728 [164, 556429, 54685, 6, -452, 80003, 79592, -229, -588, 118]
Total cell count after simulation: 769728

race-condition але слабший ніж взагалі без синхронізації

Current cells state: 5 [5, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Current cells state: 5 [0, 1, 2, 0, 0, 1, 0, 0, 0, 0]
Current cells state: 5 [0, 2, 0, 1, 0, 0, 1, 1, 0, 0]
Total cell count after simulation: 5

по суті еквівалентний до mutex на всі клітини одразу, але клітини симуляції мають можливість працювати швидше в залеждності від розміру буфера каналу (є трохи часу поки буфер не заповниться і не заблокує потік) та шкидкості консьюмера.

mittp_lab's People

Contributors

gidra5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.