modified: ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
modified: ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java Threadsteuerung veranendert, so dass möglichst veile Threads gleichzeitig laufen. Müsste noch verbessert werden können.
This commit is contained in:
parent
00bbd5279f
commit
c68d773486
@ -39,8 +39,8 @@ public class TypeUnify2Task extends TypeUnifyTask {
|
|||||||
return new HashSet<>(); }
|
return new HashSet<>(); }
|
||||||
else
|
else
|
||||||
*/
|
*/
|
||||||
|
//writeLog("xxx");
|
||||||
noOfThread--;
|
//noOfThread--;
|
||||||
synchronized (usedTasks) {
|
synchronized (usedTasks) {
|
||||||
if (this.myIsCancelled()) {
|
if (this.myIsCancelled()) {
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
|
@ -904,9 +904,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
noOfThread--;
|
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
res = forkOrig.join();
|
||||||
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 1");
|
forkOrig.writeLog("final Orig 1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
@ -919,7 +920,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
writeLog("fork_res: " + fork_res.toString());
|
writeLog("fork_res: " + fork_res.toString());
|
||||||
@ -932,7 +935,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
fork.closeLogFile();
|
fork.closeLogFile();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
if(parallel && (variance == -1) && noOfThread <= MaxNoOfThreads) {
|
if(parallel && (variance == -1) && noOfThread <= MaxNoOfThreads) {
|
||||||
Set<TypeUnify2Task> forks = new HashSet<>();
|
Set<TypeUnify2Task> forks = new HashSet<>();
|
||||||
@ -1007,9 +1010,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
noOfThread--;
|
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
res = forkOrig.join();
|
||||||
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig -1");
|
forkOrig.writeLog("final Orig -1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
@ -1022,7 +1026,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
writeLog("fork_res: " + fork_res.toString());
|
writeLog("fork_res: " + fork_res.toString());
|
||||||
@ -1035,7 +1041,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
fork.closeLogFile();
|
fork.closeLogFile();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) {
|
if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) {
|
||||||
writeLog("var2einstieg");
|
writeLog("var2einstieg");
|
||||||
@ -1080,9 +1086,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
/* FORK ANFANG */
|
/* FORK ANFANG */
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
noOfThread--;
|
|
||||||
writeLog("wait "+ forkOrig.thNo);
|
writeLog("wait "+ forkOrig.thNo);
|
||||||
|
noOfThread--;
|
||||||
res = forkOrig.join();
|
res = forkOrig.join();
|
||||||
|
//noOfThread++;
|
||||||
forkOrig.writeLog("final Orig 2");
|
forkOrig.writeLog("final Orig 2");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
@ -1094,7 +1101,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
forks.forEach(x -> writeLog("wait: " + x.thNo));
|
||||||
for(TypeUnify2Task fork : forks) {
|
for(TypeUnify2Task fork : forks) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
noOfThread--;
|
||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + new Integer(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
add_res.add(fork_res);
|
add_res.add(fork_res);
|
||||||
@ -1102,7 +1111,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
fork.closeLogFile();
|
fork.closeLogFile();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
//parallel = false; //Wenn MaxNoOfThreads erreicht ist, sequentiell weiterarbeiten
|
//parallel = false; //Wenn MaxNoOfThreads erreicht ist, sequentiell weiterarbeiten
|
||||||
elems.add(a); //PL 2019-01-16 muss das wirklich hin steht schon in Zeile 859 ja braucht man siehe Zeile 859
|
elems.add(a); //PL 2019-01-16 muss das wirklich hin steht schon in Zeile 859 ja braucht man siehe Zeile 859
|
||||||
|
Loading…
Reference in New Issue
Block a user