0% found this document useful (0 votes)
208 views

Fork C Program

This document provides instructions on how to compile and run a C program using fork() and describes testing of the program. It explains that the fork() function call creates a child process, with the parent process waiting for the child to complete. The child process runs the Collatz conjecture algorithm and prints the resulting sequence of numbers. Screenshots of the code and output are also included.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views

Fork C Program

This document provides instructions on how to compile and run a C program using fork() and describes testing of the program. It explains that the fork() function call creates a child process, with the parent process waiting for the child to complete. The child process runs the Collatz conjecture algorithm and prints the resulting sequence of numbers. Screenshots of the code and output are also included.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PCS01_SEC B_HW3_1224_VAMSI

KRISHNA PANUGANTI

OUTPUT FOR OPTION 1 GIVEN IN
THE HINTS BY THE PROFESSOR.















INSTRUCTION TO COMPILE PROGRAMS:

HOW TO COMPILE: program using Fork()

1.download the files and copy them to Putty
2. to compile give a command gcc o fork fork.c
3. To execute give a command ./fork
4. then a line appears enter the value to get the sequence. Give some positive integer number for
example 8
5. then output will be generated.



TEST REPORT:

PROGRAM USING FORK:

1.We are doing this program using fork function call which create child function to a process

2.First after the fork() call in the main program , program will directly go to parent process in
else section at the end.

3.From there a child process is created and parent will be waiting for the child process to be
completed.

4.Child process has the algorithm of collatz conjecture and will return the sequence of numbers
to print them on to the screen.













Below is a screenshot of program (fork.c) code.






Below is a screenshot of program (fork.c) after executing.

You might also like