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
Ïà¹ØÎĵµ£º
2008 Äê 6 ÔÂ 24 ÈÕ
ÔÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......
1. ·ç¸ñÎñ±Ø±£³ÖÒ»¹áÐÔ(Consistent)
Ç°Ãæ˵µ½µÄÄǸöÅóÓѵÄÎÊÌ⣬¾ÍÊÇ·ç¸ñÒ»¹áÐÐÎÊÌâ¡£ÆäʵËûµÄ·ç¸ñ£¬±¾À´Ò²Ã»ÓÐʲô
ÎÊÌ⣬µ«ÔÚÏîÄ¿ÀºÍÆäËû³ÌÐòÔ±µÄ³ÌÐòµÄ·ç¸ñ£¬ÏÔµÃìçÒ죬ÄǾʹæÔÚÎÊÌâÁË¡£
±ÈÈçÕâ¸öËõ½ø£¬ÓÖ±ÈÈç±äÁ¿ÃüÃû·½·¨£¬²»Í¬µÄÀ࣬²»Í¬µÄMethodsÀ¸÷×Ô²»Í¬£¬
Õâ³ÌÐò¾ÍºÜÄÑ¿´ÁË¡£ËùÒÔÒ»µ©ÄãÑ¡ÔñÁ ......
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 ......
¾õµÃÁôÑÔºÜÓеÀÀí£¬ÎÄÕºÜÕÜÀí£¬Ò»²¢×ªÔØ ½¨Òé¶ÁÕß¿´ÔÎĵØÖ·
×÷Õߣº ÈîÒ»·å
ÈÕÆÚ£º 2008Äê12Ô 7ÈÕ
ÏÂÃæµÄÎÄÕÂÊÇMore Joel on SoftwareÒ»ÊéµÄµÚ8ƪ¡£
ÎÒ¾õµÃ·ÒëÄѶȺܴó£¬ÕûÕûÁ½¸ö¹¤×÷ÈÕ£¬Ã¿Ìì8СʱÒÔÉÏ£¬²ÅÒë³öÁË5000×Ö¡£³ýÁËJoel´óÁ¿Ê¹ÓÃÙµÓÁíÒ»¸öÔÒòÊÇÔÎÄÉæ¼°"±à³ÌÔÀí"£¬ºÃ¶à¶«Î÷ÎÒ¸ù±¾²»¶®¡£Ï£ ......