본문 바로가기
Java

[Java] 동기(Sync) vs 비동기(Async) :: 블록킹(Blocking) vs 논블록킹(Non-Blocking)

by 파인스코어 2023. 4. 22.
728x90

동기 Synchronous 와 비동기 Asynchronous

https://www.linkedin.com/pulse/sync-async-connectivity-explained-zolt%C3%A1n-simon/?trk=read_related_article-card_title

 

작업을 수행하는 주체에 관점

동기 Synchronous

https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/

1) 한 작업이 완전히 끝나고 난 후 순차적으로 다른 작업을 진행하는 경우

https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/

2) 두 작업의 시작 시간과 종료 시간을 같게 맞추는 경우

 

비동기 Asynchronous

https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/

1) 작업을 수행하는 주체의 시작과 끝나는 시간에 관계없이 각자 별도의 시작과 끝나는 시간을 가지고 있는 경우

 

Sync, Async와 Thread 간의 관계

Sync + Single Thread = Sequential (순차)

https://stackoverflow.com/questions/21122842/whats-the-difference-between-synchronous-and-asynchronous-calls-in-objective-c

Sync + Multi Thread = Parallel (병렬)

https://stackoverflow.com/questions/21122842/whats-the-difference-between-synchronous-and-asynchronous-calls-in-objective-c

Async + Single Thread = Concurrent (동시)

https://stackoverflow.com/questions/21122842/whats-the-difference-between-synchronous-and-asynchronous-calls-in-objective-c

Async + Multi Thread = Concurrent and Parallel (동시와 병렬)

https://stackoverflow.com/questions/21122842/whats-the-difference-between-synchronous-and-asynchronous-calls-in-objective-c

블록킹 Blocking 과 논블록킹 Non-Blocking

제어권이 어디에 있느냐에 관점

블록킹 Blocking

https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/

  • 제어권이 있어야 다음 작업 수행 가능
  • 제어권이 없는 상태에서는 Blocking 되며 다른 작업을 할 수 없는 상태

논블록킹 Non-Blocking

https://devwhkang.gatsbyjs.io/posts/async-sync-blocking-non-blocking/

  • 호출된 함수가 바로 리턴해서 호출한 함수에게 제어권을 바로 반환
  • 호출한 함수가 다른 일을 할 수 있는 기회를 주는 상태

Blocking, Non-blocking과 Sync, Async의 조합

https://nopanderer.github.io/cs/2021-09-17-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

728x90

'Java' 카테고리의 다른 글

[Java] JdbcTemplate.queryForObject의 오해  (0) 2023.11.14