동기 Synchronous 와 비동기 Asynchronous
작업을 수행하는 주체에 관점
동기 Synchronous
1) 한 작업이 완전히 끝나고 난 후 순차적으로 다른 작업을 진행하는 경우
2) 두 작업의 시작 시간과 종료 시간을 같게 맞추는 경우
비동기 Asynchronous
1) 작업을 수행하는 주체의 시작과 끝나는 시간에 관계없이 각자 별도의 시작과 끝나는 시간을 가지고 있는 경우
Sync, Async와 Thread 간의 관계
Sync + Single Thread = Sequential (순차)
Sync + Multi Thread = Parallel (병렬)
Async + Single Thread = Concurrent (동시)
Async + Multi Thread = Concurrent and Parallel (동시와 병렬)
블록킹 Blocking 과 논블록킹 Non-Blocking
제어권이 어디에 있느냐에 관점
블록킹 Blocking
- 제어권이 있어야 다음 작업 수행 가능
- 제어권이 없는 상태에서는 Blocking 되며 다른 작업을 할 수 없는 상태
논블록킹 Non-Blocking
- 호출된 함수가 바로 리턴해서 호출한 함수에게 제어권을 바로 반환
- 호출한 함수가 다른 일을 할 수 있는 기회를 주는 상태
Blocking, Non-blocking과 Sync, Async의 조합
참조
https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/
https://nopanderer.github.io/cs/2021-09-17-sync-async/
https://stackoverflow.com/questions/21122842/whats-the-difference-between-synchronous-and-asynchronous-calls-in-objective-c