Exemple #1
0
        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);
        }
Exemple #2
0
 public Resultados(List <Contexto> listaContextos, Nucleo n0, Nucleo n1, Memoria memoria)
 {
     InitializeComponent();
     contextosTerminados = listaContextos;
     this.n0             = n0;
     this.n1             = n1;
     this.memoria        = memoria;
 }
 /*
  * Constructor de la clase
  */
 public BusInstrucciones(Memoria memoria)
 {
     memoriaPrincipal = memoria;
 }
Exemple #4
0
 /*
  * Constructor de la clase
  */
 public BusDatos(Memoria memoria)
 {
     memoriaPrincipal = memoria;
 }