C++代写:CPSC5042 Multithreaded Programming

用C++代写多线程程序,对文件进行并发处理。

Programming Problem

Write a multithreaded program that counts the number of time each vowel cumulatively appears in 20 different text files.

Additional Requirements and Hints

  • The files are named “file1.txt”, “file2.txt”, , and “file20.txt”. They are available from the directory on cs1: /home/fac/lil/cpsc5042/hw1/

  • The program should create 20 threads, each thread should process a different input file.

  • Your program must read from the files in the directory /home/fac/lil/cpsc5042/hw1/.

    • Do not assume the input files are in the current directory.

    • The directory and file names must be hard-coded into the program. Do NOT prompt the user for this information.

  • Your program must use arrays (or other data structure) and loops to avoid redundant code. Code that replicates something 20 times (such as 20 pthread_create calls) will be penalized.

  • If a pthread function returns an error, abort the program with an error message.

  • Assuming error-free execution, the only output the program should produce is the cumulative frequency for each of the five vowels (a, e, i, o, and u). Do NOT print out the individual counts for each file.

  • A vowel should be counted regardless if the vowel is lowercase or uppercase.

  • Each input file will contain at least one line. Beyond this, you cannot make any assumptions on how long the input file is.

Grading

The assignment will be graded in accordance with the programming assignment expectation handout. Failure to adhere to the guideline could result in losing points.

Submitting your Program

Your program must be stored in a single file called ‘hw1.cpp’.

On cs1, run the following script in the directory with your program:

/home/fac/lil/submit/cpsc5042/hw1_submit

This will copy the file associated with this assignment to a directory that is accessible by the instructor. Please be sure to name the files correctly or the submission program will not work.

The submission program will attempt to compile your program. Failure to submit a successful submission before the due date and time will result in a zero. Programs that fail to compile will result in a zero. Only the last assignment submitted before the due date and time will be graded.

Late submissions are not accepted and will result in a zero.