Background for threads - gon2gon2/pintos-kaist GitHub Wiki

thread์˜ ๊ธฐ๋ณธ์ ์ธ ํ๋ฆ„๋„

  • thread/init.c ์—์„œ ๋‚˜์˜ค๋Š” thread๋“ค, ๊ทธ ์™ธ์˜ ์ฝ”๋“œ๋“ค์— ์žˆ๋Š” thread๋“ค์€ ๋ชจ๋‘ ์ปค๋„ ์“ฐ๋ ˆ๋“œ์ด๋‹ค.
  • thread.c ์˜ kernel_thread : ์ธ์ž๋กœ ๋ฐ›์€ function์„ ์‹คํ–‰์‹œํ‚ด -> ๊ทธ ์ธ์ž๋Š” thread๊ฐ€ ์ข…๋ฃŒ๋  ๋–„ ๊นŒ์ง€ ์‹คํ–‰๋˜๋Š” mainํ•จ์ˆ˜์˜ ์—ญํ• ์ธ๋ฐ idle ์“ฐ๋ ˆ๋“œ๋ผ๊ณ  ๋ถˆ๋ฆฐ๋‹ค. pintos kernel ์œ„์—์„œ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๊ฐ€ ๋™์‹œ์— ์‹คํ–‰๋˜๊ฒŒ ํ•œ๋‹ค.
  • ์šฐ๋ฆฌ๊ฐ€ ํ•  ์ผ์€ ์ด idle ์Šค๋ ˆ๋“œ ์œ„์—์„œ ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ๊ฐ€ ๋™์ž‘ํ•˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ.
  • ์ปค๋„์Šค๋ ˆ๋“œ๋Š” idle ์Šค๋ ˆ๋“œ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด์„œ ์‹œ์ž‘๋œ๋‹ค.
  • thread_start์—์„œ createํ•˜๋Š” ์ˆœ๊ฐ„ idle ์Šค๋ ˆ๋“œ๊ฐ€ ์ƒ์„ฑ๋˜๊ณ  idleํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰๋œ๋‹ค.

thread_create: kernel_thread๋ฅผ ๋ ˆ์ง€์Šคํ„ฐ์— ์˜ฌ๋ ค์„œ ์‹คํ–‰์‹œ์ผœ์คŒ.

๋ฒ”์šฉ ๋ ˆ์ง€์Šคํ„ฐ?

thread์˜ ๊ตฌ์กฐ