Skip to content

Instantly share code, notes, and snippets.

@xodhx4
Created April 2, 2020 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xodhx4/b9c61d8c85d6889f8f5929fb839ea140 to your computer and use it in GitHub Desktop.
Save xodhx4/b9c61d8c85d6889f8f5929fb839ea140 to your computer and use it in GitHub Desktop.
Markdium-JS 초보가 쓰는 async await 처음부터 이해하기
future = excutor.submit(open, "example.txt", "r") // Non-Blocking IO로 IO 작업 시작
some_cpu_job1() // cpu 작업이 IO작업이 끝나기 전에 끝난다
some_cpu_job2() // 이 시점에서 IO 작업이 끝났다면
some_cpu_job3() // 그럼에도 불구하고 이 cpu 작업을 기다려야 한다
f = future.result() // 출력이 Blocking일 때보다 늦어진다 -> 응답성이 떨어진다
print(f.readline())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment