資源簡介
操作系統二級項目.zip

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Drawing;
using?System.Data;
using?System.Linq;
using?System.Text;
using?System.Threading;
using?System.Windows.Forms;
using?System.IO;
namespace?bike2
{
????public?partial?class?Form1?:?Form
????{
????????static?int?w1s?=?2?w2s?=?2?w3s?=?2//設置速度
???????????????????w1x?=?2?w2x?=?2?w3x?=?2?//設置工人個數
???????????????????cas?=?2?cax?=?2?//設置搬運工速度和個數
???????????????????bz1?=?10?bz2?=?10?bz3?=?10;//設置box容量
????????static?int?b1dq?=?0?b1sy?=?10?//box1當前及剩余容量
???????????????????b2dq?=?0?b2sy?=?10?//box2當前及剩余容量
???????????????????b3dq?=?0?b3sy?=?10;//box3當前及剩余容量
????????static?int?w1chan?=?0?w2chan?=?0?w3zu?=?0?w4yun?=?0;//工人已經生產個數
????????static?int?b1fang?=?0?b2fang?=?0?b3fang?=?0;//worker?已經put個數
????????static?int?b1qu?=?0?b2qu?=?0;//b1、b2被取走個數,b3即被搬運個數
????????static?double?ztime?=?0;//記錄時間
????????static?int?wz1=2?wz2=2?wz3=2?wz4=2;//四種線程阻塞個數
????????bool?kaishi?=?false;//判斷開始按鈕是否點擊過
????????//信號量聲明
????????static?Semaphore?box1empty;
????????static?Semaphore?box1full;
????????static?Semaphore?box2empty;
????????static?Semaphore?box2full;
????????static?Semaphore?box3empty;
????????static?Semaphore?box3full;
????????//lock臨界區
????????static?object?operate1?=?new?object();
????????static?object?operate2?=?new?object();
????????static?object?operate3?=?new?object();
????????static?object?operate4?=?new?object();
????????static?object?operate5?=?new?object();
????????static?object?operate6?=?new?object();
????????//四類工人線程數組
????????Thread[]?w1thread;
????????Thread[]?w2thread;
????????Thread[]?w3thread;
????????Thread[]?movethread;
????????public?Form1()
????????{
????????????InitializeComponent();
????????????Control.CheckForIllegalCrossThreadCalls?=?false;//設置線程可以控制當前form
????????????this.StartPosition?=?FormStartPosition.CenterScreen;//form打開時在屏幕中央
????????}
????????private?void?start_Click(object?sender?EventArgs?e)
????????{
????????????//初始化線程類數組
????????????w1thread?=?new?Thread[w1x];
????????????w2thread?=?new?Thread[w2x];
????????????w3thread?=?new?Thread[w3x];
????????????movethread?=?new?Thread[cax];
????????????//進度條最大值
????????????progressBar1.Maximum?=?bz1;
????????????progressBar2.Maximum?=?bz2;
????????????progressBar3.Maximum?=?bz3;
????????????//進度條當前值
????????????progressBar1.Value?=b1dq;
????????????progressBar2.Value?=b2dq;
????????????progressBar3.Value?=b3dq;????
????????????kaishi?=?true;???
????????????//初始化四個類
????????????worker1?w1?=?new?worker1(this);
????????????worker2?w2?=?new?worker2(this);
????????????worker3?w3?=?new?worker3(this);
????????????move?m?=?new?move(this);
????????????//初始化線程類數組
????????????for?(int?i?=?0;?i?????????????{
????????????????Thread?w?=?new?Thread(new?ThreadStart(w1.put));
????????????????w.Name?=?“worker1(“?+?(i?+?1)?+?“)“;
????????????????w1thread[i]?=?w;
????????????}
????????????for?(
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-08?19:11??青蘋果小組\
?????目錄???????????0??2018-01-12?13:50??青蘋果小組\bike2\
?????文件???????89614??2018-01-12?13:50??青蘋果小組\bike2\Form1.Designer.cs
?????文件???????40022??2018-01-12?13:50??青蘋果小組\bike2\Form1.cs
?????文件???????12916??2018-01-12?13:50??青蘋果小組\bike2\Form1.resx
?????文件?????????486??2018-01-08?16:08??青蘋果小組\bike2\Program.cs
?????目錄???????????0??2018-01-08?19:11??青蘋果小組\bike2\Properties\
?????文件????????1342??2018-01-08?16:08??青蘋果小組\bike2\Properties\AssemblyInfo.cs
?????文件????????2862??2018-01-08?16:08??青蘋果小組\bike2\Properties\Resources.Designer.cs
?????文件????????5612??2018-01-08?16:08??青蘋果小組\bike2\Properties\Resources.resx
?????文件????????1092??2018-01-08?16:08??青蘋果小組\bike2\Properties\Settings.Designer.cs
?????文件?????????249??2018-01-08?16:08??青蘋果小組\bike2\Properties\Settings.settings
?????文件????????3669??2018-01-09?10:20??青蘋果小組\bike2\bike2.csproj
?????目錄???????????0??2018-01-10?11:12??青蘋果小組\bike2\bin\
?????目錄???????????0??2018-01-12?14:56??青蘋果小組\bike2\bin\Debug\
?????文件?????????140??2018-01-11?11:13??青蘋果小組\bike2\bin\Debug\MyFileSend111353.txt
?????文件?????????132??2018-01-11?11:07??青蘋果小組\bike2\bin\Debug\MyFileSend11711.txt
?????文件?????????156??2018-01-12?13:39??青蘋果小組\bike2\bin\Debug\MyFileSend133913.txt
?????文件?????????156??2018-01-12?13:39??青蘋果小組\bike2\bin\Debug\MyFileSend133923.txt
?????文件?????????149??2018-01-12?14:01??青蘋果小組\bike2\bin\Debug\MyFileSend14145.txt
?????文件?????????148??2018-01-12?14:02??青蘋果小組\bike2\bin\Debug\MyFileSend1421.txt
?????文件?????????152??2018-01-12?14:54??青蘋果小組\bike2\bin\Debug\MyFileSend145447.txt
?????文件?????????149??2018-01-12?14:55??青蘋果小組\bike2\bin\Debug\MyFileSend145547.txt
?????文件?????????140??2018-01-12?14:56??青蘋果小組\bike2\bin\Debug\MyFileSend145618.txt
?????文件?????????132??2018-01-11?18:15??青蘋果小組\bike2\bin\Debug\MyFileSend181530.txt
?????文件?????????141??2018-01-11?18:16??青蘋果小組\bike2\bin\Debug\MyFileSend181651.txt
?????文件?????????140??2018-01-11?18:16??青蘋果小組\bike2\bin\Debug\MyFileSend18168.txt
?????文件???????59392??2018-01-12?13:50??青蘋果小組\bike2\bin\Debug\bike2.exe
?????文件???????73216??2018-01-12?13:50??青蘋果小組\bike2\bin\Debug\bike2.pdb
?????文件???????24224??2018-01-12?14:59??青蘋果小組\bike2\bin\Debug\bike2.vshost.exe
?????文件?????????490??2015-07-10?19:01??青蘋果小組\bike2\bin\Debug\bike2.vshost.exe.manifest
............此處省略16個文件信息
評論
共有 條評論