资源简介

此代码可在操作系统课设期间使用,包过。此系统包括先来先服务 最短寻道 扫描 和循环扫描四个算法

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class DiskSche : Form
    {
        public DiskSche()
        {
            InitializeComponent();
        }

        public int MaxDisk MinDisk StartPosi;//最大,最小和初始磁道数
        public static int N = 5;//磁道序列数
        public int[] DiskOrder = new int[N];//磁道序列
        public int[] SeachLen = new int[N];//寻道长度
        public int[] Seach = new int[N];//寻道序列
        public bool direction = true judge = true;//为true时表示从外向里judge为true表示扫描算法

        private void But_Start_Click(object sender EventArgs e)
        {
            if (this.Txt_MaxDisk.Text == ““ || this.Txt_MinDisk.Text == ““ || this.Txt_StartPosi.Text == ““)
            {
                MessageBox.Show(“请完善设置信息!“);
            }
            else
            {
                this.Txt_MaxDisk.ReadOnly = true;
                this.Txt_MinDisk.ReadOnly = true;
                this.Txt_StartPosi.ReadOnly = true;
                this.btn_Direction.Visible = false;
                this.But_Start.Enabled = false;
                MaxDisk = int.Parse(this.Txt_MaxDisk.Text);
                MinDisk = int.Parse(this.Txt_MinDisk.Text);
                StartPosi = int.Parse(this.Txt_StartPosi.Text);
                

                DataTable dt = new DataTable();
                dt.Columns.Add(“磁道顺序“ Type.GetType(“System.Int32“));
                dt.Columns.Add(“寻道长度“ Type.GetType(“System.Int32“)); 

                this.label4.Text = “产生的磁道序列为:“;
                //Random ran = new Random();

                Random ro = new Random(10);
                long tick = DateTime.Now.Ticks;
                Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));

                for (int i = 0; i < N; i++)
                {
                    DiskOrder[i] = ran.Next(MinDisk MaxDisk + 1);
                    this.label5.Text += DiskOrder[i].ToString() + ““;
                    dt.Rows.Add(DiskOrder[i] null);
                }
                this.dataGridView1.DataSource = dt.DefaultView;
            }
        }

        //停止按钮
        private void But_Stop_Click(object sender EventArgs e)
        {
            this.btn_Direction.Visible = false;
            this.But_Start.Enabled = true;
            this.Txt_MaxDisk.ReadOnly = false;
            this.Txt_MinDisk.ReadOnly = false;
            this.Txt_StartPosi.ReadOnly = false;
            this.label4.Text = ““;
            this.label5.Text = ““;

            this.label6.Text = ““;
            this.label8.Text = ““;
            this.label7.Text = ““;
            this.label9.Text = ““;
        }

        private void But_FIFS_Click(object sender EventArgs e)
        {
            this.btn_Direction.Visible = false;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        962  2013-07-01 08:45  Disk scheduling\Disk\Disk.sln

    ..A..H.     17920  2013-04-03 23:17  Disk scheduling\Disk\Disk.suo

     文件      16896  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

     文件      38400  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb

     文件      14328  2013-04-03 21:43  Disk scheduling\Disk\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe

     文件        490  2009-06-11 05:14  Disk scheduling\Disk\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件      14315  2013-04-03 21:23  Disk scheduling\Disk\WindowsFormsApplication1\DiskSche.cs

     文件      14697  2013-04-02 19:48  Disk scheduling\Disk\WindowsFormsApplication1\DiskSche.Designer.cs

     文件       5814  2013-04-02 19:48  Disk scheduling\Disk\WindowsFormsApplication1\DiskSche.resx

     文件       2129  2013-07-01 10:45  Disk scheduling\Disk\WindowsFormsApplication1\Form1.cs

     文件      12591  2013-07-01 10:26  Disk scheduling\Disk\WindowsFormsApplication1\Form1.Designer.cs

     文件       6570  2013-07-01 10:26  Disk scheduling\Disk\WindowsFormsApplication1\Form1.resx

     文件       2140  2013-04-03 21:43  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt

     文件        908  2013-04-02 19:48  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache

     文件        180  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.DiskSche.resources

     文件      16896  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe

     文件      38400  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb

     文件        180  2013-07-02 08:28  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Properties.Resources.resources

     文件        508  2013-07-01 09:25  Disk scheduling\Disk\WindowsFormsApplication1\Program.cs

     文件       1388  2013-07-01 08:45  Disk scheduling\Disk\WindowsFormsApplication1\Properties\AssemblyInfo.cs

     文件       2898  2013-07-01 08:45  Disk scheduling\Disk\WindowsFormsApplication1\Properties\Resources.Designer.cs

     文件       5612  2013-07-01 08:45  Disk scheduling\Disk\WindowsFormsApplication1\Properties\Resources.resx

     文件       1109  2013-07-01 08:45  Disk scheduling\Disk\WindowsFormsApplication1\Properties\Settings.Designer.cs

     文件        249  2013-07-01 08:45  Disk scheduling\Disk\WindowsFormsApplication1\Properties\Settings.settings

     文件       3809  2013-07-02 08:28  Disk scheduling\Disk\WindowsFormsApplication1\WindowsFormsApplication1.csproj

     目录          0  2013-07-01 10:57  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\Refactor

     目录          0  2013-07-01 10:57  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug\TempPE

     目录          0  2013-07-02 13:11  Disk scheduling\Disk\WindowsFormsApplication1\bin\Debug

     目录          0  2013-04-03 21:06  Disk scheduling\Disk\WindowsFormsApplication1\obj\Debug

     目录          0  2013-07-02 13:11  Disk scheduling\Disk\WindowsFormsApplication1\bin

............此处省略8个文件信息

评论

共有 条评论