linux½ø³Ì¹ÜÀíÖ®½ø³Ì´´½¨
Ëùν½ø³Ì¾ÍÊdzÌÐòÖ´ÐÐʱµÄÒ»¸öʵÀý. ËüÊÇÏÖ´ú²Ù×÷ϵͳÖÐÒ»¸öºÜÖØÒªµÄ³éÏó,ÎÒÃÇ´Ó½ø³ÌµÄÉúÃüÖÜÆÚ:´´½¨,Ö´ÐÐ,ÏûÍöÀ´·ÖÎöÒ»ÏÂLinuxÉϵĽø³Ì¹ÜÀíʵÏÖ.
Ò»:Ç°ÑÔ
½ø³Ì¹ÜÀí½á¹¹;
ÔÚÄÚºËÖÐ,ÿһ¸ö½ø³Ì¶ÔÓ¦Ò»¸ötask.¾ÍÊÇÒÔÇ°Ëù½²µÄPCB.ËüµÄ½á¹¹ÈçÏÂ(include/linux/sched.h):
struct task_struct {
volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
void *stack;
atomic_t usage;
unsigned int flags; /* per process flags, defined below */
unsigned int ptrace;
int lock_depth; /* BKL lock depth */
……
……
}
ÓÉÓÚÕâ¸ö½á¹¹°üº¬Á˽ø³ÌµÄËùÓÐÐÅÏ¢,ËùÒÔÊ®·ÖÅÓ´ó,ÎÒÃÇÔÚÒÔºóµÄ·ÖÎöÖÐÔÙÀ´·ÖÎö¸÷³ÉÔ±µÄº¬Òå¡£
Task_structµÄ´æ·Å£º
ÔÚϵͳÔËÐйý³ÌÖУ¬½ø³ÌÇл»Ê®·ÖƵ·±£¬ËùÒÔÎÒÃÇÐèÒªÒ»ÖÖ·½Ê½Äܹ»¿ìËÙ»ñµÃµ±Ç°½ø³ÌµÄtask_struct¡£linuxµÄtask_struct´æ·ÅÈçÏÂͼËùʾ£º
ÈçÉÏͼËùʾ£º½ø³ÌÄں˶ÑÕ»µ×²¿´æ·Å×Åstruct thread_struct.¸Ã½á¹¹ÖÐÓÐÒ»¸ö³ÉÔ±Ö¸Ïòµ±Ç°½ø³ÌµÄtask_struct.ÔÚÄÚºËÖÐÓÐÒ»¸ö»ñÈ¡µ±Ç°½ø³ÌµÄthread_struct µÄºê¡£ËüµÄ¶¨ÒåÈçÏ£º
#define GET_THREAD_INFO(reg)
movl $THREAD, reg;
andl %esp, reg
THREAD_SIZE¶¨ÒåÈçÏ£º
#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE (4096)
#else
#define THREAD_SIZE (8192)
#endif
ÎÒÃÇÌÖÂÛ³£¹æµÄ8KÕ»µÄÇé¿ö¡£-THREAD_SIZE¼´Îª£º0xFFFFE000.ÒòΪջ±¾ÉíÊÇÒ³Ãæ¶ÔÆëµÄ.ËùÒÔÖ»Òª°ÑµÍ13λÆÁ±×µô¾ÍÊÇthread_struct.µÄµØÖ·.
½ø³ÌÁ´±í:
ÿһ¸ö½ø³Ì¶¼Óи¸½ø³Ì,ÏàÓ¦µÄÿ¸ö½ø³Ì¶¼»á¹ÜÀí×Ô¼ºµÄ×Ó½ø³Ì.ÔÚlinuxϵͳÖÐ,ËùÓнø³Ì¶¼ÊÇÓÉinit½ø³ÌÅÉÉú¶øÀ´.init½ø³ÌµÄ½ø³ÌÃèÊö·ûÓÉinit_task¾²Ì¬Éú³É.ËüµÄ¶¨ÒåÈçÏÂËùʾ:
struct task_struct init_task = INIT_TASK(init_task);
#define INIT_TASK(tsk)
{ &nbs
Ïà¹ØÎĵµ£º
LInux±Ê¼Ç
¹Û²ìϵͳµÄʹÓÃ״̬:Èç¹ûÒª¿´Ä¿Ç°ÓÐËÔÚÔÚÏß,¿ÉÒÔÏ´ï who Õâ¸öÖ¸Áî,¶øÈç¹ûÒª¿´ÍøÂçµÄÁª
»ú״̬,¿ÉÒÔÏ´ï netstat -a Õâ¸öÖ¸Áî,¶øÒª¿´±³¾°Ö´ÐеijÌÐò¿ÉÒÔÖ´ÐÐ ps -aux Õâ¸öÖ¸Áî¡£
ʹÓÃÕâЩָÁî¿ÉÒÔÈÃÄãÉÔ΢Á˽âÖ÷»úÄ¿Ç°µÄʹÓÃ״̬!
¹Ø»úµÄÕýÈ·Ö¸ÁîÓ÷¨啰!
• ½«Êý¾Ýͬ²½Ð´ÈëÓ²ÅÌÖеÄÖ¸Áî: sync
& ......
ϵͳµ÷ÓÃÊÇÓ¦ÓóÌÐòºÍ²Ù×÷ϵͳÄÚºËÖ®¼äµÄ¹¦Äܽӿڡ£ÆäÖ÷ҪĿµÄÊÇʹµÃÓû§
¿ÉÒÔʹÓòÙ×÷ϵͳÌṩµÄÓйØÉ豸¹ÜÀí¡¢ÊäÈë/ÊäÈëϵͳ¡¢ÎļþϵͳºÍ½ø³Ì¿ØÖÆ¡¢
ͨÐÅÒÔ¼°´æ´¢¹ÜÀíµÈ·½ÃæµÄ¹¦ÄÜ£¬¶ø²»±ØÁ˽âϵͳ³ÌÐòµÄÄÚ²¿½á¹¹ºÍÓйØÓ²¼þϸ
½Ú£¬´Ó¶øÆðµ½¼õÇáÓû§¸ºµ£ºÍ±£»¤ÏµÍ³ÒÔ¼°Ìá¸ß×ÊÔ´ÀûÓÃÂʵÄ×÷Óá£
¡¡¡¡Linux²Ù×÷ϵͳ ......
°ÑGDAL°²×°Ä¿Â¼ÏµÄ../bin/gdal-config¸´ÖƵ½/usr/bin/Ï£¬·ñÔò³öÏÖ“ÕÒ²»µ½gdal-config”
°Ñproj4°²×°Ä¿Â¼ÏµÄ../include/proj_api.h¸´ÖƵ½GDAL°²×°Ä¿Â¼ÖеÄincludeÖУ¬·ñÔò³öÏ֓䶨Òåproj_api.h”»òÕßÖ±½Ó°Ñproj4°²×°µ½Ä¬ÈÏ·¾¶£¬·ñÔò»áÌáʾ“ÕÒ²»µ½ -lproj”¡£ ......
1£®4 Ï̴߳´½¨µÄLinuxʵÏÖ
ÎÒÃÇÖªµÀ£¬LinuxµÄÏß³ÌʵÏÖÊÇÔÚºËÍâ½øÐеģ¬ºËÄÚÌṩµÄÊÇ´´½¨½ø³ÌµÄ½Ó¿Údo_fork()¡£ÄÚºËÌṩÁËÁ½¸öϵͳµ÷ÓÃ__clone()ºÍfork ()£¬×îÖÕ¶¼Óò»Í¬µÄ²ÎÊýµ÷ÓÃdo_fork()ºËÄÚAPI¡£µ±È»£¬ÒªÏëʵÏÖỊ̈߳¬Ã»ÓкËÐĶԶà½ø³Ì£¨ÆäʵÊÇÇáÁ¿¼¶½ø³Ì£©¹²ÏíÊý¾Ý¶ÎµÄÖ§³ÖÊDz»Ðеģ¬Òò´Ë£¬do_fork()ÌṩÁ˺ ......
debian lenny , my favorite
a. vim /etc/sysctl.conf:
modify net.ipv4.ip_forward = 1
b. flush route table:
iptables -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
c. open NAT services:
&nb ......