mirror of
https://github.com/bspeice/itcs3146-project
synced 2024-12-21 22:28:14 -05:00
more thread testing code
This commit is contained in:
parent
aa872f238a
commit
33317f3f3a
14
NextFit.java
14
NextFit.java
@ -95,8 +95,8 @@ class NextFit implements baseAlgorithm
|
|||||||
memTable[currentPosition][3] = jobSize-1;
|
memTable[currentPosition][3] = jobSize-1;
|
||||||
memTable[currentPosition][4] = memTable[0][3]-memTable[0][2]+1;
|
memTable[currentPosition][4] = memTable[0][3]-memTable[0][2]+1;
|
||||||
memTable[currentPosition][5] = 1;
|
memTable[currentPosition][5] = 1;
|
||||||
Job newJob = new Job(jobTime, jobId, jobSize, memTable[s1][2], deallocateMethod, this);
|
Job newJob = new Job(jobTime, jobId, jobSize, memTable[currentPosition][2], deallocateMethod, this);
|
||||||
fillMemory(jobId, jobSize, memTable[s1][2]);
|
fillMemory(jobId, jobSize, memTable[currentPosition][2]);
|
||||||
jobArray[jobId - 1] = newJob;
|
jobArray[jobId - 1] = newJob;
|
||||||
newJob.start();
|
newJob.start();
|
||||||
memTable[currentPosition+1][0] = 0;
|
memTable[currentPosition+1][0] = 0;
|
||||||
@ -123,8 +123,8 @@ class NextFit implements baseAlgorithm
|
|||||||
memTable[currentPosition][3] = jobSize+memTable[currentPosition][2]-1;
|
memTable[currentPosition][3] = jobSize+memTable[currentPosition][2]-1;
|
||||||
memTable[currentPosition][4] = memTable[currentPosition][3]-memTable[currentPosition][2]+1;
|
memTable[currentPosition][4] = memTable[currentPosition][3]-memTable[currentPosition][2]+1;
|
||||||
memTable[currentPosition][5] = 1;
|
memTable[currentPosition][5] = 1;
|
||||||
Job newJob = new Job(jobTime, jobId, jobSize, memTable[s1][2], deallocateMethod, this);
|
Job newJob = new Job(jobTime, jobId, jobSize, memTable[currentPosition][2], deallocateMethod, this);
|
||||||
fillMemory(jobId, jobSize, memTable[s1][2]);
|
fillMemory(jobId, jobSize, memTable[currentPosition][2]);
|
||||||
jobArray[jobId - 1] = newJob;
|
jobArray[jobId - 1] = newJob;
|
||||||
newJob.start();
|
newJob.start();
|
||||||
memTable[currentPosition+1][0] = 0;
|
memTable[currentPosition+1][0] = 0;
|
||||||
@ -149,8 +149,8 @@ class NextFit implements baseAlgorithm
|
|||||||
memTable[currentPosition][0] = jobId;
|
memTable[currentPosition][0] = jobId;
|
||||||
memTable[currentPosition][1] = jobSize;
|
memTable[currentPosition][1] = jobSize;
|
||||||
memTable[currentPosition][5] = 1;
|
memTable[currentPosition][5] = 1;
|
||||||
Job newJob = new Job(jobTime, jobId, jobSize, memTable[s1][2], deallocateMethod, this);
|
Job newJob = new Job(jobTime, jobId, jobSize, memTable[currentPosition][2], deallocateMethod, this);
|
||||||
fillMemory(jobId, jobSize, memTable[s1][2]);
|
fillMemory(jobId, jobSize, memTable[currentPosition][2]);
|
||||||
jobArray[jobId - 1] = newJob;
|
jobArray[jobId - 1] = newJob;
|
||||||
newJob.start();
|
newJob.start();
|
||||||
currentPosition++;
|
currentPosition++;
|
||||||
@ -293,6 +293,7 @@ class NextFit implements baseAlgorithm
|
|||||||
}
|
}
|
||||||
tableEntries=tableEntries-s1;
|
tableEntries=tableEntries-s1;
|
||||||
|
|
||||||
|
synchronized(memTable){
|
||||||
if(memTable[tableEntries-2][5]==0 && memTable[tableEntries-1][5]==-1)
|
if(memTable[tableEntries-2][5]==0 && memTable[tableEntries-1][5]==-1)
|
||||||
{
|
{
|
||||||
memTable[tableEntries-2][3]=memTable[tableEntries-1][3];
|
memTable[tableEntries-2][3]=memTable[tableEntries-1][3];
|
||||||
@ -301,6 +302,7 @@ class NextFit implements baseAlgorithm
|
|||||||
tableEntries--;
|
tableEntries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//this method fills the memory location with the data
|
//this method fills the memory location with the data
|
||||||
private void fillMemory(int job, int size, int start)
|
private void fillMemory(int job, int size, int start)
|
||||||
|
40
jobs40.txt
Normal file
40
jobs40.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
2,1029
|
||||||
|
7,364
|
||||||
|
6,3704
|
||||||
|
3,1966
|
||||||
|
2,1644
|
||||||
|
8,4967
|
||||||
|
8,4719
|
||||||
|
7,1022
|
||||||
|
6,4983
|
||||||
|
2,3439
|
||||||
|
2,1330
|
||||||
|
8,2701
|
||||||
|
9,1963
|
||||||
|
10,1615
|
||||||
|
2,1919
|
||||||
|
1,1853
|
||||||
|
5,2029
|
||||||
|
1,835
|
||||||
|
5,4555
|
||||||
|
7,876
|
||||||
|
1,581
|
||||||
|
8,3074
|
||||||
|
5,1937
|
||||||
|
2,1874
|
||||||
|
3,3942
|
||||||
|
10,2605
|
||||||
|
8,2643
|
||||||
|
10,2648
|
||||||
|
3,2724
|
||||||
|
4,4525
|
||||||
|
2,3590
|
||||||
|
3,5034
|
||||||
|
1,1196
|
||||||
|
6,3967
|
||||||
|
3,1146
|
||||||
|
6,4342
|
||||||
|
9,1231
|
||||||
|
6,1547
|
||||||
|
9,3207
|
||||||
|
3,4139
|
Loading…
Reference in New Issue
Block a user