/Linux-Kernel-Counter-Based-Clock-Algorithm

Change LRU algorithm to Counter-based clock algorithm in Linux Kernel

Primary LanguageCGNU General Public License v2.0GPL-2.0

๐Ÿ”จ How To Build the file with Makefile

Build๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ฏธ๋ฆฌ ์ž‘์„ฑํ•œ Makefile์„ ์‹คํ–‰ํ•˜๋Š” ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค.
๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ๋˜๋ฉด test์™€ test2 ํŒŒ์ผ ์ด 2๊ฐœ๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.
testํŒŒ์ผ์€ part1๋งŒ testํ•˜๋Š” ํŒŒ์ผ์ด๋ฉฐ, test2ํŒŒ์ผ์€ part1๊ณผ part2๋ฅผ ๋ชจ๋‘ testํ•  ์ˆ˜ ์žˆ๋Š” ํŒŒ์ผ์ด๋‹ค.
test์™€ test2 ํŒŒ์ผ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ตฌ์กฐ๋Š” ๊ฐ™์œผ๋ฉฐ, test2์—์„œ๋Š” ์ฃผ๊ธฐ์ ์œผ๋กœ ํŒŒ์ผ์„ scanํ•˜๊ธฐ ์œ„ํ•œ
timer๋ฅผ ํ˜ธ์ถœํ•˜๋Š” system call์„ ๋ถ€๋ฅธ๋‹ค.

$ make


โš™ How To Execute file

์ƒ์„ฑ๋œ test ์‹คํ–‰ํŒŒ์ผ์„ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ๋ช…๋ น์–ด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
<test์˜ ๊ฒฝ์šฐ>

$ ./test

<test2์˜ ๊ฒฝ์šฐ>
$ ./test2

์ด๋•Œ, test2์˜ ๊ฒฝ์šฐ์— page๋ฅผ scanํ•˜์—ฌ struct page์— ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•œ counter ๋ณ€์ˆ˜์— ์ ‘๊ทผํ•˜๊ธฐ ๋•Œ๋ฌธ์—,
์ˆ˜์ •๋œ kernel source๋ฅผ bootํ•œ ํ›„ ์‹คํ–‰ํ•ด์•ผ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•œ๋‹ค.

How To Build My Kernel

kernel.diff ํŒŒ์ผ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

workspace/sce394-linux-kernel-labs/kernel-utils/src/linux-5.15.4 ํด๋” ๋‚ด์—
kernel.diff๋ฅผ ๋ถ™์—ฌ๋„ฃ๊ธฐ ํ•œ ํ›„, ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•œ๋‹ค.
patch -p1 < /kernel.patch

์ดํ›„, workspace/sce394-linux-kernel-labs/kernel-utils ํด๋” ๋‚ด์—์„œ
./boot linux-5.15.4 ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด kernel์ด boot๋œ๋‹ค.