Show Bid Request
fork
Bid Request Id: 2851
|
|
|
Description:
Write a program in C which meets the following specifications. Remember to include comments. In this program, interfaces (i.e function names, argument types and order) must be followed explicitly. 1.Print a message indicating that the program has started. 2. Initialize a counter variable called ProcessIDCounter to 0. 3. Fork the program and exit gracefully with an error message if the fork fails. 4. Print a message from the parent process indicating the the process id of the child that has been created, i.e. "Spawned new child process 5928." 5.For both the child and the parent: a. Call a function process_id() which has the following specifcation with your counter variable as the parameter. *Function process_id takes one pass by reference parameter of type integer and no return type. *Print a message indicating the the id of the running process and its parent: "Process 5928 with parent 5917." * you can use the system call getpid() (hint: man getpid) to retrieve the id of the process. System calls of a similar nature are frequently grouped on the same manual page, look there to determine how to get the parent process id. *Increment the variable which is passed to the routine.. b. After the call to process_id(), print to standard output the value of the counter which will have been incremented. Questions For Further Understanding b. After you have completed the assignment, answer the following questions either as comments or on a separate page. As always, complete sentences are expected. Did you get the value you expected for the counter? Why or why not? Were you surprised that the main process has a parent id? Where do you think it may have come from? Hint: After running your program, type "echo $$" from the shell prompt on any of the standard UNIX shells (Bourne shell /usr/bin/sh, Korn shell /usr/bin/ksh, C shell /usr/bin/csh, or any of their derivatives).
Deliverables: Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Special Conditions / Other:
must be done by Monday 9/24/2001
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$20 (USD)
|
Sep 22, 2001 10:48:59 AM EDT
|
9.1
(Superb)
|
|
|
I can give it to you before Monday morning (your time), i.e., you will receive it on Monday morning. I am also doing the java assignment for you. Please accept the bid if it is fine for you.
Regards. |
|
|
|
|
|