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

תÌù: JavaµÄÀ¬»ø»ØÊÕ»úÖÆ

2006-01-18 13:53×÷Õߣº³ö´¦£º²©¿ÍÔ°ÔðÈα༭£º·½ÖÛ http://dev.yesky.com/178/2278678.shtml ÒýÑÔ
JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø£¬ÀàµÄʵÀý(¶ÔÏó)´ÓÖзÖÅä¿Õ¼ä¡£JavaÐéÄâ»ú(JVM)µÄ¶ÑÖд¢´æ×ÅÕýÔÚÔËÐеÄÓ¦ÓóÌÐòËù½¨Á¢µÄËùÓжÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸ÁÁ¢£¬µ«ÊÇËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµØÊÍ·Å¡£Ò»°ãÀ´Ëµ£¬¶ÑµÄÊÇÓÉÀ¬»ø»ØÊÕ À´¸ºÔðµÄ£¬¾¡¹ÜJVM¹æ·¶²¢²»ÒªÇóÌØÊâµÄÀ¬»ø»ØÊÕ¼¼Êõ£¬ÉõÖÁ¸ù±¾¾Í²»ÐèÒªÀ¬»ø»ØÊÕ£¬µ«ÊÇÓÉÓÚÄÚ´æµÄÓÐÏÞÐÔ£¬JVMÔÚʵÏÖµÄʱºò¶¼ÓÐÒ»¸öÓÉÀ¬»ø»ØÊÕËù¹ÜÀíµÄ¶Ñ¡£À¬»ø»ØÊÕÊÇÒ»ÖÖ¶¯Ì¬´æ´¢¹ÜÀí¼¼Êõ£¬Ëü×Ô¶¯µØÊͷŲ»ÔÙ±»³ÌÐòÒýÓõĶÔÏ󣬰´ÕÕÌض¨µÄÀ¬»øÊÕ¼¯Ëã·¨À´ÊµÏÖ×ÊÔ´×Ô¶¯»ØÊյŦÄÜ¡£
À¬»øÊÕ¼¯µÄÒâÒå
ÔÚC++ÖУ¬¶ÔÏóËùÕ¼µÄÄÚ´æÔÚ³ÌÐò½áÊøÔËÐÐ֮ǰһֱ±»Õ¼Óã¬ÔÚÃ÷È·ÊÍ·Å֮ǰ²»ÄÜ·ÖÅä¸øÆäËü¶ÔÏ󣻶øÔÚJavaÖУ¬µ±Ã»ÓжÔÏóÒýÓÃÖ¸ÏòÔ­ÏÈ·ÖÅä¸øij¸ö¶ÔÏóµÄÄÚ´æʱ£¬¸ÃÄÚ´æ±ã³ÉΪÀ¬»ø¡£JVMµÄÒ»¸öϵͳ¼¶Ï̻߳á×Ô¶¯ÊͷŸÃÄÚ´æ¿é¡£À¬»øÊÕ¼¯Òâζ×ųÌÐò²»ÔÙÐèÒªµÄ¶ÔÏóÊÇ"ÎÞÓÃÐÅÏ¢"£¬ÕâЩÐÅÏ¢½«±»¶ªÆú¡£µ±Ò»¸ö¶ÔÏó²»ÔÙ±»ÒýÓõÄʱºò£¬ÄÚ´æ»ØÊÕËüÕ¼ÁìµÄ¿Õ¼ä£¬ÒÔ±ã¿Õ¼ä±»ºóÀ´µÄжÔÏóʹÓá£ÊÂʵÉÏ£¬³ýÁËÊÍ·ÅûÓõĶÔÏó£¬À¬»øÊÕ¼¯Ò²¿ÉÒÔÇå³ýÄÚ´æ¼Ç¼ËéƬ¡£ÓÉÓÚ´´½¨¶ÔÏóºÍÀ¬»øÊÕ¼¯Æ÷ÊͷŶªÆú¶ÔÏóËùÕ¼µÄÄÚ´æ¿Õ¼ä£¬ÄÚ´æ»á³öÏÖËéƬ¡£ËéƬÊÇ·ÖÅä¸ø¶ÔÏóµÄÄÚ´æ¿éÖ®¼äµÄ¿ÕÏÐÄڴ涴¡£ËéƬÕûÀí½«ËùÕ¼ÓõĶÑÄÚ´æÒƵ½¶ÑµÄÒ»¶Ë£¬JVM½«ÕûÀí³öµÄÄÚ´æ·ÖÅä¸øеĶÔÏó¡£
À¬»øÊÕ¼¯ÄÜ×Ô¶¯ÊÍ·ÅÄÚ´æ¿Õ¼ä£¬¼õÇá±à³ÌµÄ¸ºµ£¡£ÕâʹJava ÐéÄâ»ú¾ßÓÐһЩÓŵ㡣Ê×ÏÈ£¬ËüÄÜʹ±à³ÌЧÂÊÌá¸ß¡£ÔÚûÓÐÀ¬»øÊÕ¼¯»úÖƵÄʱºò£¬¿ÉÄÜÒª»¨Ðí¶àʱ¼äÀ´½â¾öÒ»¸öÄѶ®µÄ´æ´¢Æ÷ÎÊÌâ¡£ÔÚÓÃJavaÓïÑÔ±à³ÌµÄʱºò£¬¿¿À¬»øÊÕ¼¯»úÖÆ¿É´ó´óËõ¶Ìʱ¼ä¡£Æä´ÎÊÇËü±£»¤³ÌÐòµÄÍêÕûÐÔ£¬ À¬»øÊÕ¼¯ÊÇJavaÓïÑÔ°²È«ÐÔ²ßÂÔµÄÒ»¸öÖØÒª²¿·Ý¡£
À¬»øÊÕ¼¯µÄÒ»¸öDZÔÚµÄȱµãÊÇËüµÄ¿ªÏúÓ°Ïì³ÌÐòÐÔÄÜ¡£JavaÐéÄâ»ú±ØÐë×·×ÙÔËÐгÌÐòÖÐÓÐÓõĶÔÏó£¬ ¶øÇÒ×îÖÕÊÍ·ÅûÓõĶÔÏó¡£ÕâÒ»¸ö¹ý³ÌÐèÒª»¨·Ñ´¦ÀíÆ÷µÄʱ¼ä¡£Æä´ÎÀ¬»øÊÕ¼¯Ëã·¨µÄ²»Í걸ÐÔ£¬ÔçÏȲÉÓõÄijЩÀ¬»øÊÕ¼¯Ëã·¨¾Í²»Äܱ£Ö¤100%ÊÕ¼¯µ½ËùÓеķÏÆúÄÚ´æ¡£µ±È»Ëæ×ÅÀ¬»øÊÕ¼¯Ëã·¨µÄ²»¶Ï¸Ä½øÒÔ¼°ÈíÓ²¼þÔËÐÐЧÂʵIJ»¶ÏÌáÉý£¬ÕâЩÎÊÌⶼ¿ÉÒÔÓ­Èжø½â¡£
À¬»øÊÕ¼¯µÄËã·¨·ÖÎö
JavaÓïÑԹ淶ûÓÐÃ÷È·µØ˵Ã÷JVMʹÓÃÄÄÖÖÀ¬»ø»ØÊÕËã·¨£¬µ«ÊÇÈκÎÒ»ÖÖÀ¬»øÊÕ¼¯Ëã·¨Ò»°ãÒª×ö2¼þ»ù±¾µÄÊÂÇ飺£¨1£©·¢ÏÖÎÞÓÃÐÅÏ


Ïà¹ØÎĵµ£º

ʹÓà Java ¶Ô Linux ÏÂÎļþ±àÂë¸ñʽ½øÐÐÅúÁ¿×ª»»

ʹÓà Java ¶Ô Linux ÏÂÎļþ±àÂë¸ñʽ½øÐÐÅúÁ¿×ª»»
        ²âÊÔʹÓÃ˵Ã÷£º
        1¡£½« ×Ö·û¼¯±àÂë¸ñʽΪ GB2312 µÄÎļþ test0.java£¬test1.java£¬test2.java ·ÅÔÚ /home/defonds/tmp/test Ŀ¼Ï£¨test0.java£¬test1.java£¬test2.java ×÷Õß¿ÉÒÔ ......

Ò»¸ö¼òµ¥µÄJava·ÂÕæ³ÌÐò

ÕâÊÇÒ»¸ö¼òµ¥µÄ·ÂÕæ³ÌÐò:
ÔÚÕâ¸ö·ÂÕæ³ÌÐòÖÐ,»¨Ô°Î¯Ô±»á¶¼Ï£ÍûÁ˽âÿÌìͨ¹ý´óÃŽøÈ빫԰µÄ×ÜÈËÊý.ÿ¸ö´óÃŶ¼ÓÐÒ»¸öÊ®×Ö
תÃÅ»òijÖÖÆäËûÐÎʽµÄ¼ÆÊýÆ÷,²¢ÇÒÈκÎÒ»¸öÊ®×ÖתÃŵļÆÊýÆ÷µÝÔöʱ,¾Í±íʾ¹«Ô°ÖеÄ×ÜÈËÊýµÄ¹²Ïí
¼ÆÊýÖµÒ²»áµÝÔö
package OrnamentalGarden;
import java.util.Random;
/**
* ÕâÀïʹÓõ¥¸öµ ......

Java ÀíÂÛÓëʵ¼ù: ÕýȷʹÓà Volatile ±äÁ¿

Java™ ÓïÑÔ°üº¬Á½ÖÖÄÚÔÚµÄͬ²½»úÖÆ£ºÍ¬²½¿é£¨»ò·½·¨£©ºÍ volatile ±äÁ¿¡£ÕâÁ½ÖÖ»úÖƵÄÌá³ö¶¼ÊÇΪÁËʵÏÖ´úÂëÏ̵߳ݲȫÐÔ¡£ÆäÖÐ Volatile ±äÁ¿µÄͬ²½ÐԽϲµ«ÓÐʱËü¸ü¼òµ¥²¢ÇÒ¿ªÏú¸üµÍ£©£¬¶øÇÒÆäʹÓÃÒ²¸üÈÝÒ׳ö´í¡£ÔÚÕâÆÚµÄ Java ÀíÂÛÓëʵ¼ù
ÖУ¬Brian Goetz ½«½éÉܼ¸ÖÖÕýȷʹÓà volatile ±äÁ¿µÄģʽ£¬²¢Õë¶ÔÆäÊÊÓ ......

Àí½âJavaÀà¼ÓÔØÔ­Àí

µÚÒ»²¿·Ö. Ìáʾ
ÎÒÐèÒª¶ÁÕâƪÎÄÕÂÂð£¿
JavaÀà¼ÓÔØÆ÷¶ÔJavaϵͳµÄÔËÐÐÊÇÖÁ¹ØÖØÒªµÄ£¬µ«ÊÇÈ´³£³£±»ÎÒÃǺöÂÔ¡£JavaÀà¼ÓÔØÆ÷¸ºÔØ
ÔÚÔËÐÐʱ²éÕҺͼÓÔØÀà¡£×Ô¶¨ÒåÀà¼ÓÔØÆ÷¿ÉÒÔÍêÈ«¸Ä±äÀàµÄ¼ÓÔØ·½Ê½£¬ÒÔ×Ô¼ºÏ²»¶µÄ·½Ê½À´
¸öÐÔ»¯ÄãµÄJavaÐéÄâ»ú¡£±¾ÎļòÒªµÄ½éÉÜJavaÀà¼ÓÔØÆ÷£¬È»ºóͨ¹ýÒ»¸ö¹¹Ôì×Ô¶¨ÒåÀà¼ÓÔØÆ÷
µÄÀý×ÓÀ´ËµÃ÷£¬Õâ ......

Àí½âJavaÀà¼ÓÔØÔ­Àí

µÚÒ»²¿·Ö. Ìáʾ
ÎÒÐèÒª¶ÁÕâƪÎÄÕÂÂð£¿
JavaÀà¼ÓÔØÆ÷¶ÔJavaϵͳµÄÔËÐÐÊÇÖÁ¹ØÖØÒªµÄ£¬µ«ÊÇÈ´³£³£±»ÎÒÃǺöÂÔ¡£JavaÀà¼ÓÔØÆ÷¸ºÔØ
ÔÚÔËÐÐʱ²éÕҺͼÓÔØÀà¡£×Ô¶¨ÒåÀà¼ÓÔØÆ÷¿ÉÒÔÍêÈ«¸Ä±äÀàµÄ¼ÓÔØ·½Ê½£¬ÒÔ×Ô¼ºÏ²»¶µÄ·½Ê½À´
¸öÐÔ»¯ÄãµÄJavaÐéÄâ»ú¡£±¾ÎļòÒªµÄ½éÉÜJavaÀà¼ÓÔØÆ÷£¬È»ºóͨ¹ýÒ»¸ö¹¹Ôì×Ô¶¨ÒåÀà¼ÓÔØÆ÷
µÄÀý×ÓÀ´ËµÃ÷£¬Õâ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ