操作系统上机实验报告(13版)

  • 格式:doc
  • 大小:3.33 MB
  • 文档页数:45

下载文档原格式

  / 45
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
//clrscr();
really = (PCB*)malloc(sizeof(PCB));
really -> next=NULL;
excute = (PCB*)malloc(sizeof(PCB));
excute -> next=NULL;
wait = (PCB*)malloc(sizeof(PCB));
return 1;
}
}
int block()
{
PCB *p = dequeue(excute);
if(p == NULL)
{
printf("NO process in queue \n");
return 0;
}
else
{
enqueue(wait , p);
printf("add a process into wait queue process: PID = %d UID= %d \n" ,p->PID , p->UID);
outputqueue(really);
printf("EXCUTE QUEUE: \n");
outputqueue(excute);
printf("WAIT QUEUE: \n");
outputqueue(wait);
}/*output*/
/*init初始化*/
int init()
{
PCB *p;
10.事件查看器中观察“应用程序日志”,本地计算机中,共有______________个应用程序日志事件。单击“查看”菜单中的“筛选”命令,查看系统日志包括的事件类型有哪些?
11.打开“服务”图标。查看在你的本地计算机中,管理着______个系统服务项目。通过观察,选出你所感兴趣的5个系统服务项目,描述他们的名称和服务的内容。
printf("new process PID = %d UID = %d added!\n",p -> PID , p -> UID);
else return 0;
}
}
return 1;
}/*init*/
/*运行一个process*/
int run()
{
PCB *p = excute;
int s = SEC;
限于编者的水平,难免有疏漏与错误,敬请读者批评指正。
编者:李可
实验一Windows操作系统
一、实验题目
计算机管理、任务管理、察看了解注册表
二、实验目的
Windows是目前使用人数最多的操作系统,学习操作系统,对操作系统有更加深入的了解。
三、实验内容
1.Windows提供了那些人机交互的界面?
2.观察Windows对应用程序运行的支持。
{
return NULL;
}
else
{
p = p -> next;
head -> next = p -> next;
p -> next = NULL;
return p;
}/*head to next*/
}/*dequeue*/
/*PCB operate*/
/*新建进程*/
void create()
{
wait -> next = NULL;
printf("____________PROCESS SECHUDLE__________\n");
printf("now initing.....................\n");
printf("input PID and UID as integer , 0 0 as over\n");
}
}
/*离开*/
void leave()
#include "conio.h"
#include"windows.h"
#define SEC 3
#define NULL 0
/*定义结构体*/
typedef struct PCB
{
int PID;//进程控制号
int UID;//内部ID号
struct PCB * next;
}PCB;
PCB *really , *excute , *wait;
Sleep(3);/*sleep as process runing time*/
printf("process: PID = %d UID= %d excute successed..\n" , p -> PID , p -> UID );
excute -> next = p -> next;
free(p);
return 1;
}
}/*excute*/
int suspend()
{
PCB *p = dequeue(excute);
if(p == NULL)
{
printf("NO process in queue \n");
return 0;
}
else
{
enqueue(really , p);
printf("add a process into really queue process: PID = %d UID= %d \n" ,p->PID , p->UID);
return 1;
}
}/*block*/
/*输出队列outputqueue*/
int outputqueue(PCB *head)
{
PCB *p;
if(head -> next == NULL)
{/*队列为空*/
printf("queue is null \n");
return 1;
}
p = head -> next; /*node pointer*/
printf("create a process: PID = %d UID = %d\n", p -> PID , p -> UID);
else
printf("create Failed\n");
}/*create*/
/*执行fexcute*/
int fexcute()
{
PCB *p = dequeue(really);
4.观察资源管理器,记录你使用的机器的资源情况:CPU、内存、磁盘分区及容量、文件目录树及文件属性。
5.观察设备管理器,记录你使用机器的设备的配置情况(启动控制面板,到管理工具,再到计算机管理,进入设备管理器)。
6.控制面板中看看系统还能让我们控制什么,特别了解“系统”、“显示”、“添加硬件”、“添加/删除程序”、“语音控制”等。
PCB *p;
p = (PCB*)malloc(sizeof(PCB));
p -> next = NULL;
printf("input PID and UID to a new process\n");
scanf("%d %d",&p -> PID,&p -> UID);
if(enqueue(really , p))
《操作系统实验指导书》是针对这门课的实验编写的,书中设计了三个操作系统原理实验。三个实验难易层次分明,重点突出,其中实验一(Windows操作系统)和实验二(进程管理)为验证性实验,重在验证教材中的理论原理,而实验三(虚拟存储管理)为设计性实验,重在培养理论原理应用于实践的设计能力。所有实验共8学时,采用C语言作为编程语言模拟设计完成相关程序。
编 者 说 明
《操作系统》是计算机科学与技术专业的一门核心专业基础课。学习计算机软件技术,特别是计算机操作系统技术,除了需要刻苦努力外,还需要掌握软件和操作系统的原理与设计技巧。这些原理与技巧可以说是计算机界的前辈们一代接一代不停歇的努力所留下的知识与智慧的结晶,学习和掌握它们对于激发自己的创造力和想象力是很有帮助的。
if(excute -> next == NULL)
{
printf("no process in excute queue \n");
return 0;
}
else
{
p = excute -> next;
printf("system will sleep %ds as process running\n",s);
{
if(p -> next == NULL)
{
p -> next = node;
return 1;
}
else p = p -> next;
}
}/*enquue*/
/*dequeue出队列*/
PCB * dequeue(PCB *head)
{
PCB *p;
p = head;
if(p -> next == NULL)
if(p == NULL)
{
printf("NO process in queue \n");
return 0;
}
else
{
enqueue(excute , p);
printf("add a process into excute queue process: PID = %d UID= %d \n" ,p->PID , p->UID);
return 1;
}Hale Waihona Puke Baidu
}
int wake()
{
PCB *p = dequeue(wait);
if(p == NULL)
{
printf("NO process in queue \n");
return 0;
}
else
{
enqueue(really , p);
printf("add a process into wait really process: PID = %d UID= %d \n" ,p->PID , p->UID);
7.启动“任务管理器”,观察Windows对多任务管理列出的应用程序与启动的是否一致,系统中有多少进程?为什么会有那么多进程而都不是应用程序?
8.启动Windows的注册表,检查系统配置和设置,初步了解注册表的作用。
9.了解管理工具,为了帮助用户管理和监视系统,Windows xp提供了多种系统管理工具,其中最主要的有:计算机管理,事件查看器,性能监视,服务,数据源(ODBC)。请回答出这些工具的主要功能。
如何学习和掌握操作系统技术的原理与实际技巧呢?除了听课和读书之外,最好的方法就是在实践中练习,通过自己模拟设计操作系统的原理实验,可以培养程序设计的方法和技巧,提高编制和理解清晰、合理、可读性好的系统程序的能力,加深对操作系统课程的理解。使自身更好的掌握操作系统的基本概念、基本原理及基本功能,从而具有分析实际操作系统的基本能力,深入直观的理解操作系统使用的各类算法。
while(p)
{/*打印process id UID*/
printf("PID = %d UID = %d \n" , p -> PID , p -> UID);
p = p -> next;
}
return 0;
}
/*output输出*/
int output()
{
printf("REALLLY QUEUE:\n");
/*create queue header */
/*queue operation入队*/
int enqueue(PCB *head , PCB *node)
{
PCB *p;
p = head;
if(p -> next == NULL)
{
head -> next = node;
return 1;
}
while(p)
Windows提供了几种方式启动应用程序?
Windows提供了几种方式让用户改变应用程序外观?
Windows提供了几种方式结束程序的运行?
3.了解windows对应用程序的运行时对I/O支持。系统中有多少个I/O设备?多少种I/O控制方式?能否确信应用程序I/O需要操作系统支持?能体会到“设备独立性”吗?
12.查看ODBC数据源,找到系统为哪些数据源缺省安装了ODBC驱动程序。
实验二进程控制
一、实验题目
模拟进程管理
二、实验目的
利用简单的结构和控制方法模拟进程结构、进程状态和进程控制。
三、实验内容
用PCB表示整个进程实体,利用键盘控制方法模拟进程执行中产生的事件,或者利用基于图形界面的鼠标或者键盘操作控制进程管理内容。建立三个基本的队列:等待、执行、阻塞进行模拟。操作系统的进程管理,模拟进程的调度,模拟用户的创建、执行、阻塞、挂起、唤醒等操作。
while(1)
{
p = (PCB*)malloc(sizeof(PCB));
p -> next = NULL;
scanf("%d %d",&p -> PID , &p -> UID);
if(p -> PID == 0 && p -> UID == 0)
break;
else
{
if(enqueue(really , p))
图2.1 进程状态转换
四、源程序
1.建立一个结点,即PCB块包括用户标识域、指针域等。
2.建立三个队列(执行队列、就绪队列、等待队列)
3.根据进程状态转换实现对三个队列的具体操作
4.用switch选择语句选择状态
#include "stdio.h"
#include "dos.h"
#include "stdlib.h"