Sie sind auf Seite 1von 2

Operating Systems Exercise 1

Moti Geva

Forks

Please read the entire exercise and follow the instructions carefully. The exercise contains important technical specication as well as submission instructions. Failing to follow technical specication or submission instructions will result in deduction of points from your grade.

1.1

General Description

Write a program that counts the number of lines in les. Line counting should be made by child processes created using fork(). The le names will be given in argv[1]..argv[argc-1]. When nished counting, each child process prints out the lename and number of lines it counted, separated by a colon (:). For example, assuming file1 contains 221 lines and file2 contains 342 lines, then two child processes should be created (using fork()), each will print out the number of lines it had counted, as follows: $ ./exer1 file1 file2 file1:221 file2:342 $

1.2

Notes

You may only use system calls in your solution, and no library calls, with the sole exception of printf which you may use. Eciency in system terms is important and will be a part of your grade, try to minimize system calls, memory usage etc. Printing order may change, e.g., file2 may appear before file1

1.3

Submission Instructions

You should submit a .zip le containing your code and a Makele12 which builds the appropriate les as instructed in the exercise. All les should contain your name and ID number at their beginning (as a comment).
1A 2A

sample Makele can be found on http://motigeva.com/os/files/Makefile makele tutorial can be found in http://mrbook.org/tutorials/make/

The .zip les name should be your ID number. For example, if your ID number is 123456789 then you should submit a le named 123456789.zip. The submission should be made using https://submit.cs.biu.ac.il/. Failing to follow these instructions will result in taking o points from your grade.

Good luck!

Das könnte Ihnen auch gefallen