文件名称:ex09
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 3kb
- 下载次数:
- 1次
- 提 供 者:
- zho***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
加分程序。请编写一个程序,先产生一个大于10的随机整数n,再产生n个随机数并存放于数组中,然后将这n个数相加,并求出这n个数的和s1, 同时计算出求s1所需的时间t1.接着让程序创建2个线程并发的进行相加运算。其中一个线程计算前一半数之和s21,后一个线程计算后一半数之和s22, 然后将s21与s22这两个数相加得到和s2,计算采用双线程进行求和运算所花费的时间t2。请比较s1和s2,以及t1和t2的大小-Bonus program. Write a program, first create a random integer greater than 10 n, then n a random number generated and stored in the array, and then add this number n, and calculate the number n and s1, and calculate the time required to seek s1 t1. then let the program creates two threads to add concurrent computing. Before the calculation of one half the number of threads and s21, after the latter half of the number of computing threads and s22, then s21 and s22 add two numbers are and s2, calculated using two-thread computing the sum of the time t2 . Compare s1 and s2, as well as the size of t1 and t2
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ex09\addProgram.class
....\addProgram.java
....\InitArray.class
....\Sum.class
ex09
....\addProgram.java
....\InitArray.class
....\Sum.class
ex09