java Ï̵߳ÄÉè¼Æģʽ
¾Í¶àÏß³ÌÀ´Ëµ£¬ÎÒÃÇ¿ªÊ¼ÉèÏëÖ»ÓÐÁ½¸öỊ̈߳¨>2ʱÊDz»ÊÇËãÊýѧ¹éÄÉ·¨£¿£©ÄÇôÈç¹ûÁ½¸ö¶ÀÁ¢µÄÏ̻߳ᷢÉúʲôÄØ£¿
1¡£µ±Ò»¸öÏ߳̽øÈëmoniter£¨Ò²¾ÍÊÇ˵վÓÃÒ»¸öobject£©£¬ÁíÒ»¸öÏß³ÌÖ»Óеȴý»ò·µ»Ø£¬¶øÎÒÃÇ°Ñ·µ»Ø¾Í³ÆΪһÖÖģʽ£¬ÕâÖÖģʽµÄÓ¢ÎÄÊÇBalking¡£
2¡£ÕâÁ½¸öÏ߳̿ÉÒÔÊÇÓÐÐòµÄÖ´ÐУ¬¶ø²»ÊÇÈÃOSÀ´µ÷¶È£¬ÕâʱÎÒÃÇÒªÓÃÒ»¸öobjectÀ´µ÷¶È£¬ÕâÖÖģʽ³ÆΪScheduler¡££¨Õâ¸ö´Ê¼°Æ京ÒåÆäʵOSÖоÍÓУ©¡£
3¡£Èç¹ûÕâÁ½¸öÏß³Ìͬʱ¶ÁÒ»¸ö×ÊÔ´£¬ÎÒÃÇ¿ÉÒÔÈÃËûÃÇÖ´ÐУ¬µ«Èç¹ûͬʱдµÄ»°£¬Äã±Õ×ÅÑÛ¾¦¶¼»áÖªµÀ¿ÉÄܳöÏÖÎÊÌ⣬ÕâʱÎÒÃǾÍÒªÓÃÁíÒ»ÖÖģʽ£¨Read/Write Lock£©¡£
4¡£Èç¹ûÒ»¸öÏß³ÌÊÇΪÁíÒ»¸öÏ̷߳þÎñµÄ»°£¬±ÈÈçIEÖиºÔðÊý¾Ý´«ÊäµÄÏ̺߳ͽçÃæÏÔʾµÄỊ̈߳¬µ±Ò»¸öͼƬûÓд«Íêʱ£¬ÁíÒ»¸öÏ߳̾ÍÎÞ·¨ÏÔʾ£¬ÖÁÉÙÊDz¿·ÖûÓд«Íê¡£ÄÇôÕâʱÎÒÃÇÒªÓÃÒ»¸öģʽ³ÆΪÉú²úÕߺÍÏû·ÑÕߣ¬Ó¢ÎÄÊÇProducer-Consumer¡£
5¡£Á½¸öÏ̵߳ÄÏûÍöÒ²¿ÉÒÔ²»ÊÇÍêÈ«ÓÖOSÀ´¿ØÖƵģ¬ÕâʱÎÒÃÇÐèÒª¸ø³öÒ»¸öÌõ¼þ£¬Ê¹µÃÿ¸öÏß³ÌÔÚ·ûºÏÌõ¼þÊDzÅÏûÍö£¬Ò²¾ÍÊÇÓÐÐòµÄÏûÍö£¬ÎÒÃdzÆΪTwo-Phase Termination¡£
ÄÇôÓÐÕâ5¸öÏß³ÌÄ£ÐÍ£¬»ù±¾ÉÏ¿ÉÒÔÓõ½´ó¶àÊý±à³ÌÈÎÎñÖС£ÎÒÐèÒªÖ¸³öµÄÈýµãÊÇ£º
1¡£´Ó¸ß²ã´ÎÉÏÎÒÃÇ¿ÉÒÔÔÙÑéÖ¤ÊÇ·ñº¬¸ÇÁËËùÓеÄÇé¿ö¡£
2¡£Æäʵģʽ²»ÊÇÍêÈ«¹Ì¶¨µÄ»òÕß˵Ïó¶¨ÂÉÒ»Ñù£¬¶øģʽ¿ÉÒÔΪ²»Í¬µÄÇé¿ö½øÐÐÊʵ± µÄµ÷ÕûºÍ×éºÏ£¬Ä¿µÄÊÇΪÁ˼ò½àºÍ¸ßЧ¡£
3¡£Ñ§Ï°Ä£Ê½ÊÇΪÁ˾߱¸¸üºÃµÄ·ÖÎöÎÊÌâµÄÄÜÁ¦¡£
¶øËƺõÕâЩÀ´×ÔÎ÷·½µÄ¼¼Êõ£¬²¢ÇÒÊÇÄ¿Ç°µÄ£¬ÎÒÃÇÓÐûÓÐÄØ£¿ÆäʵÎÒ¸öÈËÓиö´óµ¨µÄÍƲ⣬ÎÒÈÏΪÎÒÃÇ×æÏȵġ¶Ëï×Ó±ø·¨¡·¾ÍÊǺܺÃÉè¼Æģʽ£¬ÒòΪËü·ûºÏÉè¼ÆģʽÐèÒªµÄ»ù±¾ÌØÕ÷£¬¾ÍÊÇÔÚÌض¨µÄÌõ¼þÏ£¬ÓÃijÖÖÌض¨µÄ·½Ê½ºÏÀíÇÒ¸ßЧµÄ½â¾öÎÊÌâ¡£Ö»²»¹ýÒ»ÊÇÓÃÔÚ¾üÊÂÉÏ£¬¶þÊÇÍ걸ÐÔ·½ÃæÎÒÃÇ»¹Ã»Ñо¿¡£µ«ÎÒÈÏΪÎÒÃÇÖÁÉÙûÓкܺõÄÀ©Õ¹ºÍ½øÐÐÀà±ÈʽµÄÓ¦Ó㬷ñÔò½ñÌì¿ÉÄÜÊÇÎÒÃÇÖйúÈ˽ÌÍâ¹úÈËʲôÊÇÉè¼Æģʽ¡£
Àà±ÈµÄ·½·¨Êµ¼ÊÉÏÊÇ·¢Ã÷»ò·¢Ïֵij£Ó÷½·¨¡£²»ÖªÄÜ·ñÈÃÄã¸Ð¾õµ½ÆäʵÍâ¹úµÄ¼¼Êõ²¢²»ÊÇÄÇôµÄÉñÃØ£¬Ò²ÐíÎÒÃÇ´Ó×ÔÉíµÄÎÄ»¯µ±ÖÐÍÚ¾ò³öµÄ¶«Î÷Ì«ÉÙÁË¡£
P.S.¸üÉîÒ»²½µÄÑо¿Äã¿ÉÒԲο¼Doug Lea. <<Concurrent Programming in Java>>.
Ïà¹ØÎĵµ£º
JavaÓïÑÔÒýÈëÁËJavaÐéÄâ»ú£¬¾ßÓпçƽ̨ÔËÐеŦÄÜ£¬Äܹ»ºÜºÃµØÊÊÓ¦¸÷ÖÖWebÓ¦Óá£Í¬Ê±£¬ÎªÁËÌá¸ßJavaÓïÑÔµÄÐÔÄܺͽ¡×³ÐÔ£¬»¹ÒýÈëÁËÈçÀ¬»ø»ØÊÕ»úÖƵÈй¦ÄÜ£¬Í¨¹ýÕâЩ¸Ä½øÈÃJava¾ßÓÐÆä¶ÀÌصŤ×÷ÔÀí¡£
1£®JavaÐéÄâ»ú
JavaÐéÄâ»ú£¨Java Virtual Machine£¬JVM£©ÊÇÈí¼þÄ£ÄâµÄ¼ÆËã»ú£¬Ëü¿ÉÒÔÔÚÈκδ¦ÀíÆ÷ÉÏ£¨ÎÞÂÛÊÇÔÚ¼ÆËã»úÖл ......
Ò»¡¢final
¸ù¾Ý³ÌÐòÉÏÏÂÎÄ»·¾³£¬Java¹Ø¼ü×ÖfinalÓГÕâÊÇÎÞ·¨¸Ä±äµÄ”»òÕß“ÖÕ̬µÄ”º¬Ò壬Ëü¿ÉÒÔÐÞÊηdzéÏóÀà¡¢·Ç³éÏóÀà³ÉÔ±·½·¨ºÍ±äÁ¿¡£Äã¿ÉÄܳöÓÚÁ½ÖÖÀí½â¶øÐèÒª×èÖ¹¸Ä±ä£ºÉè¼Æ»òЧÂÊ¡£
finalÀ಻Äܱ»¼Ì³Ð£ ......
ѧϰjavaµÄ30¸öÄ¿±ê----Èç¹ûÕâ30ÌõÄã×öµÄ²î²»¶àÁË£¬jAVAˮƽ¾Íµ±È»²»ÓÃ˵ÁË£¬ºÃºÃŬÁ¦°É
1.ÄãÐèÒª¾«Í¨ÃæÏò¶ÔÏó·ÖÎöÓëÉè¼Æ(OOA/OOD)¡¢É漰ģʽ(GOF£¬J2EEDP)ÒÔ¼°×ÛºÏģʽ¡£ÄãÓ¦¸ÃÊ®·ÖÁ˽âUML£¬ÓÈÆäÊÇclass£¬object£¬interactionÒÔ¼°statediagrams¡£
¡¡¡¡2.ÄãÐèҪѧϰJAVAÓïÑԵĻù´¡ÖªÊ¶ÒÔ¼°ËüµÄºË ......
×ܽáÒ»£º
Java IOµÄÒ»°ãʹÓÃÔÔò£º
Ò»¡¢°´Êý¾ÝÀ´Ô´£¨È¥Ïò£©·ÖÀࣺ
1¡¢ÊÇÎļþ£º FileInputStream, FileOutputStream, FileReader, FileWriter
2¡¢ÊÇbyte[]£ºByteArrayInputStream, ByteArrayOutputStream
3¡¢ÊÇChar[]: CharArrayReader, CharArrayWriter
4¡¢ÊÇString: StringBufferInputStream, StringReader, StringW ......