⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 用VS描述的 模拟操作系统的先来先服务功能
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FIFO
{
    public partial class Form1 : Form
    {
        int fi_i = 0;
        int fi_type1 = 0;
        int fi_i1 = 0;
        int fi_i2 = 0;
        int fi_i3 = 0;
        Label[] a = new Label[5];
        int[] fi_ii = new int[5];

        public Form1()
        {
            InitializeComponent();
            chushihua();
            suijishu();
            timer1.Enabled = true;
        }

        public void suijishu()
        {
            Random r1 = new Random();
                fi_i = r1.Next(1, 30);     
        }
       
        public void panduan11(int a, int b, int c)//一一全部调入后再一一执行!
        {
            if (4 * (a++) < 328)
            {
                fi_type1 = 1;
                label4.Text = "CPU正在调入进程1";
            }
            else
                if (4 * (a++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2.";
                    }
                    else
                    {
                        if (3 * (b++) < 556)
                        {
                            if (2 * (c++) < 328)
                            {
                                fi_type1 = 3;
                                label4.Text = "CPU正在调入进程3";
                            }
                            else
                            {
                                if (2 * (c++) < 556)
                                {
                                    fi_type1 = 1;
                                    label4.Text = "CPU正在运行进程1";
                                }
                            }
                        }
                        else
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调入进程3";
                        }
                    }
                }
                else
                    if (3 * (b++) < 556)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                    else
                        if (2 * (c++) < 556)
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在运行进程3";
                        }
                        else
                        {
                            fi_type1 = 7;
                            label4.Text = "结束!";
                        }
        }

        public void panduan12(int a, int b, int c)//调入一个就执行一个!
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在运行进程1";
                }
            }
            else
                if (3 * (b++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2";
                    }
                    else
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                }
                else
                {
                    if (2 * (c++) < 556)
                    {
                        if (2 * (c++) < 328)
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调入进程3";
                        }
                        else
                        {
                            fi_type1 = 3;
                            label4.Text = "CPU正在调运行进程3";
                        }
                    }
                    else
                    {
                        fi_type1 = 7;
                        label4.Text = "结束!";
                    }
                }
        }

        public void panduan13(int a, int b, int c)
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    if (3 * (b++) < 328)
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在调入进程2";
                    }
                    else
                    {
                        fi_type1 = 1;
                        label4.Text = "CPU正在运行进程1";
                    }
                }
            }
            else
            {
                if (3 * (b++) < 556)
                {
                    if (2 * (c++) < 328)
                    {
                        fi_type1 = 3;
                        label4.Text = "CPU正在调入进程3";
                    }
                    else
                    {
                        fi_type1 = 2;
                        label4.Text = "CPU正在运行进程2";
                    }
                }
                else
                {
                    if (2 * (c++) < 556)
                    {
                        fi_type1 = 3;
                        label4.Text = "CPU正在运行进程3";
                    }
                    else
                    {
                        fi_type1 = 7;
                        label4.Text = "结束!";
                    }
                }
            }
        }

        public void panduan14(int a, int b, int c)
        {
            if (4 * (a++) < 556)
            {
                if (4 * (a++) < 328)
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在调入进程1";
                }
                else
                {
                    fi_type1 = 1;
                    label4.Text = "CPU正在运行进程1";
                }
            }
            else
            {
                if (3 * (b++) < 556)
                {
                    if (3 * (b++) < 328)
                    {
                        if (2 * (c++) < 328)
                        {
                            fi_type1 = 2;
                            label4.Text = "CPU正在调入进程2";
                        }
                    }
                    else
                    {
                        if (3 * (b++) < 556)
                        {
                            if (2 * (c++) < 328)
                            {
                                fi_type1 = 3;
                                label4.Text = "CPU正在调入进程3";
                            }
                            else
                            {
                                if (2 * (c++) < 556)
                                {
                                    fi_type1 = 2;
                                    label4.Text = "CPU正在运行进程2";
                                }
                            }
                        }
                        else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -