mirror of
https://github.com/bspeice/itcs3146-project
synced 2024-12-22 14:48:21 -05:00
Add synchronization to dpturnbull's code
This commit is contained in:
parent
afc1ffcf54
commit
e6e1a8b634
@ -275,11 +275,13 @@ class FirstFit implements baseAlgorithm
|
|||||||
jobSize=size;
|
jobSize=size;
|
||||||
startLoc=start;
|
startLoc=start;
|
||||||
|
|
||||||
|
synchronized(memory){
|
||||||
for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
|
for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
|
||||||
{
|
{
|
||||||
memory[fillCount]=jobId;
|
memory[fillCount]=jobId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//this method returns a String of all the elements stored in the object
|
//this method returns a String of all the elements stored in the object
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@ -62,7 +62,7 @@ class NextFit implements baseAlgorithm
|
|||||||
if(jobSize>memSize)
|
if(jobSize>memSize)
|
||||||
{
|
{
|
||||||
System.out.println("\n\n*********************************************************"+
|
System.out.println("\n\n*********************************************************"+
|
||||||
" THIS JOB IS TO LARGE TO FIT INTO MEMORY"+
|
" THIS JOB IS TOO LARGE TO FIT INTO MEMORY"+
|
||||||
"*********************************************************");
|
"*********************************************************");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
@ -293,12 +293,13 @@ class NextFit implements baseAlgorithm
|
|||||||
jobId=job;
|
jobId=job;
|
||||||
jobSize=size;
|
jobSize=size;
|
||||||
startLoc=start;
|
startLoc=start;
|
||||||
|
synchronized(memory){
|
||||||
for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
|
for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
|
||||||
{
|
{
|
||||||
memory[fillCount]=jobId;
|
memory[fillCount]=jobId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//this method returns a String of all the elements stored in the object
|
//this method returns a String of all the elements stored in the object
|
||||||
public String toString()
|
public String toString()
|
||||||
|
Loading…
Reference in New Issue
Block a user