- 1、本文档共18页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实报 告
实验名称:任课教师:姓 名:完成日期: 二、主要实验内容及要求:
编程实现对操作系统死锁的检测和解除。 三、设计思路:
1.输入系统进程数量n和资源类型数量m。
2.输入每类资源的数量。
3.输入每个进程每类资源的最大需求量和已获资源量。
4.检验系统的安全系。
5.若检测结果为系统不安全,可以对死锁进行解除,直到安全为止,再检测。
6.重复5操作,直到所有进程运行完毕。 四、实验结果与结论:(经调试正确的源程序和程序的运行结果)
编程员:蓝冠恒
程序源代码:
package osExperiment;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
import com.swtdesigner.SWTResourceManager;
public class OSExperiment {
protected Shell shell;
private final FormToolkit formToolkit = new
FormToolkit(Display.getDefault());
private Composite composite;
private Label label;
private Label label_1;
private Text processN;
private Text kindM;
private Button button1;
private Text listText;
private Composite composite4;
private Label label_3;
private Text kindNumbers;
private Button button2;
private Text theKind1;
private Label label_5;
private Label label_6;
private Text MaxText;
private Text AllocationText;
private Button button3;
private Label label_7;
private Text theProcess;
private Text theKind2;
private Label label_11;
private Button test;
private int[][] Max;
private int[][] Allocation;
private int[][] Need;
private int[] Available;
private int[] Work;
private boolean[] Finish;
private boolean notEnough=true;
private boolean isDeadlock=false;
private boolean []isNull;
private boolean illegalProvide=false;
private Button RemoveDeadLock;
private int N;
private int M;
private int i=0;
private int j=0;
private int k=0;
private int whichProcess;
private Composite composite1;
private Composite composite3;
private Composite composite
文档评论(0)