Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 18:00, joybeth9591
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
image
Computers and Technology, 24.06.2019 00:50, JakeCline
Which of the following is not a key player in the sale of travel products?
Answers: 2
image
Computers and Technology, 24.06.2019 01:30, tanya44737
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
image
Computers and Technology, 24.06.2019 18:00, aleyshamar14p95561
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best-suited for this?
Answers: 1
Do you know the correct answer?
1 Objectives: Practice with system calls to: a) perform file operations; and b) create and use proc...

Questions in other subjects:

Konu
English, 29.10.2020 01:10