<Consistency Model>

Shared Memory System (예를들면 Multi-processor)에서 만날수 있는 개념인데

Consistency Model 자체의 설명은 너무 추상적이라서 이해하기 어렵다


그래서 필자는 Sequential Consistency Model을 특정하여 작성하고자 한다

아래 위키를 참조했다

https://en.wikipedia.org/wiki/Sequential_consistency


<Sequential Consistency Model>

Sequential Consistency model은 Multi-processor의 Multi-thread와 비슷하므로 좀더 이해하기 쉬울 것이다

이것은 Consistency Model의 한 종류일 뿐일지라도, Consistency Model에 대한 이해를 쉽게 만들어줄 수 있을것이다


일반 PC에서 Multi-thread 동작을 생각해보자.

A, B라는 2개의 스레드가 있을 때, 각 스레드 내의 실행 순서는 보장된다

A: A1 -> A2 -> A3

B: B1 -> B2 -> B3

Sequential Consistency Model, 즉 실행순서의 일관성을 보장하는 모델이다

그러나 A 스레드와 B 스레드 사이의 실행 순서는 보장되지 않는다 (오직 각 프로세서 내에서만 보장)


<Consistency Model 필요성>

wiki 글 일부를 인용하면

The data consistency model specifies a contract between programmer and system, wherein the system guarantees that if the programmer follows the rules, memory will be consistent and the results of reading, writing, or updating memory will be predictable.

데이터 consistency 모델은 프로그래머와 시스템 사이의 계약을 specify한다

시스템은, 프로그래머가 룰을 지킬 경우 메모리가 consistent하고 메모리의 reading/writing/updating의 결과가 예측가능함을 보장한다


즉 프로그래머에게 편의성을 제공하는 것이다. memory operation 결과가 일관성있음(예측가능함)으로써 거기에 기반하여 프로그램을 문제없이 작성할수 있게된다.

다시 Sequential Model로 돌아가면, A3가 실행되었다는 것은 A1, A2가 실행되었다는 것을 보장받을 수 있다.


<Consistency Model vs Cache Coherence>

종종 Consistency Model은 Cache Coherence와 혼동되는데, 서로 다른개념이다

Cache Coherence는 단일 변수에 대한 멀티프로세서의 access 관점이지만

consistency model은 여러 location에 대한 access 순서에 대하여 처리한다는 점이 차이이다



'etc' 카테고리의 다른 글

[git] submodule 최신버전으로 업데이트  (0) 2017.12.12
[term] System  (0) 2017.12.11
[Database] Transaction / ACID  (0) 2017.12.10
HTTP state code 2xx, 4xx, 5xx  (0) 2017.12.10
[OS] process vs thread (그리고 병렬처리 관점)  (0) 2017.12.10

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/