ããã»ã¹ã»ãã¤ãã»ãªãã¤ã¬ã¯ã·ã§ã³ã»ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã®å®ä½ãè¦ã«è¡ã
ããã»ã¹ç½®ãæãã¨ããååä»ããã¤ãã¨ããã¨ã¦ã便å©ãªæ©è½ãªã®ã ãã©ããã®ä»çµã¿ã¯ã©ããªã£ã¦ããã®ã ããï¼æççãªç¥èã°ããã§ã¯ããã®æ ¸å¿ã«ã¯ãªããªã辿ãçããªãããµã³ãã«ã³ã¼ãã®çä¼¼ã¯ã§ãããã©ããã以ä¸ã®çºæ³ã¯ã§ããªã...ããã£ã¨æ ¹æ¬çãªã¨ããããã¡ããã¨ç解ãã¦ãããªãã¨ããã¤ã¾ã§ãã£ã¦ãã³ãã³ãã®ä½¿ãæ¹ã®æ¬è³ªãç解ã§ããªãã¨æãããããã»ã¹ã¨ã¯ä½ãï¼ãã¤ãã¨ã¯ä½ãï¼ãªãã¤ã¬ã¯ã·ã§ã³ã¨ã¯ä½ãï¼ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã¨ã¯ä½ãï¼å¯è½ãªéããã®æ¬è³ªãæ¢ã£ã¦ã¿ããã¨æãã
UNIXã®ããã»ã¹
- UNIXã§ã¯ãè¤æ°ã®ã¦ã¼ã¶ã¼ããã°ã¤ã³ããç¶æ ã§ãåæã«è¤æ°ã®å¦çãä¾é ¼ãããç¶æ³ãå¤ã ããã
- ã¨ããããã©ããªã«é«æ§è½ãªCPUã§ãã£ã¦ããããç¬éã«å¦çã§ããã®ã¯ãã£ã1ã¤ã®å¦çã ãã§ããã
- ãããªæOSã¯ãããããã®å¦çã«å¿ è¦ãªã¡ã¢ãªé åãå²ãå½ã¦ã¦ãCPUãã¿ã¤ãã³ã°ããåãæ¿ããªããåæ並è¡çã«å¦çãé²ããã®ã ã
- CPUã®å¦çé度ã«å¯¾ãã¦ããã¡ã¤ã«ããããã¯ã¼ã¯çã¸ã®ã¢ã¯ã»ã¹ã¯é常ã«é ããCPUã«ã¯é·ãå¾ ã¡æéãçºçãã¦ãã¾ãã
- ãã®å¾ ã¡æéãå©ç¨ãã¦ãå¹çããä»ã®å¦çã«åãæ¿ãã¦ãå¦çãé²ãã¦ããã®ã ãï¼ãã«ãã¿ã¹ã¯ï¼
- ããªç§åä½ã®æéã§ãã£ã¦ããåä½å¨æ³¢æ°1GHzã®CPUã«ã¨ã£ã¦ã¯100ä¸ã¹ãããã®å¦çãå®è¡ã§ããã
- ä¸ç¬ã®å¾ ã¡æéãæå¹ã«æ´»ç¨ãããã¨ã§ã人éã®ç®ã«ã¯ã¾ãã§åæã«å¦çããã¦ããããã«è¦ããã®ã ã
- ãã®ããã«ãã¦CPUãåãæ¿ããªããå®è¡ããå¦çã®1åä½ãããã»ã¹ã¨å¼ãã§ããã
- ä¾ãã°ãããã³ãã³ããå®è¡ããã¨...
- ãã¡ã¤ã«ã«ä¿åãããå®è¡ã³ã¼ããã¡ã¢ãªã«èªã¿è¾¼ã¾ãã¦ã
- ãã®å¦çã«å¿ è¦ãªã¡ã¢ãªé åã確ä¿ããã¦ã
- CPUã®å©ç¨æéãå²ãæ¯ãããã
- ãããããã»ã¹ã¨ãã¦èªèããã¦ãããã®ã®å®ä½ã§ããã
- OSã¯ããã»ã¹ã«éè¤ããªãçªå·ãå²ãå½ã¦ãããã»ã¹ç®¡çãã¼ãã«ã«å¿ è¦ãªæ å ±ãè¨é²ããªããã管çããã
ããã»ã¹ã®ç¶æ
- åºæ¬çã«ã¯CPUã®å¾ ã¡æéãè¦è¨ãã£ã¦ãã«ãã¿ã¹ã¯ãå®ç¾ã§ããã¨ç¡é§ããªãã®ã ãã
- ããã»ã¹ã«ãã£ã¦ã¯CPUã®å¾ ã¡æéãã»ã¨ãã©çºçããªãç¶æ³ãããããã
- CPUã®å¾ ã¡æéããªãã¦ããOSã¯ä¸å®æéçµéå¾ããã»ã¹ãä¸æåæ¢ãã¦ãOSã«å¿ è¦ãªå¦çãå®è¡ããã
- ã¾ãããã®ä»ã®ããã»ã¹ã«ãå¦çã«è¦åã£ãCPUå©ç¨æéãå²ãå½ã¦ããã«ãã¿ã¹ã¯ãå®ç¾ãããã¨ããã
- ããããªãã¨ãä»®ã«1åéãã«ã«CPUã使ãç¶ããããã»ã¹ããã£ãã¨ããã¨ããã以å¤ã®å¦çãå®å ¨ã«æ¢ã¾ã£ã¦ãã¾ãã®ã§ã
- 以ä¸ã®ãã¨ãèããã¨ãããã»ã¹ã«ã¯å¤§ããåãã¦3ã¤ã®ç¶æ ããããã¨ãåããã
Running | å®è¡ç¶æ | OSããCPUã®å©ç¨æéãå²ãå½ã¦ããã¦ãå®è¡ããã¦ããç¶æ |
---|---|---|
Waiting | å¾ ã¡ç¶æ | å¤é¨æ©å¨ã¸ã®ã¢ã¯ã»ã¹çã®ãããå¾ ã¡æéãçºçãã¦ãOSããCPUã®å©ç¨ããããã¯ï¼é¤å¤ï¼ããã¦ããç¶æ |
Ready | å®è¡å¯è½ç¶æ | ãã¤ã§ãå®è¡å¯è½ã§ãããOSããCPUã®å©ç¨æéãå²ãå½ã¦ãããã®ãå¾ ã£ã¦ããç¶æ |
ããã»ã¹ã®å¤é¨ã¢ã¯ã»ã¹
- ããããã®ããã»ã¹ã¯å®å ¨ã«ç¬ç«ããåå¨ã§ãããOSã«å²ãå½ã¦ãããã¡ã¢ãªé å以å¤ã¸ã®ã¢ã¯ã»ã¹ã¯ç¦æ¢ããã¦ããã
- ã¨ããã§ãããã»ã¹ãæ´»åããããã«ã¯ãæ
å ±ã®å
¥åã¨åºåãå¿
è¦ã§ããã
- ãã¼ãã¼ãããã®æ å ±ãåãåã£ã¦ãå¦çã®çµæãç»é¢ã¸åºåãããã
- ãããã¯ãã¡ã¤ã«ããèªã¿è¾¼ãã§ããã¡ã¤ã«ã«åºåãããããããªãã
- CPUãå¤é¨æ©å¨ã¨æ
å ±ãããåãããã«ã¯ãå¤é¨æ©å¨ã¨é£åããç¹æ®ãªã¡ã¢ãªé åï¼I/Oé åï¼ã¸ã¢ã¯ã»ã¹ãããã¨ã§å®ç¾ãã¦ããã
- ç»é¢åºåã¯VRAMé åã«æ¸ãè¾¼ãã ãããã¼å ¥åã¯ãã¼ã«åå¿ããI/Oé åãèªã¿åããã¨ã§å¯è½ã«ãªãã
- ããããCPUãå¤é¨ã¨ã¤ãªããæ段ã¯ãã¡ã¢ãªé åãããªãã®ã ã
- ããããUNIXã«ããã¦ã¯ãã¦ã¼ã¶ã¼ã®ããã»ã¹ãI/Oé åãç´æ¥ã¢ã¯ã»ã¹ãããã¨ã¯ã§ããªãã
- ããããã¦ã¼ã¶ã¼ã®ããã»ã¹ã«å²ãå½ã¦ãããã¡ã¢ãªé åã«ãI/Oé åã¯å«ã¾ããªãã
- ãã®ãããOSã«ã¯ãã©ã¤ãã¨ãããå¤é¨æ©å¨ã«ã¢ã¯ã»ã¹ããããã®ããã°ã©ã ãçµã¿è¾¼ã¾ãã¦ããã
- ãã®ãã©ã¤ããçµç±ãã¦ãå¤é¨æ©å¨ã¨æ å ±ãããåãããã®ã ã
- ãã©ã¤ãã¯ãå¤é¨æ©å¨åºæã®åãæ±ãæ¹æ³ã®å·®ç°ãå¸åãã¦ãããã
- ãã©ã¤ãã«ãã£ã¦ããã¹ã¦ã®å¤é¨æ©å¨ã¯ãä¸è¬çãªãã¡ã¤ã«ã¨åãæ¹æ³ã§ã¢ã¯ã»ã¹å¯è½ã«ãªãã®ã ã
- å ·ä½çã«ã¯ãããã¤ã¹ãã¡ã¤ã«ï¼/dev/*ï¼ãå©ç¨ãããã¨ã§ãå¤é¨æ©å¨ã«ã¢ã¯ã»ã¹ã§ããã
- ããããããã»ã¹ã¯OSã«å²ãå½ã¦ãããã¡ã¢ãªé åããã¢ã¯ã»ã¹ã§ããªãã®ã§ããã¡ã¤ã«ã¢ã¯ã»ã¹ããã許å¯ããã¦ããªãã
- ä»ããã¡ã¤ã«ã¢ã¯ã»ã¹ããã§ããã°ããã¹ã¦ã®å¤é¨æ©å¨ã¸ã¢ã¯ã»ã¹ã§ããã¨ããã®ã«ãããã»ã¹ã«ã¯ãããã§ããªã...ã
- å®ã¯ãã¡ã¤ã«ã¢ã¯ã»ã¹ã¯OSã ãã«è¨±å¯ãããç¹æ¨©ã§ããã
- ããã§ã¯ããã»ã¹ã¯ãã©ããã£ã¦ãã¡ã¤ã«ã¢ã¯ã»ã¹ãå®ç¾ãã¦ããã®ãï¼
- ããã»ã¹ã¯ãOSã«ãã¡ã¤ã«ã¢ã¯ã»ã¹ãä¾é ¼ãã¦ããã®ã ã
OSçµç±ã®ãã¡ã¤ã«ã¢ã¯ã»ã¹
- 以ä¸ã®ã³ãã³ãã¯ãhello world ã¨ããåºåããhello.txt ã¨ãããã¡ã¤ã«ã«æ¸ãè¾¼ãã
$ echo hello world > hello.txt
- ããããechoã³ãã³ããç´æ¥ãã¡ã¤ã«ã«æ¸ãè¾¼ãã§ãã訳ã§ã¯ãªãã追跡ãã¦ã¿ãã
åããã»ã¹ã®çæ
- ã·ã§ã«ã¯ãåããã»ã¹ã®çæãOSã«ä¾é ¼ããã
ä¾é ¼ãåããã¨...
- OSã¯ãã·ã§ã«èªèº«ãã³ãã¼ããåããã»ã¹ãçæãããï¼ãã©ã¼ã¯ï¼
ãªãã¤ã¬ã¯ãå¦ç
- ã·ã§ã«ã¯ãechoã³ãã³ãã®å®è¡ã«å ç«ã£ã¦ãåããã»ã¹ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã®åºåããhello.txtãã¡ã¤ã«ã¸åãããããOSã«ä¾é ¼ããã
ä¾é ¼ãåããã¨...
- OSã¯ãhello.txtã®ãã¡ã¤ã«ãã¹ã¨ããã©ãã¾ã§èªã¿æ¸ããããçã®ãã¡ã¤ã«ã®ç®¡çæ
å ±ã¡ã¢ãç¨æãããï¼ãªã¼ãã³ããï¼
- ã¡ãªã¿ã«ããã¡ã¤ã«ã®ç®¡çæ å ±ã¡ã¢ã®ãã¨ãããªã¼ãã³ãã¡ã¤ã«è¨è¿°ï¼open file descriptionï¼ã¨å¼ã¶ã
- OSã¯ããã¡ã¤ã«ã®ç®¡çæ å ±ã¡ã¢ãçªå·ã§ç®¡çãããï¼ä»®ã«ããã§ã¯5çªã§ç®¡çããï¼
- ãã®çªå·ãããããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã§ããã
- OSã¯ããªãã¤ã¬ã¯ãæå®ã«å¾ã£ã¦ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã®ç®¡çæ å ±ã¡ã¢ã«ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿5çªï¼hello.txtï¼ã®ç®¡çæ å ±ã¡ã¢ãã³ãã¼ããã
- 以éOSã¯ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã¸ã®åºåä¾é ¼ã«å¯¾ãã¦ãhello.txtã¸æ¸ãè¾¼ããã¨ã«ãªãã
- OSã¯ãhello.txtã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿5çªã¨ç´ã¥ã管çæ
å ±ã¡ã¢ãç ´æ£ãããï¼ã¯ãã¼ãºããï¼
- ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã®ç®¡çæ å ±ã¡ã¢ãããã®ã§ãéè¤ãããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿5çªã®ç®¡çæ å ±ã¡ã¢ã¯ä¸è¦ãªã®ã ã
- OSã¯ã以ä¸ã®ä½æ¥ãå®äºãã¦ãã·ã§ã«ã«æ»ãã
ã³ãã³ãã®å®è¡
- ã·ã§ã«ã¯ãechoã³ãã³ãã®å®è¡ãOSã«ä¾é ¼ããã
ä¾é ¼ãåããã¨...
- OSã¯ãåããã»ã¹ãechoã³ãã³ãã«ç½®ãæãã¦å®è¡ããã
ãã¡ã¤ã«ã¸åºå
- echoã³ãã³ãã¯ãOSã«ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã¸ã®åºåãä¾é ¼ããã
ä¾é ¼ãåããã¨...
- OSã¯ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿1çªã®ç®¡çæ å ±ã¡ã¢ãè¦ã¦ãhello.txtã¸æ¸ãè¾¼ãã
ããã©ã«ãã®å ¥åã¨åºå
- ã·ã§ã«ãèµ·åããæãããã©ã«ãã§ä»¥ä¸ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ããªã¼ãã³ãã¦ããã
ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ | è¨å®å | |
---|---|---|
æ¨æºå ¥å | 0çª | ãã¼ãã¼ã |
æ¨æºåºå | 1çª | ç»é¢ |
æ¨æºã¨ã©ã¼ | 2çª | ç»é¢ |
- ã³ãã³ããå®è¡ããã¨ã·ã§ã«ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãå¼ãç¶ãã®ã§ãã³ãã³ãã«ãä¸è¨ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãå¿ ãè¨å®ããã¦ããã
- ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã®0çªã1çªã2çªã¯ãç¹å¥ãªãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã§ããã
- ãããããæ¨æºå ¥åï¼stdinï¼ãæ¨æºåºåï¼stdoutï¼ãæ¨æºã¨ã©ã¼ï¼stderrï¼ãã¨å¼ã°ãã¦ããã
- ã³ãã³ãã¯ãå¼æ°ã¾ãã¯æ¨æºå ¥åãããã¼ã¿ãèªã¿è¾¼ãã§ãå®è¡çµæãæ¨æºåºåã¸åºåããã¨ã©ã¼ãçºçãããæ¨æºã¨ã©ã¼ã¸åºåãããã¨ããä»çµã¿ã«ãªã£ã¦ããã
- ãã£ã¦ãæ¨æºã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã®0çªã1çªã2çªãéãã¦ãã¾ãã¨ãã³ãã³ããæ£å¸¸ã«å®è¡ã§ããªããªãã
$ echo abc >&- -bash: echo: write error: Bad file descriptor $ echo abc | cat <&- cat: stdin: Bad file descriptor
- ããåºåããã¹ã¦ç ´æ£ãããã®ã§ããã°ãæ¨æºåºåãéããã®ã§ã¯ãªãã/dev/null ã¸ãªãã¤ã¬ã¯ã·ã§ã³ããã®ã ã
- /dev/null ã¯æ¸ãè¾¼ã¾ãããã¼ã¿ããã¹ã¦ç ´æ£ãããç¹æ®ãªããã¤ã¹ãã¡ã¤ã«ã
$ echo abc > /dev/null
ã³ã¼ãã®å®è£ ã§è¦ãä»çµã¿
- ããã»ã¹ãOSã«å¦çãä¾é ¼ãããã¨ãã·ã¹ãã ã³ã¼ã«ãã¨å¼ãã§ããã
- ä¸è¨ã®ä¾ã§è¨ãã°ããã©ã¼ã¯ããªã¼ãã³ã»ã¯ãã¼ãºçã¯ã·ã¹ãã ã³ã¼ã«ã§ããã
- ããããã·ã¹ãã ã³ã¼ã«ã¨ç¸ã®ãªãã£ã身ã«ã¯ä½ãèµ·ãã£ã¦ãããæªç¥ã§ããã
- å®éã«ã·ã¹ãã ã³ã¼ã«ãã¦ã¿ããã¨ã§ããããä½æãã¦ã¿ãã®ã ã
fork()ã®ä»çµã¿
- fork()ã¯ãå®è¡ä¸ã®ããã»ã¹ãã³ãã¼ããããã§ããã
- ããã¦ã³ãã¼å¾...
- 親ããã»ã¹ã«ã¯ãã³ãã¼ããåããã»ã¹ã®PIDï¼ããã»ã¹IDï¼ãè¿ãã
- åããã»ã¹ã«ã¯ã0ãè¿ãã
- ã¨ã©ã¼ãçºçãããã-1ãè¿ãã
- fork()ãæ£å¸¸ã«å®äºããã¨ã親ããã»ã¹ã¨åããã»ã¹ã§ãfork()ã®æ¬¡ã®ã³ã¼ãããå®è¡ãç¶ç¶ããããã¨ã«ãªãã
- å®é¨ãã¦ã¿ãã
#include <stdio.h> main() { fork(); printf("hello\n"); }
- ä¸è¨ã³ã¼ãã fork_test.c ã¨ãã¦ä¿åãã¦ã
- ã³ã³ãã¤ã«ãã¦ã
$ gcc fork_test.c
- å®è¡ãã¦ã¿ãã¨ã
$ ./a.out
hello
hello
helloã2è¡è¡¨ç¤ºãããï¼
- ããã¯ãfork()å¾ã親ããã»ã¹ã¨åããã»ã¹ã§ printf("hello\n"); ãããããå®è¡ãããçµæã§ããã
- ã§ã¯ãfork(); ã3ã¤ã«ããã¨ã©ããªããï¼
#include <stdio.h> main() { fork(); fork(); fork(); printf("hello\n"); }
$ gcc fork_test.c $ ./a.out hello hello hello hello hello hello hello hello
ä»åº¦ã¯helloã8è¡ã表示ãããï¼
- ä½ãèµ·ãã£ã¦ããã®ãã¨è¨ãã°...
- 1åç®ã®fork()ï¼å ããã»ã¹Ã2ï¼ã§ã2ããã»ã¹ã«ãªãã
- 2åç®ã®fork()ï¼2ããã»ã¹Ã2ï¼ã§ã4ããã»ã¹ã«ãªãã
- 3åç®ã®fork()ï¼4ããã»ã¹Ã2ï¼ã§ã8ããã»ã¹ã«ãªãã
- æå¾ã«8ããã»ã¹ã§ printf("hello\n"); ãå®è¡ãããhelloã8è¡ã表示ããã¦ããã®ã ã
ãªãã¤ã¬ã¯ãã®å é¨å¦ç
- fork()ã®åããç解ã§ããã¨ããã¡ã¤ã«ã¸ãªãã¤ã¬ã¯ãããå ´åã®å é¨ã®åããåããããããªãã
- echo hello world > hello.txt ãå®è¡ããæã¯ãå é¨ã§ã¯ä»¥ä¸ã®ãããªæµãã«ãªã£ã¦ããã¨æãããã
# echo hello world > hello.txt ã®å é¨ã®åãï¼ã¨ã©ã¼å¦çãªãï¼ pid = fork(); /* ã·ã§ã«ãå®è¡ããæåããã»ã¹ãã³ãã¼ */ if (pid == 0) { /* åããã»ã¹ */ fd = open("hello.txt", O_CREAT | O_WRONLY, 0666); /* hello.txtãfdã§ãªã¼ãã³ */ dup2(fd, 1); /* fdãæ¨æºå ¥åã«ã³ãã¼ */ close(fd); /* 以å¾fdã¯ä¸è¦ãªã®ã§ã¯ãã¼ãº */ execl("/bin/echo", "hello", "world", NULL); /* echo hello worldãå®è¡ */ } else { /* 親ããã»ã¹ */ wait(); /* åããã»ã¹ãçµäºããã¾ã§å¾ ã¡ */ }
ãã¤ãã®å é¨å¦ç
- pipe()ã·ã¹ãã ã³ã¼ã«ã¯ããã¤ããä½ã£ã¦ãfd[1]ã«ãã¤ãã®å ¥å£ãfd[0]ã«ãã¤ãã®åºå£ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãè¿ãã
- ãã¤ãã®å ´åã¯2ã¤ä»¥ä¸ã®ã³ãã³ããå®è¡ããã®ã§ãfork()ã2å以ä¸å¼ã³åºããã¨ã«ãªãã
# echo hello world | wc ã®å é¨ã®åãï¼ã¨ã©ã¼å¦çãªãï¼ int fd[2]; pipe(fd); /* ãã¤ããä½æ ï¼å ¥å£ï¼fd[1] ==ãã¤ã== fd[0]ï¼åºå£ï¼ */ if (fork() == 0) { /* åºåå´ã®åããã»ã¹ */ dup2(fd[1], 1); /* ãã¤ãã®å ¥å£ãæ¨æºåºåã«ã³ãã¼ */ close(fd[0]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ close(fd[1]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ execl("/bin/echo", "hello", "world", NULL); /* echo hello worldãå®è¡ */ } else if (fork() == 0) { /* å ¥åå´ã®åããã»ã¹ */ dup2(fd[0], 0); /* ãã¤ãã®åºå£ãæ¨æºå ¥åã«ã³ãã¼ */ close(fd[0]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ close(fd[1]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ execl("/bin/wc", NULL); /* wcãå®è¡ */ } else { /* 親ããã»ã¹ */ close(fd[0]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ close(fd[1]); /* ä¸è¦ã«ãªã£ãfdãã¯ãã¼ãº */ wait(); /* åããã»ã¹ãçµäºããã¾ã§å¾ ã¡ */ wait(); /* åããã»ã¹ãçµäºããã¾ã§å¾ ã¡ */ }
- ããCè¨èªãã使ããªãã£ãããä¸è¨ã®ãããªã³ã¼ããæ¸ãã¦ãã³ã³ãã¤ã«ãã¦å®è¡ããå¿ è¦ãããã
- ã³ãã³ãããã¤ãããªãã¤ã¬ã¯ã·ã§ã³ã«ãã£ã¦ã1è¡ã§ç°¡æ½ã«è¡¨ç¾ãã¦ãã³ã³ãã¤ã«ãªãã§å®è¡ã§ããã
ã³ãã³ãã£ã¦ç´ æ´ãããï¼
- ããã¾ã§echoã³ãã³ãã®ãµã³ãã«ã§è©±ãé²ãã¦ãã¦ãã³ã¡ã³ãããã¦æ°ä»ãã¦ãã¾ã£ãã
- echoã¯å é¨ã³ãã³ããªã®ã§ããã©ã¼ã¯ãã¦ãªãããã
$ type -a echo
echo is a shell builtin
echo is /bin/echo
- 調ã¹ã¦ã¿ãã¨ãèªåã®ç°å¢ã«ã¯å é¨ã³ãã³ãechoã¨ã/bin/echoã®äºã¤ãåå¨ãã¦ããã
- echoå®è¡æããã©ã¼ã¯ããã¦ããã®ããããªãã®ããã©ããã£ãã調ã¹ãããã®ã ããï¼
$ mkfifo fifo $ /bin/echo > fifo #観å¯ãçµãã£ããcontrol-Cã§çµäº $ echo > fifo #観å¯ãçµãã£ããcontrol-Cã§çµäº
- /bin/echo > fifo ã®å ´å...PID 51470ã®åããã»ã¹ãçã¾ããã
- echo > fifo ã®å ´å...ä½ãçã¾ããªãã
ãã¯ããå é¨ã³ãã³ãã¯ãã©ã¼ã¯ãããªãã®ã ï¼
ã«ã¼ãããã»ã¹
- åããã»ã¹ã¯ãã·ã¹ãã ã³ã¼ã«fork()ã«ãã£ã¦ãå ã®ããã»ã¹ï¼è¦ªããã»ã¹ï¼ãã³ãã¼ãããã¨ã§çæãããã
- ã¨ãããã¨ã¯ã親ããã»ã¹ã辿ã£ã¦è¡ãã¨ãæåã«ä½ãããåç¹ã¨ãªããªãªã¸ãã«ãªããã»ã¹ãããã¯ãã ã
- ããã¯å ¨ããã®ã¨ããã§ãããã¢ã¯ãã£ããã£ã¢ãã¿ã§ç°¡åã«ç¢ºèªã§ããã
- 表示ãããã¹ã¦ã®ããã»ã¹ï¼é層表示ï¼ãã§ãã£ã2ã¤ã®ããã»ã¹ã«ãªãã
- kernel_taskã¯OSã®ããã»ã¹ã§ãããOSãæä¾ããæ§ã ãªãµã¼ãã¹ãæ ã£ã¦ããã
- ã¦ã¼ã¶ã¼ã®ããã»ã¹ã®åç¹ã«ã¯ãããã»ã¹ã®å®è¡ã管çããããã»ã¹launchdãããã
- ä¾ãã°ãã¿ã¼ããã«ã§echoã³ãã³ããå®è¡ããå ´åã¯ã以ä¸ã®ãããªããã»ã¹é層ãåºæ¥ä¸ãã£ã¦ããã®ã ã
- launchd >> launchd >> ã¿ã¼ããã« >> login >> bash >> echo
- åç¹ã®launchdã¯ãOSã¨ãã¦å¿ è¦ãªããã»ã¹ã管çããlaunchdã§ããã
- äºã¤ç®ã®launchdã¯ãOSXã«ãã°ã¤ã³ããæã®ã¦ã¼ã¶ã¼å¥ã®ããã»ã¹ã管çããlaunchdã§ããã
é¢é£ããæ¥è¨
åèãã¼ã¸
以ä¸ã®ãã¼ã¸ãããã¸ãåèã«ãªãã¾ãããæè¬ã§ãï¼
- Shinpeim/process-book
- Lecture Notes
- ã·ã¹ãã ã»ã³ã¼ã«ãã©ã¤ãã©ãªããã¡ã¤ã«ãããã»ã¹
- ãã¤ãã§ã¤ãªã - PukiWiki
FM7ã®é
- åãã¦ä½¿ã£ããã½ã³ã³ã¯ãFM7ã ã£ããï¼new 7ã ã£ãããï¼
- FM7ã¯é常ã«ã·ã³ãã«ãª8ããããã½ã³ã³ã§ãã£ãã
- é»æºãªã³ã§èµ·åããã®ã¯ãF-BASICã®ã¨ãã£ã¿ã§ããã
- OSã¨ããæ¦å¿µã®ã½ããã¦ã§ã¢ã¯æ·»ä»ããã¦ããªãã...
- ç»é¢æç»ããã¼ã¿ã¬ã³ã¼ãçã«ã¢ã¯ã»ã¹ããAPIã¯ç¨æããã¦ãããï¼BIOSã¨å¼ã°ãã¦ããï¼
- ãããã®APIã¨F-BASICã³ãã³ãã¯ãã»ã¼1対1ã§å¯¾å¿ãã¦ããã
- ãã£ã¦ãF-BASICã³ãã³ããã使ããªãã¿ã¼ããã«ãã¤ã¡ã¼ã¸ã«è¿ãã¨æãã
- F-BASICã ãã使ã£ã¦ããã°ãããã¯ä»ã§è¨ãF-BASICã·ã§ã«ã®ç°å¢ã§ããã
- F-BASICãæä¾ãã以ä¸ã®ãã¨ãå¦çãããã¨ããã¨ããã·ã³èªã使ããã¨ã«ãªã£ãã
- ãã·ã³èªã¨ã¯ãã¢ã»ã³ããªè¨èªãã³ã³ãã¤ã«ãããå®è¡å¯è½ãªãã¤ãã³ã¼ãã§ããã
- ã¢ã»ã³ãã©ã¨ããã½ããã¦ã§ã¢ããæã£ã¦ããªãã£ãã®ã§ãæ¸ããã³ã¼ãã¯å½ä»¤è¡¨ãè¦ãªããèªåèªèº«ãã¢ã»ã³ãã©ã¨ãªã£ã¦ãã·ã³èªã«å¤æããã®ã ã
- ãã·ã³èªãç¹å®ã®ã¡ã¢ãªé åã«æ¸ãè¾¼ãã§ããã¦ãCPUã«ãã®ã¡ã¢ãªã¢ãã¬ã¹ã¸ã¸ã£ã³ãããããã«å½ä»¤ãã¦ããã·ã³èªãå®è¡ããã®ã ã
- FM7ã«ããã¦ã¯ãã¦ã¼ã¶ã¼ã¯å®ç§ãªèªç±ãæã£ã¦ããã
- ãã¹ã¦ã®ã¡ã¢ãªé åã¸ãå¶éãªãã¢ã¯ã»ã¹ã§ããã
- å¤é¨æ©å¨ã¨æ å ±ãããåãããç¹æ®ãªã¡ã¢ãªé åï¼IOé åï¼ã¸ã®ã¢ã¯ã»ã¹ãããèªç±ã ã
- ä¾ãã°ããã¯ã»ã«ã¨å¯¾å¿ããVRAMã«æ¸ãè¾¼ãã°ãæ¥ç¶ãããCRTã¢ãã¿ã«ä½ãæç»ããããã¨ã«ãªãã
- æ¥ç¶ããããã¼ã¿ã¬ã³ã¼ãã®åçé³ã«åå¿ããã¡ã¢ãªãç£è¦ãã¦èªã¿åãã°ããã¡ã¤ã«ããã¼ãã§ããã
- ãããããã¨ã許ããã¦ããã®ã§ã工夫次第ã§ããªãé«åº¦ãªãã¨ãã§ããã
- VRAMã®ãªãã»ããã¢ãã¬ã¹ãå©ç¨ãã¦ãæ»ãããªã¹ã¯ãã¼ã«ãå®ç¾ããã¨ãã
- ãã¼ã¿ã¬ã³ã¼ãçµç±ã§é³å£°ããµã³ããªã³ã°ãã¦ãFM7ã§ããã¹ãããã¨ãã
- ãããèªç±ã®ä»£åã¨ãã¦ããã·ã³èªã³ã¼ãã«ä¸å
·åãããã¨ãCPUã¯ç°¡åã«æ´èµ°ããã
- æ´èµ°ã¨ã¯ããã·ã³èªã³ã¼ãã®ééããããCPUãæ³å®å¤ã®ã³ã¼ãã®å®è¡ãç¶ãã¦ãã¾ãç¶æ ã§ããã
- OSã®ããªã¼ãºã®ãããªãã®ã ããFM7ã«ã¯OSããªãã®ã§CPUã®æ´èµ°ã¨è¡¨ç¾ããã®ã ã
- ã¾ãããã«ãã¿ã¹ã¯ã¨ããæ¦å¿µããªããããã¯ã°ã©ã¦ã³ãã§åæå¹³è¡çã«å¦çããä»çµã¿ã¯ãªãã£ãã
- ä¸æ¦ã¦ã¼ã¶ã¼ä½æã®ãã·ã³èªã³ã¼ãã®å¦çãå§ã¾ã£ããããã®å¦çãå®äºããã¾ã§ãã£ã¨ç¶ãã®ã ã
- ããããã°ãã¿ã¤ãã¼å²ãè¾¼ã¿ã®æ©è½ã¯ãã£ããããªæ°ãããã
- Fï¼ï¼ã¯ã¼ã«ãï¼ç´ æ´ãããæ å ±ã«æè¬ã§ãï¼ï¼
- FM-7 | ãã¹ããã·ã¹ãã ï¼ç´ æ´ãããæ å ±ã«æè¬ã§ãï¼ï¼
- FD02çªå°ã®Bit 2ã1ãªãã2.03mç§ãã¨ã«å²ãè¾¼ã¿ãçºçããã®ã ï¼
- ããã¦ã¿ã¤ãã¼å²ãè¾¼ã¿ã§ããã°ãFD03çªå°ã®Bit 2ã1ã«ãªãã®ã ã
- FD03çªå°ãåç §ãããã¨ã§ããã®å²ãè¾¼ã¿ãä½ã§ããããåããã®ã§ããã