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

Java theory and practice

1. Multiply-Thread
Locks offer two primary features: mutual exclusion and visibility. Mutual exclusion means only one thread at a time may hold a given lock, so only one thread at a time will be using the shared data. Visibility is to ensure that changes made to shared data prior to releasing a lock are made visible to another thread that subsequently acquires that lock
you must ensure that your threads spend most of their time actually doing work, rather than waiting for more work to do, or waiting for locks on shared data structures
An algorithm is said to be wait-free if every thread will continue to make progress in the face of 
arbitrary delay (or even failure) of other threads. By contrast, a lock-free algorithm requires only that some thread always make progress. (Another way of defining wait-free is that each thread is guaranteed to correctly compute its operations in a bounded number of its own steps, regardless of the actions, timing, interleaving, or speed of the other threads. This bound may be a function of the number of threads in the system; for example, if ten threads each execute the CasCounter.increment() operation once, in the worst case each thread will have to retry at most nine times before the increment is complete.)
A common technique for tuning the scalability of a concurrent application that is experiencing contention is to reduce the granularity of the lock objects used, in the hopes that more lock acquisitions will go from contended to un-contended. The conversion from locking to atomic variables achieves the same end -- by switching to a finer-grained coordination mechanism, fewer operations become contended, improving throughput. 
1.0 Thread
1.1 synchronized/wait.notify
1.2 volatile
Due to the semantics of some programming languages, the code generated by the compiler is allowed to update the shared variable to point to a partially constructed object before A has fini


Ïà¹ØÎĵµ£º

JNAʵÏÖJavaµ÷ÓÃFortran

Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ ......

´Ó½ñÈÕÆðÎÒ¿ªÊ¼ÖØÐÂʰÆðJAVAµÄÆìÖÄ£¬×£¸£ÎÒ°É£¡£¡£¡

      ½ñÌìÊǸöºÃÈÕ×Ó£¬ÎªÊ²Ã´ÕâÃ´ËµÄØ£¿ÒòΪ½ñÌì½á»éµÄÌØ±ð¶à£¬ÕæµÄÏ൱¶à¡£Ö»ÒªÊǸöÓÐÍ·ÓÐÁ³µÄ·¹µê¶¼»áÓÐÐÂÈËÔÚÄÇÀïÍê³É×Ô¼º×îÃÀÀöµÄ»ØÒä¡£µ«ÎÒµÄÐÄÇéÈ´ÈçǰÁ½ÈÕµÄÁ¬ÌìÓêÒ»Ñù×ÜÊÇÒõÒõµÄÔÚÏÂÓꡣΪÁËÄÜÈÃ×Ô¼ºÔçÈÕ×ß³öÒõö²£¬ÈÃ×Ô¼ºÄܹ»ÔÙ´Î×öÖ÷×Ô¼ºµÄÈËÉú£¬½ñÌìÎÒ¾ö¶¨Òª»Øµ½ÎÒרҵ¿ª·¢µÄµÀ·ÉÏÀ´£ ......

java ½â¾öԼɪ·òÎÊÌâ

package Pack;
import java.text.*;
import java.util.*;
import java.text.DecimalFormat;
import java.util.*;
public class Test {
/**
* @param args
*/
public static void main(String args[]) {

yuesef(50,3);
}
public static void yuesef(int n, int m) {
ArrayList<Integer ......

JAVA Socket³¬Ê±Ç³Îö

JAVA Socket³¬Ê±Ç³Îö
  Ì×½Ó×Ö»ò²å×ù(socket)ÊÇÒ»ÖÖÈí¼þÐÎʽµÄ³éÏó£¬ÓÃÓÚ±í´ïÁ½Ì¨»úÆ÷¼äÒ»¸öÁ¬½ÓµÄ“ÖÕ¶Ë”¡£Õë¶ÔÒ»¸öÌØ¶¨µÄÁ¬½Ó£¬Ã¿Ì¨»úÆ÷É϶¼ÓÐÒ»¸ö“Ì×½Ó×Ö”£¬¿ÉÒÔÏëÏóËüÃÇÖ®¼äÓÐÒ»ÌõÐéÄâµÄ“ÏßÀ”¡£JAVAÓÐÁ½¸ö»ùÓÚÊý¾ÝÁ÷µÄÌ×½Ó×ÖÀࣺServerSocket£¬·þÎñÆ÷ÓÃËü“ÕìÌý&rdquo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ