Java ?????????:???fork-join???
???????????? ???????[ 2015/7/14 11:48:21 ] ???????????????
??????????????????????ó?????????????????????????????????????????????????????????????????????????衣?????????????? SQL ???????????????????????????????????????????????????????????????????С?????? I/O ????????????????????????? CPU ??????????????????£?????????????????????????????????????????????????? I/O ??????????????????????????????????????????????????????и?????????????????????????????? SUM??AVERAGE????????????????????????????????????б???????????????
????????????????????????????? SQL ????漰??????? I/O???????????? CUP ?????????? I/O ?????????????????????棬???????????? I/O ????????????? I/O ?????????????????????л?????????????? CPU ???????????????????????????????????????????????????????????????????????????????????????????????????????С???????????????????????????????????????????????????????????????????????????????????????????????????????????
????Divide and conquer
????????????? divide-and-conquer ?????????????????????н?????????????????????????????????????????????? divide-and-conquer ???????????????У?????????л????и?????Ч???????????д?????????
???????????? divide-and-conquer ??????????嵥 1 ?????
?????嵥 1. ??? divide-and-conquer ????????α????
????// PSEUDOCODE
????Result solve(Problem problem) {
????if (problem.size < SEQUENTIAL_THRESHOLD)
????return solveSequentially(problem);
????else {
????Result left?? right;
????INVOKE-IN-PARALLEL {
????left = solve(extractLeftHalf(problem));
????right = solve(extractRightHalf(problem));
????}
????return combine(left?? right);
????}
????}
???????? divide-and-conquer ??????????????????????????С??????????????????????????????????????С???????????б????ɡ???????????????з????????????????????????????????з????????????????????????????????????????????Щ?????????????????????з??????????????Э??????????????????Э?????? 0?????????????????????????????????????????????????Э???????????????????????????
????Fork-join
?????嵥 1 ?е?????????????????????? INVOKE-IN-PARALLEL ??????????????????????????????????????????????????????????????????????????ɡ????????????????????????к??????????з???????????? fork-join?????????????????????fork?????????????????????join??????????
?????嵥 2 ?????????????? fork-join ????????????????????????????????????е?????????????????????????? fork-join ????????????????????????????????????????
?????嵥 2. ??????????????????
????public class SelectMaxProblem {
????private final int[] numbers;
????private final int start;
????private final int end;
????public final int size;
????// constructors elided
????public int solveSequentially() {
????int max = Integer.MIN_VALUE;
????for (int i=start; i<end; i++) {
????int n = numbers[i];
????if (n > max)
????max = n;
????}
????return max;
????}
????public SelectMaxProblem subproblem(int subStart?? int subEnd) {
????return new SelectMaxProblem(numbers?? start + subStart??
????start + subEnd);
????}
????}
??????? subproblem() ??????и?????Щ?????????????????ú??????????????е???????С????? fork-join ????????к??????????????????????????????????? Problem ???? ??????????У??????????????????????????????????????????????????????????и????????????????????????????
?????嵥 3 ???????? fork-join ???? SelectMaxProblem ?????????Java 7 ???????????e???JSR 166 Expert Group ?????????????????????????????? jsr166y????????????????????? Java 6 ?????汾??????????????????? java.util.concurrent.forkjoin ?У???invoke-in-parallel ???????? coInvoke() ????????????ò???????????????????????ж?????ɡ?ForkJoinExecutor ?? Executor ???????????????????????????????????????????????????????????????????????????????????????? ForkJoinExecutor ??????????????
????fork-join ???????????? ForkJoinTasks????????Щ??????????????????????е?????????? RecursiveAction ???????? non-result-bearing ???????е??????RecursiveTask ???? result-bearing ???????????????? fork-join ????????? CyclicAction??AsyncAction ?? LinkedAsyncAction?????ù?????????????????????????? Javadoc????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????