virtual-thread
#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
λ₯Ό λμ νλ€κ³ ν΄μ, 무쑰건μ μΌλ‘ μ²λ¦¬λμ΄ λμμ§μ§ μμ.리μ‘ν°λΈ νλ‘κ·Έλλ°κ³Ό λμΌνκ² 'μ²λ¦¬λ' μ μ¦κ°νμ§λ§ λ κ°λ μ±μ΄ μ’κ³ , κ°λ°μ μΉνμ μΈ λ°©λ²μ΄λ€.
Reference
https://techblog.woowahan.com/15398/
https://tech.kakao.com/2023/12/22/techmeet-virtualthread/
Last updated
Was this helpful?