资源简介
操作系统二级项目.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 < w1x; 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个文件信息
相关资源
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
- 联想启天M4350 BIOS升级文件
- 操作系统教程课后答案华中科技大学
评论
共有 条评论