资源预览内容
第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
亲,该文档总共8页全部预览完了,如果喜欢就下载吧!
资源描述
实验 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);ZeroMemory( / 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. NULL, / 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 使用信号量解决生产者消费者问题实验目的:掌握信号量的使用,利用信号量解决 生产者消费者问题。实验内容及要求:独立编写一个基于Windows的 应用程序,在程序中创建两个线程,其中一个作 为生产者,一个作为消费者,缓冲区的大小设置 为1。首先不使用信号量同步两个线程,生产者 将09十个数字依次放入缓冲区,消费者取出显 示在显示器上,观察实验结果。接着使用信号量 同步,观察实验结果。最后对实验结果进行分析 。实验 2 使用信号量解决生产者消费者问题CreateThreadCreateSemaphore WaitForSingleObjectReleaseSemaphoreExitThreadSetThreadPrioritySeveral Candidate Win32 APIs实验 3 调度算法模拟及分析实验目的:通过模拟实验比较不同调度算法的性 能,加深对进程调度算法的理解。实验内容及要求:独立编写一个基于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 and 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 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.
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号