辅导CS 3305A、讲解Operating Systems、C/C++程序设计调试、c++讲解 讲解Python程序|解析R语言编程

- 首页 >> Python编程
CS 3305A: Operating Systems
Department of Computer Science
Western University
Assignment 1
Fall 2020
Due Date: September 30, 2020
Purpose
The goals of this assignment are the following:
• Get experience with the fork(), wait() and execl() system functions
• Learn more about how operating systems are structured
• Gain more experience with the C programming language from an OS perspective
Parent and Child Processes (100 points)
Write a program in C that will perform the following tasks:
1. Your program will create a parent process which will create two child processes (e.g., child_1, and child_2)
2. parent will wait for child_1 to complete before creating child_2
3. child_1 will create its own child child_1.1
4. Inside child_2, a system call to an external program will be made. child_2 must pass its PID to the external
program “external_program.out.” As a result of this external program call, child_2 will be replaced by
external_program.out (hint: execl()). The path to the external program “external_program.out” will be passed
into the program as a command line argument.
The expected output from your program should look like the following:
parent process (PID 2255) created child_1 (PID 2256)
parent (PID 2255) is waiting for child_1 (PID 2256) to complete before creating child_2
child_1 (PID 2256) created child_1.1 (PID 2257)
child_1 (PID 2256) is now complete
parent (PID 2255) created child_2 (PID 2258)
child_2 (PID 2258) is calling an external program external_program.out and leaving child_2…
From the external program: The PID of child_2 was 2258
Hints: fork(), wait(), getpid(), getppid(), execl()
2
Mark Distribution
This section describes a tentative allocation of marks assigned for the desired features. (100 points)
a) A Parent process will create two Child processes: 20 points
b) Child_1 will create its own child Child_1.1: 20 points
c) Parent will wait for Child_1 to complete before creating Child_2: 15 points
d) Child_2 will make a system call to an external program: 25 points
e) Parent process must not terminate until all child processes have completed: 20 points
Computing Platform for Assignments
You are responsible for ensuring that your program compiles and runs without error on the computing platform
mentioned on below. Marks will be deducted if your program fails to compile or your program runs into errors on
the specified computing platform (see below).
• Students have virtual access to the MC 244 lab, which contains 30 Fedora 28 systems. Linux machines available
to you are: linux01.gaul.csd.uwo.ca through linux30.gaul.csd.uwo.ca.
• It is your responsibility to ensure that your code compiles and runs on the above systems. You can SSH into
MC 244 machines.
• If you are off campus, you have to SSH to compute.gaul.csd.uwo.ca first (this server is also known
as sylvia.gaul.csd.uwo.ca, in honour of Dr. Sylvia Osborn), and then to one of the MC 244 systems
(linux01.gaul.csd.uwo.ca through linux30.gaul.csd.uwo.ca).
• https://wiki.sci.uwo.ca/sts/computer-science/gaul
Provided Files
• Two C files are provided: “assignment1.c” and “external_program.c”
• Your code should only be inside the provided C file “assignment1.c”
• Do not make any changes to “external_program.c”
• Hints and the necessary statements that need to be outputted have been included in “assignment1.c” file
• When running the program, you must provide the path to “external_program.out” as an argument (see
assignment1.c for details)
• If you have any questions regarding the code provided to you, contact the TAs and/or the Instructor
Assignment Submission
You must submit your Assignment through OWL. Be sure to test your code on one of MC 244 systems (see
“Computing Platform for Assignments” section above). Marks will be deducted if your program fails to compile
or your program runs into errors on the computing platform mentioned above. You need to submit one file
“assignment1.c”.
Assignment 1 FAQ will be made available on OWL. Also, consult TAs, and the Instructor for any question you
may have regarding this assignment.

站长地图