´ÙÀ½ ÀÌÀü Â÷·Ê

5. ¸®¾óŸÀÓ ¸®´ª½º

Áö±ÝºÎÅÍ ¼Ò°³ÇÒ ³»¿ëÀº RT-Linux¶ó°í ºÒ¸®´Â °ÍÀ¸·Î¼­ ¸ÖƼŽºÅ· OS¿¡¼­ ÇØ°áÇϱâ Èûµç ¸®¾ó ŸÀÓ(Real-Time) Áö¿øÀ» ¸®´ª½º¿¡ °¡Á®¿Â µ¶Æ¯ÇÑ ÇÁ·ÎÁ§Æ®ÀÌ´Ù. ÀϹÝÀûÀ¸·Î ¼±Á¡Çü ¸ÖƼŽºÅ· ½Ã½ºÅÛ¿¡¼­ Á¤È®ÇÑ ½Ã°£ Áֱ⸦ °¡Áö°í ÀÏÀ» ÇØ¾ß ÇÏ´Â ÇÁ·Î¼¼½º¿¡°Ô Ä¿³ÎÀÌ Á¤È®ÇÑ Å¸À̹ÖÀ» ¸ÂÃçÁشٴ °ÍÀº °ÅÀÇ ºÒ°¡´ÉÇÑ ÀÏó·³ º¸ÀδÙ.

°ÅÀÇ ´ëºÎºÐÀÇ ÀÛ¾÷µé(¿¹¸¦ µé¾î ¿öµå ÇÁ·Î¼¼½Ì, À¥ ºê¶ó¿ì¡ µî)Àº ªÀº ½Ã°£ °£°Ý, Á¤È®ÇÑ ÁÖ±â¿Í´Â º° »ó°ü¾ø´Â °ÍµéÀÌ´Ù. ¸÷½Ã ºÎÇÏ°¡ °É·Á ¿öµå ÇÁ·Î¼¼¼­¿¡°Ô ³Ñ°ÜÁ®¾ß ÇÒ Á¦¾î±ÇÀÌ Àá½Ã Áö¿¬µÈ´Ù´ø°¡ Çؼ­ ¿öµå ÀÛ¾÷À» ¸ÁÄ¡°Å³ª ÇÏÁö´Â ¾Ê´Â´Ù. ³×Æ®¿öÅ© »çÁ¤ ¶§¹®¿¡ ¸ØÃß±â ÀϾ¥ÀÎ ºê¶ó¿ì¡ ÀÛ¾÷ÀÌ 1-2 ÃÊ ´Ù¸¥ ÀÛ¾÷¿¡ ÀÇÇØ ¸ØÃçÁø´Ù Çصµ ¹®Á¦µÉ °ÍÀº ¾ø´Ù.

ÇÊÀڷμ­´Â Á¤È®ÇÑ Áֱ⸦ °¡Áö°í ½Ã±×³ÎÀ» º¸³»¾ß ÇÑ´ÙµçÁö ÇÏ´Â Áß¿äÇÑ ÀÛ¾÷¿¡ ¾î¶² ÀÏÀÌ ÀÖ´ÂÁö Àß »ó»óÀÌ ¾ÈµÇÁö¸¸ ¾îÂî µÇ¾úµç ½Ç½Ã°£ Áö¿ø OS¿¡ ´ëÇÑ Á߿伺À» ºü¶ß¸± ¼ö ¾ø´Â °Í Áß Çϳª¶ó°í ÇÑ´Ù. ÀÌ ¹®Á¦¸¦ ¸®´ª½º¿¡¼­ ÇØ°áÇؾ߸¸ °üÂû/°¨½Ã Ä«¸Þ¶ó, ·Îº¿ ¶Ç´Â ¿©·¯ °úÇÐ °ü·Ã µµ±¸µéÀ» ¸®´ª½º¸¦ ¿î¿µÇÏ´Â PC¿¡ ¿¬°áÇÏ¿© È°¿ëÇÏ´Â °ÍÀÌ °¡´ÉÇØÁø´Ù.

¸®´ª½º¿¡¼­ Á¤È®ÇÑ Å¸À̹ÖÀÌ ÀÌ·ïÁöÁö ¾Ê´Â ¼ø°£¿¡ ´ëÇؼ­ ¼­¼úÇ϶ó¸é ¸Ö¸®¼­ ãÁö ¾Ê¾Æµµ µÈ´Ù. ¿©·¯ºÐÀº ´ëºÎºÐ µ¢Ä¡µµ Å©°í ¶ß´Âµ¥ ½Ã°£µµ ¸¹ÀÌ °É¸®´Â ³Ý½ºÄÉÀÌÇÁ¸¦ ¸®´ª½º/X À©µµ¿¡¼­ ¶ç¿öº» ÀûÀÌ ÀÖÀ» °ÍÀÌ´Ù. ¶ß´Â µ¿¾È ¸¶¿ì½º Á¶Â÷ ¿òÁ÷ÀÏ »ý°¢À» ÇÏÁö ¾Ê°í ¸ðµç ÇÁ·Î±×·¥µéÀÌ Çì¸Å´Â ¸ð½ÀÀ» ½±°Ô È®ÀÎÇÒ ¼ö ÀÖ´Ù.

5.1 ¼ÒÇÁÆ® ¸®¾ó ŸÀÓ Áö¿ø

¾î¶°ÇÑ ÆÐÄ¡ ¾øÀÌ Ç¥ÁØ Ä¿³Î ¾È¿¡ µé¾îÀÖ´Â ¸®¾ó ŸÀÓ Áö¿øÀ» »ç¿ëÇÏ´Â °ÍÀ» ¼ÒÇÁÆ® ¸®¾ó ŸÀÓ Áö¿øÀ̶ó°í ºÎ¸£°í ÀÖ´Ù. Ä¿³Î ÄÄÆÄÀÏ ¼³Á¤½Ã ¹®ÀÚ ÀåÄ¡(Character Devices)-->Enhanced Real Time Clock Support¸¦ ¼³Á¤ÇÏ°í ³ª¼­ Ä¿³Î ÄÄÆÄÀÏÀ» Çغ¸µµ·Ï ÇÏÀÚ. ±×¸®°í ³ª¼­ ¸ÞÀÌÀú ¹øÈ£ 10, ¸¶ÀÌ³Ê ¹øÈ£ 135ÀÇ ¹®ÀÚ ÀåÄ¡ ÆÄÀÏ /dev/rtc ÆÄÀÏÀ» ¸¸µç´Ù.

# mknod /dev/rtc c 10 135

[yong@freeyong 9705]$ cat /proc/interrupts
 0:  2859962  timer
 1:   140285  keyboard
 2:     0  cascade
 3:  1447093 + serial
 4:     1 + serial
 5:     1  sound blaster
 8:     0 + rtc
10:    430 + aic7xxx
12:   202636  PS/2 Mouse
13:     1  math error
14:   252100 + ide0
15:   421489 + ide1

¸®¾ó ŸÀÓ Áö¿ø ±â´ÉÀ» °®´Â Ä¿³Î·Î ºÎÆÃÇÏ°í ³ª¼­ ÀÎÅÍ·´Æ® »ç¿ë ÇöȲÀ» »ìÆ캸¸é 8¹ø ÀÎÅÍ·´Æ®¸¦ rtc ±â´É¿¡¼­ »ç¿ëÇÏ°í ÀÖ´Ù´Â °ÍÀ» º¼ ¼ö ÀÖ´Ù.

ÀÚ, ¸®´ª½º ¼ÒÇÁÆ® ¸®¾ó ŸÀÓ Áö¿øÀ» ½ÃÇèÇغ¸±â À§ÇÑ ÇÁ·Î±×·¥À» Çϳª ±¸ÇØ¿Í¾ß ÇÑ´Ù. ´ÙÀ½Àº ¹Ù·Î ¸®´ª½º Ä¿³Î ³»ºÎ ±â´ÉÀ» »ç¿ëÇÏ´Â rt ¶ó´Â ÇÁ·Î±×·¥ ½ÇÇà±âÀÇ LSM(Linux Software Map) ÆÄÀÏÀÌ´Ù.

Legin3
Title:          rt - run program on realtime priority
Version:        1.0
Entered-date:   12 Jan 1997
Description:    rt starts any program on realtime priority, like nice
                does with lower priority. Lets you choose scheduler
                class (SCHED_RR vs SCHED_FIFO policy) and priority.
Keywords:       linux, real time, scheduler
Author:         Boris Tobotras <boris@xtalk.msk.su>
Maintained-by:  Boris Tobotras <boris@xtalk.msk.su>
Primary-site:   sunsite.unc.edu /pub/Linux/system/Admin
                10 kb rt-1.0.tar.gz
Alternate-site: ftp.macsimum.ru /pub/Linux/local
                10 kb rt-1.0.tar.gz
Platform:       Linux 1.3.87 and later
Copying-policy: GPL
End

¼Ò½º¸¦ °¡Á®¿Í ÄÄÆÄÀÏÇÏ°í ¼³Ä¡ÇÏ´Â °úÁ¤À» ¼Ò°³ÇÒ ÇÊ¿ä¾øÀÌ ¾ÆÁÖ °£´ÜÇÏ´Ù. °á°ú·Î ³ª¿À´Â ¹ÙÀ̳ʸ®¸íÀº rtÀÌ´Ù.

Usage: rt [options] command

Recognized options are:
    -r  Use SCHED_RR scheduling policy (default);
    -f  Use SCHED_FIFO scheduling policy;
    -p  N Set priority level N. If N<0, set priority level
        to sched_get_priority_min(POLICY)-N.
        Default is (sched_get_priority_max()+sched_get_priority_min())/2;
    --  End of options;
    -v  Be verbose;
    -h  This help screen.

Áö±ÝÀº splay¿Í °°Àº ÈǸ¢ÇÑ MPEG Layer3 Ç÷¹À̾ ³ª¿ÔÀ¸¹Ç·Î »ç¿ëÇÒ ÇÊ¿ä°¡ ¾ø¾îÁ³Áö¸¸ ½ÃÇè»ó ¿¹Àü¿¡´Â ¹ÙÀ̳ʸ®·Î¸¸ ÁÖ¾îÁø ¼Î¾î¿þ¾î ¹öÀüÀÇ mp3play¸¦ »ç¿ëÇÑ ÀûÀÌ ÀÖ¾ú´Ù. mp3play´Â »ç½Ç ½ºÅ©¸³Æ®¿¡ ºÒ°úÇÏ°í l3dec¶ó´Â ÇÁ·Î±×·¥°ú wavplay¸¦ ºÒ·¯´Ù »ç¿ëÇÏ¿´´Ù. ¹®Á¦´Â ÆæƼ¾ö 120 À̻󿡼­µµ Á¶±Ý¸¸ ´Ù¸¥ ÇÁ·Î¼¼½º°¡ µ¿ÀÛÇÑ´ÙµçÁö ÇÒ ¶§´Â ½ÉÇÏ°Ô À½ÀÌ ²÷±â´Â °ÍÀ̾ú´Ù. ¼Ò½º Äڵ尡 °ø°³µÇ¾î ÀÖÁö ¾ÊÀ¸¹Ç·Î º°´Ù¸¥ ÇØ°á ¹æ¹ýÀ» ãÁö ¸øÇÏ´Ù°¡ rt¶ó´Â ÇÁ·Î±×·¥À» ¾Ë°Ô µÇ¾ú°í ¸®´ª½º Ä¿³Î¿¡ ÀÌ¹Ì ¾î´À Á¤µµÀÇ ¸®¾ó ŸÀÓ Áö¿øÀÌ µé¾îÀÖ¾ú´Ù´Â °ÍÀ» ±×Á¦¼­¾ß ¾Ë°Ô µÇ¾ú´Ù.

rt [¿É¼Çµé] -- <¸®¾óŸÀÓ Áö¿øÀ» ¿øÇÏ´Â ¸í·É>
( À§¿¡¼­ -- ´Â rt¿¡ ´ëÇÑ ¿É¼ÇÀÇ ³¡ÀÓÀÏ ¾Ë¸°´Ù )

ÀÌ·¸°Ô ¼öÇà½ÃÅ°¸é ¿¹¸¦ µé¾î mp3playÀÇ °æ¿ì ³Ý½ºÄÉÀÌÇÁ¿Í °°Àº ÇÁ·Î±×·¥ÀÌ ½ÃÀÛÇصµ rt¸¦ ÅëÇØ ¼öÇà½ÃŲ ÇÁ·Î¼¼½º¿¡°Ô »ó´çÇÑ ¿ì¼±±ÇÀÌ ºÎ¿©µÇ¾î ÀÖÀ¸¹Ç·Î ÀüÇô ²÷±âÁö ¾Ê´Â Çö»óÀ» ¸ñ°ÝÇÒ ¼ö ÀÖ¾ú´Ù. ·çÆ® »ç¿ëÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ´Ù. ´ç¿¬È÷ ÇÑ ÇÁ·Î¼¼½º¿¡ ´ëÇÏ¿© Ưº°ÇÑ ¿ì¼±±ÇÀÌ ÁÖ¾îÁ³´Ù´Â °ÍÀº ÀüüÀûÀ¸·Î ´Ù¸¥ ÇÁ·Î¼¼½ºµé¿¡°Ô ¾Ç¿µÇâÀÌ °£´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù.

5.2 ÇÏµå ¸®¾ó ŸÀÓ Áö¿ø

ÇöÀç ¸®´ª½º Ä¿³Î ¾È¿¡¼­ ±âº»ÀûÀ¸·Î Á¦°øÇÏ°í ÀÖ´Â ¸®¾ó ŸÀÓ Áö¿øÀ» ¼ÒÇÁÆ®¶ó°í ºÎ¸£´Â °ÍÀº Michael Barabanov¾¾¿Í Victor Yodaiken¾¾ÀÇ RT-Linux ÇÁ·ÎÁ§Æ®¿¡ ´ëÇÑ »ó´ëÀûÀÎ °³³äÀ¸·Î¼­ ±×·¸°Ô ºÎ¸£´Â °ÍÀÌ´Ù. Ä¿³Î ÆÐÄ¡ÀÇ ÇüÅ·ΠÁÖ¾îÁö´Â RT-Linux´Â ´õ¿í ´õ °­·ÂÇÑ ÇüÅÂÀÇ ¸®¾ó ŸÀÓ Áö¿øÀ» ÇØÁÖµµ·Ï ¸®´ª½º Ä¿³Î ±¸Á¶¿¡ ¾à°£ÀÇ º¯È­¸¦ ÁØ °ÍÀÌ´Ù. °ü·Ã »çÀÌÆ®´Â ´ÙÀ½°ú °°´Ù. luz.cs.nmt.edu/~rtlinux/ ¿©·¯ºÐÀº ¿©±â¼­ ÀÏ´Ü Ä¿³Î 2.0.27¿¡ ´ëÇÑ ÆÐÄ¡ Çü½ÄÀ¸·Î µÈ rtlinux-0.5.tgz ÆÄÀÏÀ» ¹Þ¾Æ¿Í¾ß ÇÑ´Ù. Ä¿³Î 2.0.29¿¡ ´ëÇؼ­´Â À¥ ÆäÀÌÁö¿¡¼­ º°µµÀÇ ÆÐÄ¡ ÆÄÀÏÀ» ¹Þ¾Æ¿À¸é µÈ´Ù. ÆÄÀÏÀ» Ç®¾îº¸¸é rtlinux-0.5¶ó´Â µð·ºÅ͸®°¡ ¸¸µé¾îÁö°í kernel_patch¶ó´Â ÆÄÀÏÀ» Çϳª º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ±× ÆÄÀÏÀ» /usr/src µð·ºÅ͸® ¹ØÀ¸·Î º¹»çÇÑ´Ù. ·¹µåÇÞ 4.1 »ç¿ëÀÚ¶ó¸é ÀÌ¹Ì Ä¿³Î ¹öÀüÀº 2.0.27 ÀÏ °ÍÀÌ´Ù.

cd /usr/src/linux
patch -p2 < ../kernel_patch

patch ÇÁ·Î±×·¥¿¡ -p2 ¿É¼ÇÀ» ÁÖ´Â °Í¿¡ À¯ÀÇÇÏÀÚ.

make config
make dep ; make clean
make zlilo
make modules ; make modules_install

ÀϹÝÀûÀÎ Ä¿³Î ÄÄÆÄÀÏ °úÁ¤À» ¸¶Ä¡°í ³ª¸é /lib/modules/2.0.27/misc µð·ºÅ͸®¿¡ rt_prio_sched.o ¶ó´Â ¸ðµâ ÆÄÀÏÀÌ Çϳª »ý±ä´Ù. ¸®¾óŸÀÓ Áö¿øÀ» »ç¿ëÇÏ·Á¸é ¹Ù·Î Àú ¸ðµâÀ» ·ÎµùÇØÁÖ¾î¾ß ÇÑ´Ù.±×¸®°í ³ª¼­ rt_fifo_new.o ¸ðµâµµ ·ÎµùÇÑ´Ù.

modprobe rt_prio_sched.o
modprobe rt_fifo_new.o

[root@freeyong /root]# lsmod
Module        Pages      Used by
rt_fifo_new     2      [rt_process]  0
rt_prio_sched   1                    0
sbpcd          14                    1
aic7xxx        10                    0
bsd_comp        1                    0
ppp             5      [bsd_comp]    1
slhc            2      [ppp]         1
lp              2                    0

¸ðµâÀÌ ·ÎµùµÇ¸é ¸®´ª½º Ä¿³Î°ú Çϵå¿þ¾î ·¹º§ »çÀÌ¿¡ ¸®¾ó ŸÀÓ Ä¿³ÎÃþÀ» ³¢¿öÁö°Ô µÇ¾î µÑ °£ÀÇ Ã³¸®¸¦ Áß°£¿¡ °¡·Îä¾î ó¸®ÇÏ°Ô µÇ´Â ÇüÅÂÀÌ´Ù. ±× ´ÙÀ½¿¡ ÇØÁÖ¾î¾ß ÇÏ´Â ÀÏÀº /dev µð·ºÅ͸®¿¡ ÀûÀýÇÑ ÀåÄ¡¸¦ ¸¸µå´Â ÀÏÀÌ´Ù. ¹è½Ã »ç¿ëÀÚ¶ó¸é ¸í·ÉÇà¿¡¼­ ´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇØÁÖ¸é µÈ´Ù.

for i in 0 1 2 3; do mknod /dev/rtf$i c 63 $i; done

ÆæƼ¾ö 120 ¸Ó½Å¿¡¼­ RT-Linux´Â 150 ¸¶ÀÌÅ©·ÎÃÊ ¼öÁØÀÇ Á¤È®µµ¸¦ °¡Áö°í ½ºÄÉÁ층À» ÇØÁÙ ¼ö ÀÖ´Ù°í ÇÑ´Ù.

¿©·¯ºÐÀÇ ½Ã½ºÅÛ¿¡ ¸®¾ó ŸÀÓ Áö¿øÀÌ ÇÊ¿äÇÑ°¡? ´ëºÎºÐÀÇ »ç¶÷µé¿¡°Ô´Â ¹°·Ð ³í¿ÜÀÇ ¹®Á¦ÀÏ °ÍÀÌ´Ù. ±×¸®°í ¼ÒÇÁÆ® ¸®¾ó ŸÀÓ Áö¿ø¸¸À¸·Îµµ ÃæºÐÇÒ °ÍÀ̶ó°í º»´Ù.

5.3 Å×½ºÆ® Çغ¸±â

rtlinux-0.5 µð·ºÅ͸®¿¡ º¸¸é testingÀ̶ó´Â µð·ºÅ͸®¸¦ º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù. °¢ µð·ºÅ͸®ÀÇ README¸¦ Àо°í Å×½ºÆÃÀ» Çغ¸±â ¹Ù¶õ´Ù. sound µð·ºÅ͸®¿¡ ÀÖ´Â ¿¹¸¦ ½ÇÇàÇغ¸¸é ¸®¾ó ŸÀÓ Áö¿øÀÌ ¾î¶°ÇÑÁö °¨À» ÀâÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÇÊÀÚ°¡ ±ÛÀ» ¾²°í ÀÖ´Â ¼ø°£ rtlinux-0.5 ¹öÀü ÆÐÅ°Áö¿¡ µç ¼Ò½º´Â Á¦´ë·Î µ¿ÀÛÇÏÁö ¾ÊÀ¸¹Ç·Î À¥ ÆäÀÌÁö¿¡¼­ ÆÐÄ¡ÆÄÀÏÀ» °¡Á®¿Í¼­ ÆÐÄ¡ÇÑ ÈÄ ÄÄÆÄÀÏÇØ¾ß ÇÑ´Ù. sound µð·ºÅ͸® ±× À§Ä¡¿¡¼­ patch < soundpatch ÇÏ°í ³ª¼­ README¿¡ µû¶ó Å×½ºÆ®Çغ»´Ù.

¸®´ª½º¸¦ âÁ¶·ÂÀ» °¡Áö°í µµÀüÇÏ´Â »ç¶÷µé·Î ÀÎÇØ ±× ºûÀ» ¹ßÈÖÇÏ´Â °ÍÀ̶ó´Â »ý°¢ÀÌ µç´Ù.


´ÙÀ½ ÀÌÀü Â÷·Ê