复制粘贴即可运行 注意对应好名称 开始界面 公共方法类 using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Data; namespace OS { class Method { public static void AddColumnRow(int n, DataGridView dg, string name,DataSet ds) { DataTable dt = new DataTable(name);//建立个数据表 DataRow dr; //行 for (int i = 1; i <= 20; i++) { dr = dt.NewRow(); dt.Rows.Add(dr); //在表的对象的行里添加此行 } ds.Tables.Add(dt); dg.DataSource = ds.Tables[name]; } } } 进程对象类 using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace OS { /// /// 进程类 /// class exector :IComparable { int servicetime = 0; //服务时间 int starttime = 0; //开始时间 int haveexected = 0; //已执行时间 int type = 0; //表示实例对象是生产者或消费者 int num = 0; //产品数 string name = ""; //进程名 int priority = 0; //优先级队列选择 float ratiopriority = 1; //最高响应比优先级 int waittime = 0; public exector(int servicetime, int starttime, int type, string name) { this.servicetime = servicetime; this.starttime = starttime; this.type = type; this.name = name; } public int Priority { get { return priority; } set { priority = value; } } public void setpriority() { ratiopriority = (this.Waittime + this.ServiceTime - this.Haveexected) / ((this.ServiceTime - this.Haveexected) * 1f); } public int Waittime { get { return waittime; } set { waittime = value; } } public float RatioPriority { get { return ratiopriority; } set { ratiopriority = value; } } public int Num { get { return num; } set { num = value; } } public string Name { get { return name; } } public int ServiceTime { get { return servicetime; } set { servicetime = value; } } public int Hav...