Beispiel #1
0
        private void TimerCPU_Tick(object sender, EventArgs e)
        {
            TimerCPU.Stop();

            if (_Type == 0)
            {
                FCFS();
            }
            else
            {
                RoundRobin();
            }
        }
Beispiel #2
0
        public void RoundRobin()
        {
            if (!Memory.EmptyProcessUser())
            {
                //tira processo da fila
                Process p = Memory.KillProcess();
                if (p != null)
                {
                    RefreshData();

                    //Progressbar CPU
                    ProgressCPU.Value   = 0;
                    ProgressCPU.Maximum = p.Time;

                    //Nome do processo na CPU
                    lblName.Text = p.Name;

                    int i = 1;
                    while (i <= 20)
                    {
                        //executa se for true break
                        if (CPU.Execute(ref p))
                        {
                            break;
                        }

                        //tempo do processo na CPU
                        lblTime.Text = p.Time.ToString();
                        RefreshData();

                        //tempo de execução
                        Thread MinhaThread = new Thread(ThTimer);
                        MinhaThread.Start();

                        ProgressCPU.Increment(1);
                        i++;
                    }

                    //mmu traduz
                    MMU.Translate(ref p);
                    ProgressCPU.Value = 0;

                    //reseta nome e tempo CPU
                    lblName.Text = "";
                    lblTime.Text = "";
                }
            }

            //começa novamente o timer que irá chamar os escalonadores
            TimerCPU.Start();
        }
Beispiel #3
0
        public void FCFS()
        {
            //executar se a memoria não estiver vazia
            if (!Memory.EmptyProcessUser())
            {
                //tira processo da fila
                Process p = Memory.KillProcess();
                if (p != null)
                {
                    RefreshData();

                    //progressbar CPU
                    ProgressCPU.Value   = 0;
                    ProgressCPU.Maximum = p.Time;

                    //nome do processo na cpu
                    lblName.Text = p.Name;

                    while (!CPU.Execute(ref p))
                    {
                        //tempo do processo na cpu
                        lblTime.Text = p.Time.ToString();

                        //tempo de execução
                        Thread MinhaThread = new Thread(ThTimer);
                        MinhaThread.Start();

                        ProgressCPU.Increment(1);
                    }

                    //MMU traduz
                    MMU.Translate(ref p);

                    //reseta progressBar CPU
                    ProgressCPU.Value = 0;


                    //reseta nome e tempo CPU
                    lblName.Text = "";
                    lblTime.Text = "";
                }
            }
            //começa novamente o timer que irá chamar os escalonadores
            TimerCPU.Start();
        }
Beispiel #4
0
        public FormSO(FormBase MyBase, byte Type)
        {
            InitializeComponent();

            this.StartPosition = FormStartPosition.CenterScreen;

            _MyBase = MyBase;

            _Type = Type;

            timer.Start();

            RefreshAutoT.Start();

            TimerCPU.Start();

            PBmemory.Minimum = 0;
            PBmemory.Maximum = 1024;
        }