Consistency models

Why this post?

I have found somehow difficult to find an authoritative source which describes what is the contract that a certain consistency model defines with the programmer. Moreover, some resources seem to contradict each other.
The idea of this post is to document my findings around some of the most common consistency models that can be found in distributed systems which we interact with. When possible I'll add the resource where I found the definition.

Consistency model as abstraction

In distributed systems, a consistency model is a contract between the system and the developer who uses it. A system is said to support a certain consistency model if operations on memory respect the rules defined by the model.
They are a powerful abstraction which helps to describe a system in terms of its observable properties.
From a practical point of view, a consistency model answers to questions like: If Client 1 adds an object to a distributed data store at 1:00 pm and Client 2 tries to read the same object at 1:01 pm, will Client 2 be able to get the new object? Or will it get a 404 because the resource was not found?
The answer is that...it depends. There are many factors to consider to answer such a question. One of them is the consistency model adopted by the distributed data store.

Sequential consistency

The result of any execution is the same as if the operations of all processors were executed in some sequential order and the operations of each individual processor appear in this sequence in the order specified by its program.


Conceptually there is one global memory and a switch that connects an arbitrary processor to the memory at any time. Each processor issues memory operations in program order and the switch provides the global serialization among all the processors.
Therefore: Sequential consistency is not deterministic because multiple execution of the distributed program might lead to a different order of operations.


In the example above, four possible execution orders are possible no matter what is the actual order in which the operations were issued.
Important: no matter what the order of the operations are, it is guaranteed that is the same among all the processors. This also means that each process will observe the same history of operations. For example, in the first case b.1 will read the state which is the result of all the operations completed before b.1 : so b.1 is going to read a value for the account which is '150'.

Strict consistency

Also called Strong consistency or Linearizability
Like sequential consistency, but the execution order of programs between processors must be the order in which those operations were issued.
As analogy, this is pretty much what we would get from a multi threaded program in which there is no cache between the cores and the main memory, and neither the compiler nor the CPU is allowed to reorder instructions. 
Therefore: If each program in each processor is deterministic, then the distributed program is deterministic.

Casual consistency

Relax sequential consistency allowing also reordering of the operations in the same processors when they are not 'casually related'.

PRAM consistency

The write operations (and only the writes) of each processor appear in the order specified by the program.

Serializability

Unlike the models described above, serializability defines guarantees on group of operations (called transactions). It guaranties the execution of a set of transactions (usually read and writes operations) over multiple items is equivalent to some serial execution of the transactions.
Unlike linearizability, serializability does not impose a deterministic order, in this sense is similar to sequential consistency but for a group of operations.
Strict serializability, instead, guaranties the same constraint expressed by linearizability but for transactions: transactions must be executed in the order they were issued.
The definition looks a bit different from the ones above because it comes from database people, while sequential consistency, etc. come from distributed system people.

Read after write

The model guaranties immediate visibility of updates to an item to all the clients. The concept is similar to the one of Memory Barrier present in modern processors.
Note: Sometimes what is called Read after write in some systems, it's actually Read after create (for example in S3).

Read after create

The model guaranties immediate visibility of newly created data to all the clients. Updates to an existing object might not be immediately visible to all clients.

Conclusions

Those were my two cents about one of the many aspects around distributed systems. I'll keep adding more to the list as I go. Of course, any feedback would be greatly appreciated!

Source: https://dev.to/napicellatwit/consistency-m...

13 Subreddits For Coding & Programming Help

Looking for help with coding but don’t know where to go? Thankfully there are tons of online forums and communities where developers will answer questions and help you solve problems.

Reddit is one of the largest social sites out there and it’s one of the the best resources for finding quick coding help. You just need to know where to look.

I’ve curated the best subreddits for everything related to web development & backend programming. Whether you’re doing frontend HTML/CSS or some backend Node.js there’s a subreddit out there that can help.

1. r/WebDev

 

By far the largest community and best place to start is the r/WebDev subreddit.

It’s heavily populated with over 160k subscribers and growing larger every month. This is the de-facto “main” subreddit for talking about all things webdev including both frontend & backend code, career advice, open source projects, helpful tools and much more.

 

It does move fast and the front page is full of new topics on a daily basis. Thankfully it’s also an active community and if you post a good question you’re bound to get a response.

I recommend this more as a starting point if you have simple questions or want advice from a larger group. The webdev community is vast and this subreddit offers a direct link to gather advice or critiques on your work.

2. r/Frontend

 

Here’s a slightly smaller sub geared more towards HTML/CSS work. The r/Frontendcommunity is packed with great tips and news about the frontend landscape.

Everything related to frontend development is welcome including critiques, open source projects, and of course questions from noob-tier basics to more advanced subjects.

This sub is fairly sizeable with an active audience and 27k subscribers.

 

Since it’s smaller you won’t need to worry about questions being pushed off the front page too fast. But it also may take a little longer to get replies so don’t get too antsy with new posts!

3. r/CSS

 

Getting even more specific is the CSS subreddit dedicated to all things Cascading Stylesheets.

Again it’s a fairly small sub but the total community size matches the same as /r/frontend. So it’s definitely a great place to go for answers to your questions, or to find suggestions on how to build something.

The front page is full of advice and tips for coders trying to learn new techniques in the world of CSS. Everything from flexbox to CSS animation and every other topic you can think of can be found here.

No matter what your background or experience level I definitely recommend the /r/CSS community for relevant code advice.

4. r/AskProgramming

 

 

If you want a community dedicated to answering questions then you want the AskProgramming subreddit.

It’s not a huge resource but it is very active with members posting every day. It’s also one of the few places where you can get immediate answers without being downvoted for asking a stupid question(or for no reason, it is Reddit).

This sub is really made for anyone who has questions about programming in general. It does feature plenty of topics unrelated to the world of webdev. But you can learn a lot from those questions too and of course you’ll find plenty of web topics mixed in.

Although you should probably have some understanding of programming before asking anything here. You certainly don’t need to be an expert but it helps if you’re not a total noob either.

Think of this place more like a support group with experienced programmers willing to help you out, but only if you’ve done some of the legwork yourself.

5. r/LearnProgramming

 

 

One of the largest coding subs on Reddit is r/LearnProgramming.

Just as the name suggests it’s a massive community of beginners and intermediate-level coders hoping to pick up a new language(or learn their first one).

It’s an excellent resource for asking questions about how to get started, which books to study for web dev, or which online courses will help you learn to build websites.

But since this is a general programming subreddit it’s also very much involved with other languages. You’ll find a ton of posts on Ruby, C#, Python, and other popular languages. Many times these can be used on the web but they’re rarely a beginner’s language.

Either way this sub is really a mixing ground for everyone and it’s the perfect place for beginners to ask questions without feeling obnoxious.

6. r/Coding

 

 

I can’t say the r/Coding subreddit is the absolute best resource for a beginner. But it is one of the strongest places to start if you’re unsure of what you wanna learn.

This community offers a nice mix of discussion threads, general questions, and news posts talking about the latest information in the world of coding. It is not just a web-related forum although it does have a lot of content in that area.

Really the /r/coding subreddit is useful for picking up tidbits from other developers on the process of coding. This might include the npm package manager or even setting up a typical IDE workflow for learning HTML/CSS on your own.

Either way this is a sub you should definitely check out if you’re interested in web coding as a career.

7. r/JavaScript

 

 

The biggest and baddest of all the frontend languages has to be JavaScript. This language started off as a small standard created by a developer at Netscape.

Over the past couple decades JavaScript has become a must-learn language for modern development. And the r/JavaScript subreddit is the place to be if you’re hoping to learn more, share advice, ask questions, or just consume a bit of daily JS wisdom.

There is no way anyone could master all of JavaScript. It’s just such a huge area with hundreds of frameworks and libraries that build upon vanilla JS code.

I personally think it’s best to specialize and focus on one area at a time. If you’re brand new then try reading some guides and asking questions as you have them. But I don’t recommend this JS subreddit for absolute novices.

Instead think of this place as a professional-level discussion board. If you bring a question to the table you should be thoughtful and try to respect the advice of others.

And you can try searching Google first to see if anyone else has asked your question in the past.

8. r/LearnJavaScript

 

 

Now here’s one of the better communities for getting started as a beginner. r/LearnJavaScript is solely meant for anyone who really doesn’t understand the JS process and needs to ask some pretty newbie questions.

You might get answers on the main JS sub if you ask newbie stuff, but really you’ll get more info from the Learn JavaScript community.

It’s a pretty large sub with about 30k subscribers and a handful of new posts every day. You’d be surprised what kinds of questions get asked here and it’s not very hard for your post to hit the front page.

Sometimes you’ll also find articles and tutorials shared from other members who found some content valuable on the web. Bookmark any links that grab your attention and try going through them at a later date.

But this is really the best support community for aspiring JS devs. Commenters are usually more than willing to help so long as you provide enough details on your problem.

9. r/PHP

 

 

The largest backend web language in the world is PHP. This powers most of the big CMS engines including WordPress so it’s no surprise that the PHP subreddit would be massive.

This place does support general webdev/WordPress topics although it’s more focused on the PHP language itself.

Posts range from news updates to questions and even developers asking how to approach a certain problem. These aren’t usually complex algorithmic problems but they are issues that web developers face every day.

You can also find posts offering advice on speeding up website performance since PHP can run a tad slow. Although it’s still the most used open source backend language so it’s gonna be around for a while.

10. r/WordPress

 

 

Piggybacking on the PHP subreddit is the ever-popular WordPress sub.

Since WordPress now powers more than 25% of the Internet it’s fair to say this CMS is worth learning. And if you’re having trouble with WordPress this community can help.

It’s one of the better subs to gather code snippets and helpful plugins that are bound to increase your WordPress coding process.

You can get support for everything from theme development to plugin development and even common problems you may face when building your functions.php file. WordPress is truly its own ecosystem so you need to feel comfortable learning the ropes.

This community does run a bit slower than others but you’ll still get really helpful responses if you’re patient.

11. r/ProWordPress

 

 

Are you already pretty skilled at WordPress development? Know your way around the backend and feel very comfortable building new themes from scratch?

Then you might prefer the r/ProWordPress subreddit along with the default. This pro-level sub is a lot smaller with only 3k subscribers and far fewer posts(maybe one per week).

However it’s also a lot more technical and it’s probably one of the better places to ask complex programming topics.

My first recommendation is actually the WordPress Stack site because it’s full of talented coders who specifically make time to answer questions. But as another resource the /r/ProWordPress subreddit is definitely something to check out.

12. r/Learnwebdev

 

While this subreddit is very small I do think it’s a great resource for absolute beginners. Plus it’s a small enough community that even a couple active members would really make a difference.

 

r/Learnwebdev aims to help people learn web development from scratch. It’s the best place to start learning and the best place to find learning materials. However because it’s such a small community there aren’t too many new posts, maybe 3-4 per week.

It’s also built to support text questions for beginners who want to post a thread about a specific problem. But in that case you might do better asking other communities dedicated to that specific language, or posting on the main webdev subreddit.

The reason you’d join this community is for the free resources and lack of competition with new posts. You can write up a thread and it’ll stay on the front page for at least a week leaving plenty of time for others to respond.

But since it’s pretty low volume I don’t know if this will prove incredibly helpful.

13. r/Rails

 

If you wanna move beyond PHP development then you’ll probably choose between either Ruby or Python. Both languages are super popular on the web and they’re both heavily supported in most server environments.

 

And the best Ruby framework you can learn is Rails which has its own support forum brimming with advice for all skill levels.

I usually recommend Rails for anyone moving beyond PHP since the RoR framework forces you to learn best coding practices. You can find similar frameworks for Python but they just aren’t as structured or as popular.

The /r/rails community is an excellent place to ask questions and gather feedback on your project work if you choose to learn Ruby. It’s a decently sized community with 20k subscribers and new threads pop up every day.

Give it a go if you’re itching to dive into backend development and want something beyond PHP.

Now Get Coding!

Support communities are great but they’re no replacement for hard work. If you want to learn web development you’ll need to put in the hours and really practice.

Source: http://www.vandelaydesign.com/subreddits-f...