subject

1 Objectives: Practice with system calls to: a) perform file operations; and b) create and use processes.
2. Description:
Overview: You will write a program (says wordcount. c) to find out the number of words in multiple text files. Specifically, the program will first determine the number of files to be processe Then, the program will create multiple processes with each process being responsible for one file to count its words. The typical format to run the program with input parameters is as follows: /wordcount File_1 File 2 File n
Details: First, the program needs to determine the number of files to be processed. This can be done with the argc parameter of the main function; Then, the argv parameter can be used to retrieve the name for each file.
After that, fork) system call will be used to create multiple processes (one for each file). For each child process, it can simply invoke a function to count the number of words inside a specific file and print out the result like (note that, no inter-process communication is required as child processes will report (i. e., print out) their results individually):
Child process for File_x: number of words is XXX
The main process should wait until all child processes report their results; then, the main process report the end of the program with the print out: All n files have been counted!
For word counting, you could simply use the space character as the delimiter. Anything that are not separated by the space will be counted as a single word. For instance, the example "The first program is a Hello-world." will be reported as 6 words (where Hello-world is counted as a single word). You could compare your results using the wc utility that is available on Linux machines.
3. Submission Requirements
The assignment needs to be submitted on Blackboard. The submission includes two parts:
A. Source codes: This assignment should have only one source file (wordcount. c) and multiple header files (as you lik. Your program needs to have proper comments (e. g explanations for functions and variables etc.). It will be graded based on both functional correctness and clearity of the necessary comments.
B. Report. txt: In this text file, you need to report: a) the status of your program (completed or not; partial credit will be given even the program is not completed); b) the design of your program (what and how system calls are utilized etc.); c) what help (if any) you get from TA and/or your classmates; and d) comments and suggestions to improve this assignment.
C. Submission: Please have all the above files zipped into a single file assignl-abc123.zip and upload the file on Blackboard, where abc123 should be your UTSA ID.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
The first screen you see when you open word2016 what is called?
Answers: 1
You know the right answer?
1 Objectives: Practice with system calls to: a) perform file operations; and b) create and use proc...
Questions
question
Mathematics, 13.05.2021 23:50
question
Mathematics, 13.05.2021 23:50
question
History, 13.05.2021 23:50
question
Geography, 13.05.2021 23:50
question
Biology, 13.05.2021 23:50
Questions on the website: 13722359