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๋ฅผ ๋ ์ง์คํฐ์ ์ฌ๋ ค์ ์คํ์์ผ์ค.