操作系统 实验指导书2

上传人:wm****3 文档编号:51843271 上传时间:2018-08-16 格式:PPT 页数:8 大小:667KB
返回 下载 相关 举报
操作系统 实验指导书2_第1页
第1页 / 共8页
操作系统 实验指导书2_第2页
第2页 / 共8页
操作系统 实验指导书2_第3页
第3页 / 共8页
操作系统 实验指导书2_第4页
第4页 / 共8页
操作系统 实验指导书2_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《操作系统 实验指导书2》由会员分享,可在线阅读,更多相关《操作系统 实验指导书2(8页珍藏版)》请在金锄头文库上搜索。

1、实验 1 Win32常用API的使用实验目的:掌握使用常用的Windows API函数, 其中包括进程创建、等待进程结束和退出进程等 。通过实验熟悉VC程序设计环境和MSDN帮助 的使用。实验内容及要求:独立编写一个基于Windows的 应用程序,在程序中完成一个新的进程的创建, 并通过菜单控制新进程的结束。在新进程结束后 自动结束该应用程序。Some Win32 API calls实验 1 Win32常用API的使用实验 1 Win32常用API的使用STARTUPINFO si;PROCESS_INFORMATION pi;ZeroMemory( si.cb = sizeof(si);Ze

2、roMemory( / Start the child process. if( !CreateProcess(“D:WinampWinamp.exe“, / Module name. NULL, / Command line. NULL, / Process handle not inheritable. NULL, / Thread handle not inheritable. FALSE, / Set handle inheritance to FALSE. 0, / No creation flags. NULL, / Use parents environment block. N

3、ULL, / Use parents starting directory. / Wait until child process exits.WaitForSingleObject( pi.hProcess, INFINITE );/ Close process and thread handles. CloseHandle( pi.hProcess );CloseHandle( pi.hThread );ExitProcess(1);Example of Codes实验 2 使用信号量解决生产者消费者问题实验目的:掌握信号量的使用,利用信号量解决 生产者消费者问题。实验内容及要求:独立编写

4、一个基于Windows的 应用程序,在程序中创建两个线程,其中一个作 为生产者,一个作为消费者,缓冲区的大小设置 为1。首先不使用信号量同步两个线程,生产者 将09十个数字依次放入缓冲区,消费者取出显 示在显示器上,观察实验结果。接着使用信号量 同步,观察实验结果。最后对实验结果进行分析 。实验 2 使用信号量解决生产者消费者问题CreateThreadCreateSemaphore WaitForSingleObjectReleaseSemaphoreExitThreadSetThreadPrioritySeveral Candidate Win32 APIs实验 3 调度算法模拟及分析实验

5、目的:通过模拟实验比较不同调度算法的性 能,加深对进程调度算法的理解。实验内容及要求:独立编写一个基于Windows的 应用程序,在程序中首先随机的或手工产生一个 CPU等待队列(包括到达时间和估计运行时间) ,分别使用FCFS和SJF调度算法对该队列进行调 度,计算平均轮转时间和系统吞吐率。最后对两 种算法作出对比。Experiment 4Program a simulation of the bankers algorithm. Your program should cycle through each of the bank clients asking for a request a

6、nd evaluating whether it is safe or unsafe. Output a log of requests. Each client can be modeled by an array of resource requests. At each scheduling point, a request chosen randomly is evaluated ( The lottery scheduling algorithm seems to be a good candidate). Record a log into an array and output

7、it finally.Experiment 5Write a program that simulates a paging system. At the start of the program, the user should be asked to choose a page replacement algorithm, e.g. FIFO, LRU. Input the numbers of referenced pages. Generate a list similar to Fig.4-25. Compare the performance of different page replacement algorithms, e.g. page fault rate.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号