동시성과 병렬성

SangHun Park·2022년 8월 22일
0

Parallelism

doing many things at the same time

Concurrency

doing many things, but only one at a time "multitasking"

Context Switch를 통해 처리된다.

Data Race

공유 변수에 대한 처리를 동시적으로 수행할 경우 데이터 경쟁이 발생될 수 있다.

go 언어에서 경쟁 상태 메시지 확인

go run -race main.go

Mutex

mutual exclusion object

Data Race가 발생될 경우를 Mutex(상호 배제)를 사용하여 회피 할 수 있다.

Atomicity

Data Race를 회피 할 수 있는 수단 중 하나
처리 결과가 순차적이지 않을 수 있다.

참조

https://www.udemy.com/course/golang-programming

0개의 댓글