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