




已阅读5页,还剩17页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实习题目指导教师职 称学生姓名学 号日 期实习题目指导教师职 称学生姓名学 号日 期内蒙古师范大学计算机与信息工程学院操作系统课程设计报告实习题目指导教师职 称学生姓名学 号日 期设计题目编程演示三种存储管理方式的地址换算过程指导教师 翟烨职称 姓 名 聂斐斐学 号 日 期 2014.6.272020计算机科学与技术专业课程设计任务书学生姓名聂斐斐专业班级13专升本学号题 目编程演示三种存储管理方式的地址换算过程课题性质其它课题来源指导教师翟烨同组姓名无主要内容1、分页方式的地址换算2、分段方式的地址换算3、段页式的地址换算任务要求 要求演示正确、清晰,编程所用工具不限。参考文献张丽芬 李侃 刘利雄操作系统学习指导与习题解析 电子工业出版社 2006谭浩强C程序设计 清华大学出版社 2008任满杰等操作系统原理实用教程 电子工业出版社 2006汤子瀛 计算机操作系统(修订版)西安电子科技大学出版社 2001张尧学 史美林计算机操作系统教程实验指导 清华大学出版社 2000 罗宇等 操作系统课程设计机械工业出版社 2005审查意见指导教师签字:教研室主任签字: 年 月 日 说明:本表由指导教师填写,由教研室主任审核后下达给选题学生,装订在设计(论文)首页1 需求分析编程演示三种存储管理方式的地址换算过程,分别为分页方式的地址换算,分段方式的地址换算,段页式的地址换算。分页方式通过逻辑地址算出页号与叶内地址,然后通过页表来实现向物理地址的转换。分段方式通过段号和段内地址得到物理地址。段叶式通过段号得到页表首地址,通过页号得到块号,进而得到物理地址。2 概要设计程序主要有三个功能,分别是分页方式的地址换算,分段方式的地址换算,段页式的地址换算。利用可视化界面进行选择。3 运行环境软件环境:WindowXP,VisualC+6.04 开发工具和编程语言开发工具:VisualC+6.0编程语言:C+语言5 详细设计5.1 流程图5.2界面设计5.3代码设计/ dizhizhuanhuanDlg.cpp : implementation file/#include stdafx.h#include dizhizhuanhuan.h#include dizhizhuanhuanDlg.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif#include #include int page(int A,int L );int Segment(int sn,int sl); int SegPagt(int sn,int pn,int pd); typedef struct segtable int segf256; int segl256; segtable; struct segtable st; typedef struct segpagt /int segf256; int segl4; int ptl; int pt3500; /int pf256; int pl; segpagt; struct segpagt sp; int i,j;int d,P;int A,L;int WD,wd;int PT4;int temp;int kd;int sn,sd;int pn,pd;/ CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialogpublic:CAboutDlg();/ Dialog Data/AFX_DATA(CAboutDlg)enum IDD = IDD_ABOUTBOX ;/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:/AFX_MSG(CAboutDlg)/AFX_MSGDECLARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)/AFX_MSG_MAP(CAboutDlg)/ No message handlers/AFX_MSG_MAPEND_MESSAGE_MAP()/ CDizhizhuanhuanDlg dialogCDizhizhuanhuanDlg:CDizhizhuanhuanDlg(CWnd* pParent /*=NULL*/): CDialog(CDizhizhuanhuanDlg:IDD, pParent)/AFX_DATA_INIT(CDizhizhuanhuanDlg)m_A = _T();m_L = _T();m_s = _T();m_sn = _T();m_sd = _T();m_sn1 = _T();m_pn1 = _T();m_pd1 = _T();m_y1 = _T();m_y2 = _T();m_y3 = _T();m_y4 = _T();m_d0 = _T();m_d1 = _T();m_d2 = _T();m_d3 = _T();m_d00 = _T();m_d11 = _T();m_d22 = _T();m_d33 = _T();m_dy11 = _T();m_dy12 = _T();m_dy13 = _T();m_dy14 = _T();m_dy21 = _T();m_dy22 = _T();m_dy23 = _T();m_dy24 = _T();m_dy31 = _T();m_dy32 = _T();m_dy33 = _T();m_dy34 = _T();/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);void CDizhizhuanhuanDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CDizhizhuanhuanDlg)DDX_Text(pDX, IDC_EDIT1, m_A);DDX_Text(pDX, IDC_EDIT2, m_L);DDX_Text(pDX, IDC_JEIGUO, m_s);DDX_Text(pDX, IDC_EDIT3, m_sn);DDX_Text(pDX, IDC_EDIT4, m_sd);DDX_Text(pDX, IDC_EDIT5, m_sn1);DDX_Text(pDX, IDC_EDIT6, m_pn1);/DDX_Text(pDX, IDC_EDIT7, m_pd1);DDX_Text(pDX, IDC_Y1, m_y1);DDX_Text(pDX, IDC_Y2, m_y2);DDX_Text(pDX, IDC_Y3, m_y3);DDX_Text(pDX, IDC_Y4, m_y4);DDX_Text(pDX, IDC_D0, m_d0);DDX_Text(pDX, IDC_D1, m_d1);DDX_Text(pDX, IDC_D2, m_d2);DDX_Text(pDX, IDC_D3, m_d3);DDX_Text(pDX, IDC_D00, m_d00);DDX_Text(pDX, IDC_D11, m_d11);DDX_Text(pDX, IDC_D22, m_d22);DDX_Text(pDX, IDC_D33, m_d33);DDX_Text(pDX, IDC_DY11, m_dy11);DDX_Text(pDX, IDC_DY12, m_dy12);DDX_Text(pDX, IDC_DY13, m_dy13);DDX_Text(pDX, IDC_DY14, m_dy14);DDX_Text(pDX, IDC_DY21, m_dy21);DDX_Text(pDX, IDC_DY22, m_dy22);DDX_Text(pDX, IDC_DY23, m_dy23);DDX_Text(pDX, IDC_DY24, m_dy24);DDX_Text(pDX, IDC_DY31, m_dy31);DDX_Text(pDX, IDC_DY32, m_dy32);DDX_Text(pDX, IDC_DY33, m_dy33);DDX_Text(pDX, IDC_DY34, m_dy34);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CDizhizhuanhuanDlg, CDialog)/AFX_MSG_MAP(CDizhizhuanhuanDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_RADIO1, OnYeshi)ON_BN_CLICKED(IDC_RADIO2, OnDuanshi)ON_BN_CLICKED(IDC_RADIO3, OnDuanyeshi)ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)/ON_BN_CLICKED(IDC_BUTTON2, OnButton2)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CDizhizhuanhuanDlg message handlersBOOL CDizhizhuanhuanDlg:OnInitDialog()CDialog:OnInitDialog();/ Add About. menu item to system menu./ IDM_ABOUTBOX must be in the system command range.ASSERT(IDM_ABOUTBOX & 0xFFF0) = IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEPARATOR);pSysMenu-AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);/ Set the icon for this dialog. The framework does this automatically/ when the applications main window is not a dialogSetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE);/ Set small icon/ TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a controlvoid CDizhizhuanhuanDlg:OnSysCommand(UINT nID, LPARAM lParam)if (nID & 0xFFF0) = IDM_ABOUTBOX)CAboutDlg dlgAbout;dlgAbout.DoModal();elseCDialog:OnSysCommand(nID, lParam);/ If you add a minimize button to your dialog, you will need the code below/ to draw the icon. For MFC applications using the document/view model,/ this is automatically done for you by the framework.void CDizhizhuanhuanDlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/ Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);elseCDialog:OnPaint();/ The system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR CDizhizhuanhuanDlg:OnQueryDragIcon()return (HCURSOR) m_hIcon;void CDizhizhuanhuanDlg:OnYeshi() / TODO: Add your control notification handler code hereUpdateData(true);YS();UpdateData(false);xz=1;void CDizhizhuanhuanDlg:OnDuanshi() / TODO: Add your control notification handler code hereUpdateData(true);DS();UpdateData(false);xz=2;void CDizhizhuanhuanDlg:OnDuanyeshi() / TODO: Add your control notification handler code hereUpdateData(true);DYS();UpdateData(false);xz=3;void CDizhizhuanhuanDlg:OnChangeEdit1() / TODO: If this is a RICHEDIT control, the control will not/ send this notification unless you override the CDialog:OnInitDialog()/ function and call CRichEditCtrl().SetEventMask()/ with the ENM_CHANGE flag ORed into the mask./ TODO: Add your control notification handler code herevoid CDizhizhuanhuanDlg:OnButton1() / TODO: Add your control notification handler code hereUpdateData(true);if(xz=1)A=(int)atof(m_A); L=(int)atof(m_L); P=A/L; d=A%L;if(P=4) m_s=(CString)页号大于页表长度,越界中断n; else kd=PTP;/根据页号随机产生快号 WD=kd*L+d;/计算物理地址的公式 temp=WD; m_s.Format(%d,temp); / return (0);if(xz=2)sn=(int)atof(m_sn); sd=(int)atof(m_sd); if(sn4) m_s=(CString)段号大于段表长度4,越界中断; else if(sdst.seglsn) m_s=(CString)段内地址大于段长度,越界中断; else wd=st.segfsn+sd;/计算物理地址的算法 temp=wd; m_s.Format(%d,temp); if(xz=3)sn=(int)atof(m_sn1);/段号 A=(int)atof(m_pn1);/逻辑地址 /pd=(int)atof(m_pd1); pn=A/1024; pd=A%1024; if(sn3) m_s=(CString)段号大于段表长度3,越界中断; else if(pn=4) m_s=(CString)页号大于页表长度4,越界中断; else kd=sp.ptsn-1pn-1; wd=kd*1024+pd;/计算物理地址的公式 temp=wd; m_s.Format(%d,temp);UpdateData(false);int CDizhizhuanhuanDlg:YS()/int d,P,kd,i;/int A,L;/int WD;/int PT4;for(i=1;i=4;i+)PTi=rand() %500;/定义随机产生的快号在1到500之间m_y1.Format(%d,PT1);m_y2.Format(%d,PT2);m_y3.Format(%d,PT3);m_y4.Format(%d,PT4); return (0);int CDizhizhuanhuanDlg:DS()/int i,wd;/int sn,sd;for(i=0;i4;i+)st.segfi=rand()%200;/定义随机产生段首地址st.segli=rand()%2000;/定义随机产生段长度m_d0.Format(%d,st.segf0);m_d1.Format(%d,st.segf1);m_d2.Format(%d,st.segf2);m_d3.Format(%d,st.segf3);m_d00.Format(%d,st.segl0);m_d11.Format(%d,st.segl1);m_d22.Format(%d,st.segl2);m_d33.Format(%d,st.segl3);return (0);int CDizhizhuanhuanDlg:DYS()/int i,j,wd,kd;/int sn,pn,pd,A;sp.ptl =1024;sp.pl=4;for(i=0;i3;i+)for(j=0;j4;j+)sp.ptij=rand()%500;/定义随机产生的数在1到256之间m_dy11.Format(%d,sp.pt00);m_dy12.Format(%d,sp.pt01);m_dy13.Format(%d,sp.pt02);m_dy14.Format(%d,sp.pt03);m_dy21.Format(%d,sp.pt10);m_dy22.Format(%d,sp.pt11);m_dy23.Format(%d,sp.pt12);m_dy24.Format(%d,sp.pt13);m_dy31.Format(%d,sp.pt20);m_dy32.Format(%d,sp.pt21);m_dy33.Format(%d,sp.pt22);m_dy34.Format(%d,sp.pt23);return (0);6 调试分析测试中没有出现大的问题,在调试时最难解决的
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 初中数学三角形的概念(课件)+人教版数学八年级上册
- 新解读《GB-T 30568-2014锆及锆合金锻件》
- 重庆山城骑士课件
- 新解读《GB-T 4131-2014水泥的命名原则和术语》
- 新解读《GB 2494-2014固结磨具 安全要求》
- 完形填空-说明文和议论文(复习讲义)-2026年高考英语一轮复习原卷版
- 重工绕线基础知识培训课件
- 醉翁亭记教学课件
- 酿酒机器人编程知识培训课件
- 实验的基本技能(专项训练)-2023年中考化学二轮复习
- 以史为帆明方向+少年立志向未来+课件-2025-2026学年上学期主题班会
- 2025年医卫类病理学技术(中级)专业知识-专业实践能力参考题库含答案解析(5套试卷)
- 2025上海科技馆事业单位工作人员招聘10人笔试备考题库及答案解析
- 【初二】【八年级】【道法】2025【秋】上学期开学第一课【统编版】(课件)
- 《工程勘察设计收费标准》(2002年修订本)
- 硫化氢考试题库
- 监控中心主任岗位职责
- 住院医师规范化培训申请表
- 数学建模电子教材
- 考评员题库(1000题)
- 途虎八步及10大保养质检流程试题及答案
评论
0/150
提交评论