Пример #1
0
        private void CargarDatosCache(CacheDatos cache, int indiceCache)
        {
            var txtEtiquetas = "";
            var txtValores   = "";
            var txtEstados   = "";

            for (int i = 0; i < CacheDatos.CANTIDAD_BLOQUES; i++)
            {
                txtEtiquetas += cache.GetEtiquetaBloque(i);
                if (i < CacheDatos.CANTIDAD_BLOQUES - 1)
                {
                    txtEtiquetas += " | ";
                }
            }

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < CacheDatos.CANTIDAD_BLOQUES; j++)
                {
                    txtValores += cache.GetPalabraBloque(i, j);
                    if (i < CacheDatos.CANTIDAD_BLOQUES - 1)
                    {
                        txtValores += " | ";
                    }
                    else
                    {
                        txtValores += "\n";
                    }
                }
            }

            for (int i = 0; i < CacheDatos.CANTIDAD_BLOQUES; i++)
            {
                txtEstados += cache.GetEstadoBloque(i);
                if (i < CacheDatos.CANTIDAD_BLOQUES - 1)
                {
                    txtEstados += " | ";
                }
            }

            if (indiceCache == 0)
            {
                tbCache0Estados.Text   = txtEstados;
                tbCache0Valores.Text   = txtValores;
                tbCache0Etiquetas.Text = txtEtiquetas;
            }
            else
            {
                tbCache1Estados.Text   = txtEstados;
                tbCache1Valores.Text   = txtValores;
                tbCache1Etiquetas.Text = txtEtiquetas;
            }
        }
Пример #2
0
        /*
         * Constructor de la clase
         */
        public Nucleo(Barrier barrera, ref BusDatos bd, ref BusInstrucciones bi, int id, int quantumInicial, ref Queue <Contexto> colaContextos, ref List <Contexto> contextosTerminados)
        {
            Sync     = barrera;
            busDatos = bd;
            busDatos.SetNucleo(id, this);
            busInstrucciones = bi;
            busInstrucciones.SetNucleo(id, this);
            identificador            = id;
            quantum                  = quantumInicial;
            this.quantumInicial      = quantumInicial;
            this.colaContextos       = colaContextos;
            this.contextosTerminados = contextosTerminados;
            contextoEnEjecucion      = null;

            nucleos = new List <Nucleo>();

            cacheDatos         = new CacheDatos();
            cacheInstrucciones = new CacheInstrucciones();
        }