åºæ¬ç¥è ããã»ã¹ ããã°ã©ã ã®å®è¡åä½ åºæã®ã¡ã¢ãªç©ºéãæã¤(ãªã½ã¼ã¹ãå ±æããªã) ãã«ãããã»ã¹ã®å ´åãç©ç/ä»®æ³ã¡ã¢ãªé åéã®ã¢ãã¬ã¹è§£æ±ºã®ãªã¼ãã¼ããããé«ãã ã¹ã¬ãã ããã»ã¹ã®å®è¡åä½ å ±éã®ã¡ã¢ãªç©ºéãæã¤ï¼ãªã½ã¼ã¹ãå ±æããï¼ ãã«ãã¹ã¬ããã®å ´åãç©ç/ä»®æ³ã¡ã¢ãªé åéã®ã¢ãã¬ã¹è§£æ±ºã¯çºçããªãã ã¦ã¼ã¶ã¼ã¹ã¬ãã ã¦ã¼ã¶ã¼ç©ºéï¼ã¢ããªã±ã¼ã·ã§ã³ãå©ç¨ããã¡ã¢ãªç©ºéï¼ãå©ç¨ 1ã¤ã®ããã»ã¹ã«è¤æ°ã®ã¹ã¬ããããã£ã¦ãã1ã¤ã®ã¹ã¬ããããå®è¡ãããªãã OSã«ã¼ãã«ãä»ããªãã¹ã¬ããåãæ¿ãã®ãããã¹ã¬ããåãæ¿ãã«ä¼´ããªã¼ãã¼ããããå°ãªãã ä»®æ³VMä¸ã§å®è¡ãããã¹ã¬ãããã°ãªã¼ã³ã¹ã¬ããã¨å¼ã¶ã ã«ã¼ãã«ã¹ã¬ãã ã«ã¼ãã«ç©ºéï¼ã«ã¼ãã«ãå©ç¨ããã¡ã¢ãªç©ºéï¼ãå©ç¨ 1ã¤ã®ããã»ã¹ã«è¤æ°ã®ã¹ã¬ãããããå ´åãåæã«è¤æ°ï¼CPUã³ã¢æ°åï¼ã®ã¹ã¬ãããå®è¡ã§ããã OS
2. ç®æ¬¡ ï® JavaVM ã«ãããããã¯ã®é²å ï® ãã©ã³ã¶ã¯ã·ã§ãã«ã¡ã¢ãªï¼ TM ï¼ã¨ã¯ ï® Haswell ã§ã®ãã©ã³ã¶ã¯ã·ã§ãã«ã¡ã¢ãª ï® Java ã§ãã©ã³ã¶ã¯ã·ã§ãã«ã¡ã¢ãªã使ã ï® JDK8/9 ã®åå ï® ã¾ã¨ã 2 Copyright 2014 FUJITSU LIMITED 3. 3 Copyright 2014 FUJITSU LIMITED JavaVM ããã¯æ©æ§ã®é²å 第ä¸ä¸ä»£ ããã¼ãã㯠第äºä¸ä»£ ã·ã³ãã㯠第ä¸ä¸ä»£ ãã¤ã¢ã¹ãã㯠第åä¸ä»£ ï¼ï¼ï¼ JDK1.0-1.2 JDK1.3.1 HotSpot VM JDK5.0 HotSpot VM 4. 競åã¨å ±æï¼å®ç¾©ï¼ ï® ããã¯ç«¶åã¨ã¯ ï®è¤æ°ã®ã¹ã¬ãããåæ ã«åãããã¯ãåã ï® ããã¯å ±æã¨ã¯ ï®è¤æ°ã®ã¹ã¬ãããåã ããã¯ã使ç¨ãã 4 Copyright 2014 FUJITSU LIM
4. ThreadãããTask for (int i = 0; i < num; i++) { var t = new Thread(_ => b[i] = F(a[i]) ); } for (int i = 0; i < num; i++) { Task.Run(() => b[i] = F(a[i]) ); } Ãæªãä¾ âè¯ã(ã¾ã ãã·â»ãª)ä¾ ãã¼ã¿ã®æ°ã ã ã¹ã¬ããä½æ Threadã§ãªã Taskå©ç¨ â» ãã®å ´åãParallelã¯ã©ã¹ãParallel.Enumerableã¯ã©ã¹ã使ãããã 5. ThreadãããTask for (int i = 0; i < num; i++) { var t = new Thread(_ => b[i] = F(a[i]) ); } for (int i = 0; i < num; i++) { Task.Run(() => b[
Commons DBCP ã¯ããã¼ã¿ãã¼ã¹ã®ã³ãã¯ã·ã§ã³ã»ãã¼ãªã³ã°ãæ±ãã©ã¤ãã©ãªã§ãã Tomcat ã§æ¨æºæ¡ç¨ããã¦ãã¾ãã åä½èª¬æ åä½ãç°¡åã«èª¬æãã¾ãã ã¯ã©ã¤ã¢ã³ãããæ¥ç¶è¦æ±ãçºçããå ´å ⦠getConnection() 1. DBCPã¯ããã¼ã«å ã«ç©ºãæ¥ç¶ããããç¢ºèª 2. ããã°ãããè¿ãããã®æãã®æ¥ç¶ã¯ ã¢ã¯ãã£ã ã¨ãªã 3. ãã¼ã«å ã«ç©ºãæ¥ç¶ãç¡ããã°ãæ°ãã«æ¥ç¶ãä½ã£ã¦è¿ã ã¯ã©ã¤ã¢ã³ãããåæè¦æ±ãçºçããå ´å ⦠conn.close() 1. åæè¦æ±ã®ãã£ãæ¥ç¶ããã¼ã«å ã«ä¿ç®¡ããããã®æãã®æ¥ç¶ã¯ ã¢ã¤ãã« ã¨ãªã 2. ãããã¼ã«å ã« maxIdle 以ä¸ã®æ¥ç¶ãæºã¾ã£ããããã以ä¸ã«ãªããªãããã«æ¥ç¶ãåé¤ãã æ¥ç¶ç£è¦ã¹ã¬ãã DBCPã«ã¯æ¥ç¶ç£è¦ã¹ã¬ããã¨ãããã®ãåå¨ãã¾ãã ããã¯ä¸å®æéæ¯ã«ãã¼ã«å ã®ã¢ã¤ãã«æ¥ç¶ããã§ãã¯ããã
ãããã»ã¹ã¯å®è¡ä¸ã®ããã°ã©ã ãæ½è±¡åãããã®ã§ãããããã¯ç§ãèæ¸ "Linux Kernel Development" ã®ä¸ã§ä½¿ã£ãæ¯å©ã ããã¤ããªã¤ã¡ã¼ã¸ãä»®æ³ã¡ã¢ãªãå種ã«ã¼ãã«ãªã½ã¼ã¹ãé¢é£ä»ããããã»ãã¥ãªãã£ã³ã³ããã¹ãã¨ãã£ããã®ã ãã¹ã¬ããã¯ããããã»ã¹ã®ä¸ã®å®è¡åä½ãã§ãä»®æ³ããã»ããµãã¹ã¿ãã¯ãããã°ã©ã ã®ç¶æ ã ãè¨ãæããã°ãããã»ã¹ã¯å®è¡ããããã¤ããªã§ãããã¹ã¬ããã¯OSã®ããã»ã¹ã¹ã±ã¸ã¥ã¼ã©ãã¹ã±ã¸ã¥ã¼ãªã³ã°ã§ããæå°ã®å®è¡åä½ã§ããã¨è¨ããã ããã»ã¹ã¯1ã¤ä»¥ä¸ã®ã¹ã¬ãããæã£ã¦ãããã·ã³ã°ã«ã¹ã¬ããã®ããã»ã¹ã§ã¯ã1ã¤ã®ããã»ã¹ã¯1ã¤ã®ã¹ã¬ããããæã£ã¦ããªããã¤ã¾ããã¹ã¬ããã¯ããã»ã¹ã§ããã¨è¨ã£ã¦ãã¾ãããå®è¡ãããã®ã¯ä½ã1ã¤ã®ãã¨ã ãã ããã«ãã¹ã¬ããã®ããã»ã¹ã§ã¯ãããã»ã¹ã¯è¤æ°ã®ã¹ã¬ãããæã£ã¦ãããã¤ã¾ããè¤æ°ã®ä½ããå®è¡ããã¦ããã ç¾ä»£ã®
Cè¨èªãPerlã®fork&execã®ããã«ãããã»ã¹ãåæã«å®è¡ããããåæãåãããã«å¾ ã¡åãããå¦çãè¡ã£ã¦ã¿ã¾ãããã Javaè¨èªã§ã¯ããã«ãã¹ã¬ããæ©è½ãè¨èªã«å«ã¾ãããããæ¯è¼çãããã«ããã°ã©ã ã§ãã¾ãã Javaã®å ´åã2ã¹ã¬ããã®åæã¨ã3ã¹ã¬ãã以ä¸ã®åæã§ãå¦çãç°ãªãã¾ãã ãã«ãã¹ã¬ããããã°ã©ãã³ã°ãåç §ãã¦ãã ããã 2ã¹ã¬ããã®åæ 2ã¤ã®ã¹ã¬ããéã®åæã¯ãjoinã¡ã½ããã使ã£ã¦ãããç°¡åã«å®ç¾ã§ãã¾ãã åã¹ã¬ãããèµ·åã並è¡å¦çãè¡ãã親ã¹ã¬ãããåã¹ã¬ããã®çµäºãå¾ ã£ã¦ã次ã®å¦çãè¡ãããã°ã©ã ãä½æãã¦ã¿ã¾ãã å¦çå 容ã¯ãHello World!ã表示ããã ãã§ãããã¹ã¬ããåã表示ããããã«ãã¦ãã¾ãã åã¹ã¬ããã®å¦çã®æµãã¯ã以ä¸ã®ããã«ãªãã¾ãã 親ã¹ã¬ããã¯ãjoinã¡ã½ããã§ãåã¹ã¬ãããçµäºããã¾ã§å¾ ã¡ã¾ãã 親ã¹ã¬ãã åã¹ã¬
æ¦è¦ ä¾é¡ã¨ãã¦ãé åpriceã«è¨å®ããã課ç¨åã®ä¾¡æ ¼ãä¸ã¤ã¥ã¤æãåºãå¤æ°workAreaã«ä»£å ¥ããworkAreaã«ä»£å ¥ãããä¾¡æ ¼ã«æ¶è²»ç¨ã課ç¨ããå¦çãè¡ãã¾ãã課ç¨åã®ä¾¡æ ¼ãæãåºãworkAreaã«ä»£å ¥ããå¦çãpricePutã¡ã½ããã«ã¦ãworkAreaã«ä»£å ¥ãããä¾¡æ ¼ã«èª²ç¨ããå¦çãpriceGetã¡ã½ããã«ã¦è¡ãã¾ãã ãã®å¦çãè¡ãä¸ã§ã¹ã¬ããã®å®è¡é åºãå¶å¾¡ããã«å®è¡ããå ´åã¯ãã¹ã¬ããã®å®è¡é åºã¯Javaã®åä½ããã·ã¹ãã ã®ã¹ã±ã¸ã¥ã¼ã«æ©è½ã«ä¾åãããããå¿ ãããpricePutã¡ã½ããã¨priceGetã¡ã½ããã交äºã«å®è¡ãããã¨ã¯éãã¾ããããã®å ´åãå®è¡çµæã¯ä»¥ä¸ã®ããã«ãªãå ´åãããã¾ãã 課ç¨å¾ä¾¡æ ¼ã¯105.0åã§ãã 課ç¨å¾ä¾¡æ ¼ã¯210.0åã§ãã # pricePutã§æ°ããä¾¡æ ¼ãè¨å®ãããå㫠課ç¨å¾ä¾¡æ ¼ã¯210.0åã§ãã # priceGetã
æçãåãè ãTomcatãåã¯ä¸ä½ãã©ã®ç¨åº¦ã¾ã§å¤ãã®ã¹ã¬ãããä½æãã¦ãªã¯ã¨ã¹ãããã°ãäºãåºæ¥ããã ãï¼ ã¾ãæåã«Linuxã®ã¹ã¬ããã©ã¤ãã©ãªã«ã¤ãã¦è»½ãè¨åãã¦ãããã°ãªãã¾ããLinuxã®ã¹ã¬ããã©ã¤ãã©ãªã«ã¯äºç¨®é¡ããã ã¾ããæ¨ä»ã®Linuxï¼Kernel 2.6åã³ãã以éï¼ã§ç¨ãããã¦ããNTPLï¼Native POSIX Thread Libraryï¼ãããã¯1:1ã¢ãã«ã®ã¹ã¬ããã©ã¤ãã©ãªã§ãã¹ã¬ãããããã»ã¹ã¨ãã¦å®è£ ãã¦ãããSolarisãªã©ã§ã¯ããããLWP(Light Weight Process)ããã¦ã¹ã¬ãããå®è£ ãã¦ããã®ã ããã©ããLinuxã§ã¯ã¹ã¬ãããããã»ã¹ãåãtask_structæ§é ä½ã¨ãã¦æ±ããCOEï¼Context Of Executionãå®è¡ã³ã³ããã¹ãï¼ãããããç¨ã«å²ãå½ã¦ã¦ç¨ãã¦ããããã ãåããã»ã¹ã¯ç¬ç«ããä»®æ³ã¡ã¢ãª
æ¦è¦ pthreadã¯ã¯ã½ã ã¨ããã®ãã²ãã²ãã¨å®æãã¦ããâ¦ããã§ã¯ãªããã©ã Win32ã®ã¹ã¬ããã¨æ¯ã¹ãã¨å¾®å¦ãªæããæããªãã®ã§ãLinuxã®ã¹ã¬ããã使ãã°ãã£ã¨ãããã¼ã«ãªããããã¨ãããããªè©±ã pthreadãã¯ã½ãªçç± pthread㯠Win32 ã®ã¹ã¬ããã«æ¯ã¹ã¦ããã¤ãå¾®å¦ã ã¨æãããç¹ããããã¾ãã¯ãã®ç¹ã«ã¤ãã¦æ¸ãããã¨æã£ãã®ã ãã©ã大ä½[ãã]ã«æ¸ãã¦ãã£ãã®ã§ãåæã ããã¦ããã詳細ã¯ãªã³ã¯å ãèªãã§ãï¼ Win32ã¹ã¬ãããWaitFor(Single/Multiple)Object(s)ã§å ¨é¨å¾ ã¦ãã®ã«å¯¾ãã¦ãpthread㯠mutexãcondãsemãjoin ã®ã©ããããããä¸ã¤ã ãããå¾ ã¦ãªã Win32ã®ãªãã¸ã§ã¯ãã¯ã·ã°ãã«ç¶æ ãä¿æãç¶ããã®ã«å¯¾ãã¦ãpthreadã®æ¡ä»¶å¤æ°ã¯ãã·ã°ãã«å¾ ã¡ã«ãªã£ã¦ããªãç¶æ ã§cond_signalãå
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}