virtual-thread
Last updated
Was this helpful?
Last updated
Was this helpful?
#thread #virtual-thread
์ ํ๋ ๋ฉ๋ชจ๋ฆฌ ํ๊ฒฝ์์ ์ฌ์ฉํ ์ ์๋ [[os/thread]] ์ ์๊ฐ ์ ํ๋์ด์์.
๋ํ ํ์ํ ์ค๋ ๋ ์๊ฐ ์ฆ๊ฐํ๋ฉด์, [[context-switching]] ๋น์ฉ๋ ์ฆ๊ฐํจ.
์์ 2๊ฐ์ง ๋ฌธ์ ์ ์ ํด๊ฒฐํ๊ธฐ ์ํด ๋์จ ๊ฐ๋ ์ด [[virtual-thread]].
[[context-switching]] ๋น์ฉ์ด ์ ๋ ดํ๋ค
์?
platform thread
์์์ ์ฌ๋ฌ virtual thread
๊ฐ ๋ฒ๊ฑธ์๊ฐ๋ฉด์ ์คํ๋๋ ํํ
๊ธฐ์กด ๋ฐฉ์๋ณด๋ค ์ ์ ํ๋ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ด์ฆ๊ฐ ์ ๊ณ , ์ปค๋ ์์ญ์ ํธ์ถ์ด ์ ์
์ค์ผ์ฅด๋ฌ๊ฐ platform thread
๋ฅผ ๊ด๋ฆฌํ๋ค.
platform thread
๋ virtual thread
์ ์์
๋ถ๋ฐฐ๋ฅผ ๊ด๋ฆฌํ๋ค
virtual thread
๋ carrierThread
๋ฅผ ๊ฐ์ง๊ณ ์๋ค.
carrierThread
๋ platform thread
์ด๋ค.
carrierThread
๋ workQueue
๋ฅผ ๊ฐ์ง๊ณ ์๋ค.
virtual thread
๋ scheduler
๋ฅผ ๊ฐ์ง๊ณ ์๋ค.
scheduler
๋ ForkJoinPool
์ด๋ค
scheduler
๋ carrierThread
์ poll ์ด๋ค
scheduler
๋ virtual thread
์ ์ค์ผ์ฅด๋ง์ ๋ด๋นํ๋ค
virtual thread
๋ runConfiguration
์ ๊ฐ์ง๊ณ ์๋ค.
runConfiguration
์ ์ค์ ์์
๋ด์ฉ(runnable
) ์ ๊ฐ์ง๊ณ ์๋ค
virtual thread
๋ ๊ธฐ์กด platform thread
๋ฅผ ๋์ฒดํ๋ ๊ฒ์ด ๋ชฉ์ ์ด ์๋.
platform thread
์ ๊ธฐ๋ค๋ฆผ์ ๋ํ ๊ฐ์ ์ด ๋ชฉ์ .
virtual thread
๋ฅผ ๋์
ํ๋ค๊ณ ํด์, ๋ฌด์กฐ๊ฑด์ ์ผ๋ก ์ฒ๋ฆฌ๋์ด ๋์์ง์ง ์์.
๋ฆฌ์กํฐ๋ธ ํ๋ก๊ทธ๋๋ฐ๊ณผ ๋์ผํ๊ฒ '์ฒ๋ฆฌ๋' ์ ์ฆ๊ฐํ์ง๋ง ๋ ๊ฐ๋ ์ฑ์ด ์ข๊ณ , ๊ฐ๋ฐ์ ์นํ์ ์ธ ๋ฐฉ๋ฒ์ด๋ค.
https://techblog.woowahan.com/15398/
https://tech.kakao.com/2023/12/22/techmeet-virtualthread/