⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tab1.h

📁 操作系统实验演示代码(三个实验
💻 H
字号:
#if !defined(AFX_TAB1_H__C707C83E_D3EA_455C_B5B4_D3E5B062C492__INCLUDED_)
#define AFX_TAB1_H__C707C83E_D3EA_455C_B5B4_D3E5B062C492__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Tab1.h : header file
//
#include "JobView.h"
#include "MemView.h"
#include "TabSheet.h"
#define TOTAL_MEM 100
#define TAPER 1
#define PRINTER 2
/////////////////////////////////////////////////////////////////////////////
// CTab1 dialog
//===================请求页式管理=======================

//===================进程调度=======================
struct PCB
{
   UINT ID;
   UINT Priority;
   float CPUtime;
   float Alltime;
   UINT State;
   struct PCB * next;
};
//===================作业调度=======================
struct JCB
{
	UINT ID;    //作业号
	UINT RunTime;//实际运行时间
    UINT SetTime;//放入队列时间
	UINT TakeMem;//占用内存
	UINT MemSize;//内存大小
	float TakeTime;//要求计算时间 
	UINT PrintNum;//申请的打印机数量
	UINT TapeNum;//申请的磁带机数量
};


struct RC
{
	UINT Type;     //资源类型 是打印机还是磁带机?
	int User;      //标识哪个作业使用了本资源
	int yPos;      //用于画图状态图的参数
	COLORREF tagColor;//区别各个作业的颜色,用于图形显示
};
struct FBT
{
		UINT size;   //空闲块大小
		UINT addr;   //空闲块首址
};
class CTab1 : public CDialog
{
// Construction
public:
	void ShowMemList();
	void AddJob(CString id, CString inputtime, CString usetime, CString mem,CString printer, CString tape);
	CTab1(CWnd* pParent = NULL);   // standard constructor
    UINT CurJobNum;
	UINT CountTime;
// Dialog Data
	//{{AFX_DATA(CTab1)
	enum { IDD = IDD_TAB1 };
	CSliderCtrl	m_TimeSlider;
	CTabSheet	m_TabView;
	CComboBox	m_Combo2;
	CComboBox	m_Combo1;
	CListCtrl	m_MemList;
	CListCtrl	m_JobList;
	CString	m_NeedMem;
	CString	m_NeedTime;
	UINT	m_ReqMem;
	UINT	m_ReqTime;
	CJobView m_TabJob;
    CMemView m_TabMem;
	CString	m_StartMsg;
	UINT nTaper;
	UINT nPrinter;
	CArray<JCB,JCB>JCBList;  //后备队列
	CArray<JCB,JCB>JCBWait;  //阻塞队列
	CArray<JCB,JCB>JCBRun;   //运行队列
	CArray<FBT,FBT>FBTList;  //内存自由区表
	RC RCList[3];   //描述资源设备使用情况的结构数组
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTab1)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CTab1)
	virtual BOOL OnInitDialog();
	afx_msg void OnReleasedcaptureTimeSlider(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnTimeAdd();
	afx_msg void OnTimeDec();
	afx_msg void OnBtnAdd();
	afx_msg void OnBtnRun();
	afx_msg void OnBtnDel();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnMnuRedo();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	bool Apply_HardWare(UINT type,UINT user);
	bool IsMemEnough(int size);
	bool free_block(int addr,int size);
	int get_block(UINT size);
	void FreeAllMem();
	void AddMemItem(CString time,CString size,CString addr);
	
	UINT nListIndex;
	void ShowJobList();
	UINT ItemCount;
	UINT MemCount;
	void ShowStartTime();
	COLORREF JobColor[5];
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TAB1_H__C707C83E_D3EA_455C_B5B4_D3E5B062C492__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -