Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

javaÖÐÈçºÎʹÓÃamcharts


×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......

Javaºº×Ö´¦Àí

1¡¢×Ö·û´®³¤¶È
   String s1 = "ÎÒÊÇÖйúÈË";
   String s2 = "imchinese";
   String s3 = "imÖйúÈË";
   System.out.println(s1+":"+new String(s1).length());
   System.out.println(s2+":"+new String(s2).length());
   System.out.println(s3+ ......

´Ó½ñÈÕÆðÎÒ¿ªÊ¼ÖØÐÂÊ°Æð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ÖÐʵÏÖºÍÓ¦ÓÃ

¹²ÏíÄÚ´æÔÚJavaÖÐʵÏÖºÍÓ¦ÓÃ
Õª×Ôhttp://zc4530.javaeye.com/blog/326186 
1¡¢¹²ÏíÄÚ´æ¶ÔÓ¦Ó¦Óÿª·¢µÄÒâÒå
¶ÔÊìÖªUNIXϵͳӦÓÿª·¢µÄ³ÌÐòÔ±À´Ëµ£¬IPC£¨InterProcess Communication£©»úÖÆÊǷdz£ÊìϤµÄ£¬IPC»ù±¾°üÀ¨¹²ÏíÄÚ´æ¡¢ÐźŵƲÙ×÷¡¢ÏûÏ¢¶ÓÁС¢ÐźŴ¦ÀíµÈ²¿·Ö£¬ÊÇ¿ª·¢Ó¦ÓÃÖзdz£ÖØÒªµÄ±Ø²»¿ÉÉٵŤ¾ß¡£ÆäÖй²Ï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ