何洲操作系统课程设计实验报告

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

武汉工程大学

计算机科学与工程学院综合设计报告

设计名称:操作系统综合设计

设计题目:线程同步

学生学号:1205080205

专业班级:2012计算机工程02

学生姓名:何洲

学生成绩:

指导教师(职称):章瑾(副教授)

完成时间:15年6月8日至15年6 月12日武汉工程大学计算机科学与工程学院制

说明:

1、报告中的第一、二、三项由指导教师在综合设计开始前填写并发给每个

学生;四、五两项(中英文摘要)由学生在完成综合设计后填写。

2、学生成绩由指导教师根据学生的设计情况给出各项分值及总评成绩。

3、指导教师评语一栏由指导教师就学生在整个综合设计期间的表现、设计

完成情况、报告的质量及答辩等方面,给出客观、全面的评价。

4、所有学生必须参加综合设计的答辩环节。凡不参加答辩者,其成绩一律

按不及格处理。答辩小组成员应由2人及以上教师组成。

5、报告正文字数一般应不少于5000字,也可由指导教师根据本门综合设

计的情况另行规定。

6、平时表现成绩低于6分的学生,其综合设计成绩按不及格处理。

7、此表格式为武汉工程大学计算机科学与工程学院提供的基本格式(适用

于学院各类综合设计),各教研室可根据本门综合设计的特点及内容做适当的调整,并上报学院批准。

答辩记录表

成绩评定表

学生姓名:何洲学号:1205080205 班级:2012计算机工程02

目录

摘要................................................................... II Abstract ................................................................ III 第一章绪论 (1)

1.1课程设计的背景 (1)

1.2课程设计的目的 (1)

1.3课程设计的要求 (1)

1.4应解决的问题 (1)

第二章设计简介及设计方案论述 (2)

2.1总体设计 (2)

2.2设计原理 (2)

2.3流程图 (2)

第三章详细设计 (4)

3.1界面设计 (4)

3.2功能设计 (4)

3.3信号量和P、V操作 (5)

3.4设置生产消费速度模块设计 (5)

第四章设计结果及分析 (6)

4.1 功能测试 (6)

4.2课程设计中遇到的问题 (7)

总结 (8)

致谢 (9)

参考文献 (10)

附录主要程序代码 (11)

摘要

生产者—消费者问题是一个经典的进程同步问题,该问题最早由Dijkstra提出,用以演示他提出的信号量机制。在同一地址进程空间内执行的两个线程,生产者生产物品,然后将生产出的物品放在一个空缓冲区内供消费者进程消费。消费者从缓冲区中获得物品,然后释放缓冲区。当生产者生产物品时,消费者不能消费物品。而当消费者正在消费物品的时候,生产者亦不能生产物品。当生产者生产物品的时候如果缓冲区已满,就必须等待消费者消费物品释放缓冲区后才能继续生产。而当消费者在消费时,若缓冲区内没有物品,则阻塞并唤醒生产者生产物品才可进行消费。本文论述了在eclipse开发环境下,使用java语言模拟实现生产者—消费者问题。生产者和消费者的数目都为1,两个线程同步,生产者生产完一个物品后消费者便消费一个物品,同时可以设置生产者的生产速度和消费者的消费速度。该程序使学生对操作系统的工作机制有了基本了解,熟悉Windows中的线程及进程的创建,掌握利用Windows中的同步机制实现线程同步。培养学生的抽象思维能力、逻辑推理能力和形式化思维方法,增强分析问题和解决问题的能力。在程序的设计开发过程中,首先对程序的要求进行了仔细的分析,做出整体的设计。然后再对每一个部分进行更具体的分析与设计,接着着手程序的编码、运行、调试。经过一个星期的的设计后,程序全部完成,达到课程设计的要求。

关键词:生产者—消费者问题;JAVA语言;信号量;线程

Abstract

Producer consumer problem is a classical process synchronization problem, the problem was first proposed by Dijkstra, in order to demonstrate the signal mechanism he proposed. In the same address process space within the two thread, producer goods, and then the production of goods placed in an empty buffer for the process of consumer spending. Consumers get the goods from the buffer and then release the buffer. When the producer produces goods, the consumer can't consume the goods. While consumers are consuming goods, producers can not produce goods. When the producer goods if the buffer is full, it must wait for the consumer goods release buffer to continue to produce. When consumers consume, if there is no item in the buffer zone, then plug and wake the producer to produce goods to consume. In this paper, the producer consumer problem is realized by using java language in eclipse development environment.. The number of producers and consumers are all 1, two thread synchronization, producers of the production of finished goods consumers consumption goods, also can set producers of the production rate and consumer consumption rate. The program makes the students have a basic understanding of the operating mechanism of the operating system, familiar with the creation of the thread and process in Windows, master the synchronization mechanism of the synchronization in Windows. To cultivate the students' abstract thinking ability, logical reasoning ability and formal thinking method, and strengthen the ability to analyze and solve problems. In the design and development of the program, the requirements of the procedure is analyzed carefully, and the design of the whole is made.. Then, it will analyze and design more concretely every part, then proceed the coding, running and debugging of the program.. After a week of design, the program is all completed, meet the requirements of the course design.

Keywords:Producer—consumer problem; JAVA language; signal; quantity thread

相关文档
最新文档