import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class SynchronizedTask {
	
	
	public  void reduce_memory(SeverList serverlist_list,TaskList tasklist_list)
	{
		
		serverlist_list.rest_Memory = serverlist_list.rest_Memory - tasklist_list.get_need_Memory();	
		
		if((serverlist_list.rest_Memory) < 0)
		{
			System.out.println("Òì³£½Úµã£º");
			serverlist_list.print_server() ;
			tasklist_list.print_task();
		}
		serverlist_list.rate_memory = (int)((1 - (float)(serverlist_list.rest_Memory)/serverlist_list.get_all_Memory()) * 100);
	
	
	}
	public   void add_memory(SeverList serverlist_list,TaskList tasklist_list)
	{
		
		serverlist_list.rest_Memory = serverlist_list.rest_Memory + tasklist_list.get_need_Memory();	
		
		serverlist_list.rate_memory = (int)((1 - (float)(serverlist_list.rest_Memory)/serverlist_list.get_all_Memory()) * 100);
		
		serverlist_list.exec_task++;	
		
	}
	public  boolean isneedmeomory(SeverList serverlist,TaskList tasklist_list)
	{
		boolean ok= false;
		
		ok =  (serverlist.rest_Memory >=  tasklist_list.get_need_Memory());
		
		return ok;
	}


}
