CSC 442
Homework 1
Write a program which exhibits the following behavior (assume that the program is run as process P1):
- Prints the message "P1: I am going to create a new process".
- Creates a new process P2
- The newly created process P2 prints the message: "P2: I am the new process".
- P1 prints the message "P1: I have created a new process".
Indications
NB: The words in bold are what you see on the screen. The rest is what you have to type in. I suggest you write the program in C or C++. However, Pascal is also acceptable if this is the language that you have been taught in CSC110, CSC220.
- Write your program on a piece of paper. Do not continue with step 2 until you are sure the program will work.
- Log in on Unix using your user name and password.
SunOS UNIX (jupiter.cs.wayne.edu)
login: your_username
Password: your_password
Last login: Mon Sep 29 16:43:37 from perseus.cs.wayne
SunOS Release 4.1.3C (FS2) #1: Fri Apr 18 11:22:33 EDT 1997
jupiter[1] %
- Change your password (if you have not already done so) using the command passwd. Do not forget your password.
jupiter[1] %passwd
Enter your old password:
Enter your new password:
Re-enter your new password:
- Edit your program using a text editor like vi, emacs, edit, etc. Create a text file with the name process.c
- Compile your program using the command gcc.
jupiter[1] %gcc -o process process.c
- Run your program.
jupiter[1] %process
- If you spot errors or the program does not behave as desired, go back to 4, edit your file correcting the errors, re-compile and run it again until it works. When it works, change the permissions on the source and executable file so that I can access the file. Do that with the command:
jupiter[1] %chmod 707 *
Submit:
- A print-out of your program.
- A written description of the program and its behavior.