易截截图软件、单文件、免安装、纯绿色、仅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 解决约瑟夫问题

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感上了兴趣,因为借了一本《Thinking in java》,一直没时间看,快到还书的时候了,书总不能白借吧。看了两天,大概是扫了100多页吧。准备编写第一个java程序。
       从网上查资料,需要JDK,于是下载,安装。具体设置如下:
第 ......

Java 中的IO






<!--
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
-->

Java中的
io

我对流的理解是:源到目的地的轨迹,所以流的一端是数据源(输入流)或者接收器(输出流),另一端是
io中的某个类;这里说明下,
Scanne ......

Java编程实践应用:J2EE架构的6个最佳实践


2008-04-26 09:25 作者:superman 来源:赛迪网
[摘要] 首先,本文的目标读者是正在从事技术工作的架构师。避免讲述一些陈腐的最佳实践,例如"日常构建(build daily)"、"测试一切(test everything)"和"经常集成( integrate often)。 任何具有称职架构师的项目都有分工明确的、定义良好的团队结构。他们还为进行编 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号