mirror of
				https://github.com/bspeice/itcs3146-project
				synced 2025-11-03 18:10:29 -05:00 
			
		
		
		
	Add synchronization to dpturnbull's code
This commit is contained in:
		@ -275,9 +275,11 @@ class FirstFit implements baseAlgorithm
 | 
			
		||||
		jobSize=size;
 | 
			
		||||
		startLoc=start;
 | 
			
		||||
		
 | 
			
		||||
		for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
 | 
			
		||||
		{
 | 
			
		||||
			memory[fillCount]=jobId;
 | 
			
		||||
		synchronized(memory){
 | 
			
		||||
			for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
 | 
			
		||||
			{
 | 
			
		||||
				memory[fillCount]=jobId;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								NextFit.java
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								NextFit.java
									
									
									
									
									
								
							@ -62,7 +62,7 @@ class NextFit implements baseAlgorithm
 | 
			
		||||
		if(jobSize>memSize)
 | 
			
		||||
		{
 | 
			
		||||
			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);
 | 
			
		||||
		}
 | 
			
		||||
@ -293,10 +293,11 @@ class NextFit implements baseAlgorithm
 | 
			
		||||
		jobId=job;
 | 
			
		||||
		jobSize=size;
 | 
			
		||||
		startLoc=start;
 | 
			
		||||
		
 | 
			
		||||
		for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
 | 
			
		||||
		{
 | 
			
		||||
			memory[fillCount]=jobId;
 | 
			
		||||
		synchronized(memory){
 | 
			
		||||
			for(int fillCount=startLoc; fillCount<jobSize+startLoc; fillCount++)
 | 
			
		||||
			{
 | 
			
		||||
				memory[fillCount]=jobId;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user