联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-11-26 10:54

CQUPT – University at Albany

Computer Science – International College

CSI 400 Operating Systems

Programming Assignment 1 (Draft Copy)

Fall 2018

Purpose of the Project

The goal of this assignment is to gain an understanding of semaphores through the use of Pthreads by designing and implementing a multi-threaded application. A secondary goal is to understand how semaphores are used in operating systems and applications. You are to write both a producer and a consumer C programs that uses Pthreads to synchronize concurrent file activities.


The Details

Your solution must include the following:

1.The Consumer

Submits processing requests to the producer by supplying a file name, its location and a character. It also outputs the contents of the file provided by the producer to the standard output.

2.The Producer

Accepts multiple consumer requests and processes each request by creating the following four threads.

1The reader thread will read an input file, one line at a time. It will pass each line of input to the character thread through a queue of messages.

2The character thread component will scan the line and replace each blank character by the character supplied by the client. It will then pass the line to the toUpper thread through another queue of messages.

3The toUpper thread component will scan the line and convert all lower case letters to upper case. It will then pass the converted line to the writer thread through another queue of messages.

4The writer thread will write the line to an output file.          

The producer will also return both the file name as well as its location to the consumer when the end of input file is reached.

Implementation Details

1.You should develop a module that implements a queue of character string buffers.

2.This structure will be an array of pointers to strings with integers to indicate the head and tail of the list.

3.The maximum size of the buffer array will be 10.

4.Buffers will be created by the reader thread and destroyed by the writer thread.

5.Threads should terminate when end of input file is reached.

Due Date

The project is due on Monday, December 3th, 2018.

Expectation

Your program should be layered, modularized and well commented. The following is a tentative marking scheme and what is expected to be submitted for this assignment:



1.External Documentation including [5-10 pages]

a.Title page

b.A table of contents

c.[20%] System documentation

i.A high-level data flow diagram for the system

ii.A list of routines and their brief descriptions

iii.Implementation details

d.[10%] Test documentation

i.How you tested your program

ii.Testing outputs

e.[10%] User documentation

i.Where is your source

ii.How to run your program

iii.Describe parameter (if any)


2.Source Code

a.[50%] Correctness

b.[10%] Programming style

i.Layering

ii.Readability

iii.Comments

iv.Efficiency




CQUPT  - 奥尔巴尼大学

计算机科学 - 国际学院

CSI 400操作系统

编程作业1(草稿副本)

2018年秋季


项目目的:

这项任务的目标是通过设计和实现多线程应用程序,通过使用Pthreads来了解信号量。第二个目标是了解信号量在操作系统和应用程序中的使用方式。您将编写使用Pthreads同步并发文件活动的生产者和使用者C程序。


细节:

您的解决方案必须包括以下内容

1.消费者

通过提供文件名,位置和字符向生产者提交处理请求。它还将生产者提供的文件内容输出到标准输出。

2.制片人

接受多个使用者请求并通过创建以下四个线程来处理每个请求。

1读者线程将一次读取一行输入文件。它将通过消息队列将每行输入传递给字符线程。

2字符线程组件将扫描该行,并用客户端提供的字符替换每个空白字符。然后它将通过另一个消息队列将该行传递给toUpper线程。

3 toUpper线程组件将扫描该行并将所有小写字母转换为大写。然后它将通过另一个消息队列将转换后的行传递给写入程序线程。

4 writer线程将该行写入输出文件。

当到达输入文件的末尾时,生产者还将向消费者返回文件名及其位置。



实施细节:

1.您应该开发一个实现字符串缓冲区队列的模块。

2.此结构将是一个指向字符串的指针数组,其中整数用于指示列表的头部和尾部。

3.缓冲区数组的最大大小为10。

4.缓冲区将由读取器线程创建并由编写器线程销毁。

5.当到达输入文件的末尾时,线程应该终止。



截止日期:

该项目将于2018年12月3日星期一到期。

期望

您的程序应该是分层的,模块化的和良好的评论。以下是暂定标记方案,预计将为此项目提交的内容:



1.外部文件,包括[5-10页]

一个。封面

湾目录

C。 [20%]系统文档

一世。系统的高级数据流图

II。例程列表及其简要说明

III。实施细节

d。 [10%]测试文档

一世。你是如何测试你的程序的

II。测试输出

即[10%]用户文档

一世。你的来源在哪里?

II。如何运行你的程序

III。描述参数(如果有的话)


2.源代码

一个。 [50%]正确

湾[10%]编程风格

一世。分层

II。可读性

III。评论

IV。效率


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp