文件名称:ex09
-
所属分类:
- 标签属性:
- 上传时间:2012-11-13
-
文件大小:3.49kb
-
已下载:1次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
加分程序。请编写一个程序,先产生一个大于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
ex09/addProgram.java
ex09/InitArray.class
ex09/Sum.class
ex09
ex09/addProgram.java
ex09/InitArray.class
ex09/Sum.class
ex09
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.