public Mem(int tam) { M = tam; S = Convert.ToInt32(Math.Truncate(tam * 0.1)); L = new NodoList(); // L.AddOrdenedByDir(new Nodo { Dir = 0, Tam = S }); L.AddOrdenedByDir(new Nodo { Dir = M - S, Tam = S }); MemAvail = M - S; MaxAvail = M - S; }
public NodoList generateNodoList(List <Process> processes) { NodoList nodoList = new NodoList(); Nodo nodo = new Nodo(); nodo.Dir = 0; nodo.Tam = S; for (int i = 0; i < processes.Count - 1; i++) { if (processes[i].Dir + processes[i].Tam == processes[i + 1].Dir) { nodo.Tam += processes[i].Tam; } else { if (i == 0) { nodo.Tam += processes[i].Tam; } nodoList.AddOrdenedByDir(nodo); nodo = new Nodo { Dir = processes[i + 1].Dir , Tam = processes[i + 1].Tam }; } } if (processes[processes.Count - 2].Dir + processes[processes.Count - 2].Tam == processes[processes.Count - 1].Dir) { nodo.Tam += processes[processes.Count - 1].Tam; nodoList.AddOrdenedByDir(nodo); } else { // nodoList.AddOrdenedByDir(nodo); nodo.Dir = processes[processes.Count - 1].Dir; nodo.Tam = processes[processes.Count - 1].Tam; nodoList.AddOrdenedByDir(nodo); } return(nodoList); }
public Mem() { L = new NodoList(); }