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
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
°Ñ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()ÌṩÁ˺ ......
LinuxϳÌÐòµÄProfile¹¤¾ß
ÎÒÃÇÔÚд³ÌÐò£¬ÌرðÊÇǶÈëʽ³ÌÐòµÄʱºò£¬Í¨³£ÐèÒª¶Ô³ÌÐòµÄÐÔÄܽøÐзÖÎö£¬ÒÔ±ã³ÌÐòÄܹ»¸ü¿ì¸üºÃµØÔËÐУ¬´ïµ½ÊµÊ±£¨real-time£©µÄÄ¿µÄ¡£Èç¹û³ÌÐòºÜ´ó£¬·ÖÎöÆðÀ´¾ÍºÜÀ§ÄÑ¡£Èç¹ûÓиö¹¤¾ßÄܹ»×Ô¶¯½øÐгÌÐòµÄÐÔÄÜ·ÖÎö£¬ÄǾÍ×îºÃÁË¡£ÕâÀï½éÉÜÒ»ÖÖLinuxϳÌÐòµÄProfiling¹¤¾ß----GNU profiler¡£
GNU gpr ......