Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Windows via C/C++£ºÏ̵߳÷¶È——¸ÅÊö

»ùÓÚÓÅÏȼ¶µÄ²Ù×÷ϵͳ£¨preemptive operating system£©±ØÐëʹÓÃijÖÖËã·¨ÒÔ¾ö¶¨CPUÈçºÎµ÷¶ÈϵͳÖеÄỊ̈߳¬±¾Õ½«ÌÖÂÛWindows VistaʹÓõĵ÷¶ÈËã·¨¡£ ÎÒÃÇ֮ǰÌÖÂÛ¹ýÏ̵߳ÄÉÏÏÂÎĽṹCONTEXT£¬ÆäÖк¬ÓÐÏß³Ì×îºóÒ»´ÎÖ´ÐÐʱCPU¼Ä´æÆ÷×éµÄ״̬¡£ ²Ù×÷ϵͳÿ20ºÁÃë¼ì²éϵͳÖÐËùÓÐÏß³ÌÄں˶ÔÏóµÄ״̬£¬ÆäÖÐһЩ¶ÔÏó±»ÈÏΪÊǿɵ÷¶È£¨scheduable£©µÄ£¬²Ù×÷ϵͳ»á´Ó¿Éµ÷¶ÈµÄ¶ÔÏóÖÐÑ¡ÔñÒ»¸ö£¬²¢½«ÆäCONTEXTÖеÄÖµ¼ÓÔص½CPU¼Ä´æÆ÷×éÖУ¬Õâ¸öʵÏÖÏ̵߳÷¶ÈµÄ¹ý³Ì±»³ÆΪÉÏÏÂÎÄÇл»£¨Context Switch£©¡£
½ÓÏÂÀ´£¬±»Ñ¡ÔñµÄÏ߳̽«ÔÚÆä½ø³ÌµØÖ·¿Õ¼äÖÐÖ´ÐдúÂë¡¢²Ù×÷Êý¾Ý¡£´ó¸Å20msÖ®ºó£¬Windows»áÖØн«CPU¼Ä´æÆ÷×éµÄ״̬д»Øµ½¸ÃÏ̵߳ÄCONTEXT½á¹¹ÖУ¬²¢´ÓÆäËü¿Éµ÷¶ÈµÄÏß³ÌÄں˶ÔÏóÖÐÑ¡ÔñÒ»¸öÒªµ÷¶ÈµÄ¶ÔÏ󣬽«ÆäCONTEXT½á¹¹ÄÚÈݼÓÔص½CPU¼Ä´æÆ÷ÖУ¬ÕâÑùÔ­Ï߳̽«²»ÔÙÔËÐУ¬ÐÂÏ߳̿ªÊ¼ÔËÐС£ÉÏÏÂÎÄÇл»»á´ÓϵͳÆô¶¯¿ªÊ¼³ÖÐøµ½ÏµÍ³¹Ø±Õ¡£
ϵͳֻ»áµ÷¶È¿Éµ÷¶ÈµÄỊ̈߳¬µ«ÊÂʵÉÏϵͳÖеĴó¶àÊýÏ̶߳¼ÊDz»¿É¸ß¶ÈµÄ¡£±ÈÈ磬ÓÐЩÏ̵߳ÄÔÝÍ£¼ÆÊý£¨suspend count£©´óÓÚ0£¬ÕâÒâζ×ÅÏ̱߳»¹ÒÆðÇÒ²»Ó¦¸ÃΪÆä·ÖÅäÈκÎCPUʱ¼ä£¬ÎªÁ˹ÒÆðÒ»¸öỊ̈߳¬¿ÉÒÔÔÚ´´½¨Ïß³ÌʱΪCreateThreadÖ¸¶¨CREATE_SUSPEND±êÖ¾£¬±¾ÕºóÃæ»áÌÖÂÛ¹ÒÆðÒÑ´æÔÚÏ̵߳ķ½·¨£¨SuspendThreadºÍResumeThreadº¯Êý£©¡£
³ýÁ˹ÒÆðµÄỊ̈߳¬ÆäËüÏ߳̿ÉÄÜ»áÒòΪÔڵȴýijЩ×ÊÔ´¶ø±äµÃ²»¿Éµ÷¶È¡£±ÈÈ磬Äã´ò¿ªÁ˼Çʱ¾Ö®ºóʲôҲ²»×ö£¬¼Çʱ¾Ï߳̽«´¦Óڵȴý״̬£¬ÏµÍ³²»»áΪֱ·ÖÅäʱ¼äƬ£¬³ý·ÇÄãÒƶ¯Æä´°¿Ú»òÏòÆä±à¼­ÇøÖмüÈëÎı¾£¬´Ëʱ¼Çʱ¾Ï̱߳ä³É¿Éµ÷¶ÈµÄ£¬µ«Õâ²¢²»Òâζ×ÅËü»áÁ¢¼´»ñµÃCPUʱ¼ä£¬ÏµÍ³Ö»ÊÇ´ÓËùÓпɵ÷¶ÈµÄÏß³ÌÖа´µ÷¶ÈËã·¨ÌôÑ¡Ò»¸öÏß³ÌÖ´ÐУ¬±»µ÷¶ÈµÄÏ̲߳»Ò»¶¨»áÊǼÇʱ¾Ï̡߳£


Ïà¹ØÎĵµ£º

SQLite C/C++½Ó¿Ú½éÉÜ

ÕâƪÎÄÕÂÊÇʹÓÃSQLite C/C++½Ó¿ÚµÄÒ»¸ö¸ÅÒª½éÉܺÍÈëÃÅÖ¸ÄÏ¡£
ÓÉÓÚÔçÆÚµÄSQLiteÖ»Ö§³Ö5¸öC/C++½Ó¿Ú£¬Òò¶ø·Ç³£ÈÝÒ×ѧϰºÍʹÓ㬵«ÊÇËæ×ÅSQLite¹¦ÄܵÄÔöÇ¿£¬ÐµÄC/C++½Ó¿Ú²»¶ÏµÄÔö¼Ó½øÀ´£¬µ½ÏÖÔÚÓг¬¹ý150¸ö²»Í¬µÄAPI½Ó¿Ú¡£ÕâÍùÍùʹ³õѧÕßÍû¶øÈ´²½¡£ÐÒÔ˵ÄÊÇ£¬´ó¶àÊýSQLiteÖеÄC/C++½Ó¿ÚÊÇרÓõģ¬Òò¶øºÜÉÙ±»Ê¹Óõ½¡£¾¡¹ÜÓÐÕâ ......

C±ê×¼¿âÔ´Âë½âÆÊ(13)£ºÊäÈëÊä³öº¯Êýstdio.h

    C±ê×¼ÖеÄI/O¿âÊÇÒ»¸ö±È½ÏÅÓ´óµÄ¿â£¬ÊµÏÖÒ²±È½Ï¸´ÔÓ¡£ÏÔÈ»I/O¿âµÄʵÏÖÊÇÒÀÀµÓÚ²Ù×÷ϵͳµÄ£¬²»Í¬µÄϵͳÉÏI/O¿âµÄʵÏÖ»úÀíÊDz»Ò»ÑùµÄ¡£glibcÖУ¬I/O¿âµÄºËÐÄʵÏÖÔÚlibioĿ¼Ï¡£ÓÐ4¸öÍ·Îļþlibio.h, iolibio.h, libioP.h, strfile.h, stdio.h£¬ÆäÖÐstdio.hÊǵ¼³öµÄ±ê×¼CÍ·Îļþ£¬ÆäÓ඼ÊÇÄÚ²¿ÊµÏÖ¡£ÕâÀï²¢² ......

c/c++Îļþ¶Áд²Ù×÷×ܽá

ÔÚ±à³ÌµÄ¹ý³ÌÖУ¬ÎļþµÄ²Ù×÷ÊÇÒ»¸ö¾­³£Óõ½µÄÎÊÌ⣬ÔÚC++BuilderÖУ¬¿ÉÒÔʹÓöàÖÖ·½·¨¶ÔÎļþ²Ù×÷£¬ÏÂÃæÎҾͰ´ÒÔϼ¸¸ö²¿·Ö¶Ô´Ë×÷Ïêϸ½éÉÜ£¬¾ÍÊÇ£º
 
1¡¢»ùÓÚCµÄÎļþ²Ù×÷£»
2¡¢»ùÓÚC++µÄÎļþ²Ù×÷£»
3¡¢»ùÓÚWINAPIµÄÎļþ²Ù×÷£»
4¡¢»ùÓÚBCB¿âµÄÎļþ²Ù×÷£»
5¡¢ÌØÊâÎļþµÄ²Ù×÷¡£
¡¡
Ò¼¡¢»ùÓÚCµÄÎļþ²Ù×÷
¡¡¡¡ÔÚA ......

CÓëC++µÄÇø±ð

CÊÇÒ»¸ö½á¹¹»¯ÓïÑÔ£¬ÈçÌ·ÀÏÒ¯×ÓËù˵£ºËüµÄÖصãÔÚÓÚËã·¨ºÍÊý¾Ý½á¹¹¡£C³ÌÐòµÄÉè¼ÆÊ×Òª¿¼ÂǵÄÊÇÈçºÎͨ¹ýÒ»¸ö¹ý³Ì£¬¶ÔÊäÈ루»ò»·¾³Ìõ¼þ£©½øÐÐÔËËã´¦ÀíµÃµ½Êä³ö£¨»òʵÏÖ¹ý³Ì£¨ÊÂÎñ£©¿ØÖÆ£©£¬¶ø¶ÔÓÚC++£¬Ê×Òª¿¼ÂǵÄÊÇÈçºÎ¹¹ÔìÒ»¸ö¶ÔÏóÄ£ÐÍ£¬ÈÃÕâ¸öÄ£ÐÍÄܹ»ÆõºÏÓëÖ®¶ÔÓ¦µÄÎÊÌâÓò£¬ÕâÑù¾Í¿ÉÒÔͨ¹ý»ñÈ¡¶ÔÏóµÄ״̬ÐÅÏ¢µÃµ½Êä³ö»òʵÏÖ¹ ......

LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨

 LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨
#include<time.h>  //CÓïÑÔµÄÍ·Îļþ
#include<stdio.h>  //CÓïÑÔµÄI/O
void main()
{
time_t now;    //ʵÀý»¯time_t½á¹¹
struct tm  *timenow;    //ʵÀý»¯tm½á¹¹Ö¸Õë
time(&now);
//timeº¯Êý¶ÁÈ¡ÏÖÔÚµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ