public Simulacion(List <List <string> > hilillos, int quantumIngresado, bool esDespacio) { InitializeComponent(); memoria = new Memoria(); colaContextos = new Queue <Contexto>(); contextosTerminados = new List <Contexto>(); // var sync = new Barrier(participantCount: CANTIDAD_NUCLEOS); //Barrera para sincronizar sync = new Barrier(CANTIDAD_NUCLEOS, (foo) => { reloj++; //lblReloj.Invoke(new Action(() => lblReloj.Text = reloj.ToString())); //lblReloj.Refresh(); Console.WriteLine("Reloj: " + reloj); }); //Barrera para sincronizar this.hilillos = hilillos; quantum = quantumIngresado; ejecucionLenta = esDespacio; // ejecución lenta = true; ejecución rápida = false. reloj = 0; CargarInstrucciones(); busDatos = new BusDatos(memoria); busInstrucciones = new BusInstrucciones(memoria); n0 = new Nucleo(sync, ref busDatos, ref busInstrucciones, 0, quantumIngresado, ref colaContextos, ref contextosTerminados); n1 = new Nucleo(sync, ref busDatos, ref busInstrucciones, 1, quantumIngresado, ref colaContextos, ref contextosTerminados); }
public Resultados(List <Contexto> listaContextos, Nucleo n0, Nucleo n1, Memoria memoria) { InitializeComponent(); contextosTerminados = listaContextos; this.n0 = n0; this.n1 = n1; this.memoria = memoria; }
/* * SetNucleo Setea las referencias a los nucleos */ public void SetNucleo(int identificador, Nucleo nucleo) { switch (identificador) { case 0: n0 = nucleo; break; case 1: n1 = nucleo; break; } }
/* * SetNucleo Setea las referencias a los nucleos */ public void SetNucleo(int identificador, Nucleo nucleo) { switch (identificador) { case 0: if (n0 == null) { n0 = nucleo; } break; case 1: if (n1 == null) { n1 = nucleo; } break; } }