Question

fibonacci sequence in C

The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... Formally, it can be
expressed as:
f ib0 = 0
f ib1 = 1
f ibn = f ibn−1 + f ibn−2
i. Write a C program using the fork() system call that that generates the Fibonacci
sequence by the child process.
ii. If the user input as 5 then the child process has to output up to the 5 that is output
must be 0,1,1,2,3,5.
iii. Parent has to print the child process id and child has to print the parent process id.
iv. Parent has to finish only after the child terminates.
v. Is there any process synchronization problem here? Justify your answer.
vi. Modify the above program to create a zombie process. How do y ou identify the
zombie process?
vii. Modify the above program to create an orphan process.
viii. Compare and contrast the process and threads.


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
fibonacci sequence in C
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • pls give answers for this

    The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... Formally, it can be expressed as: f ib0 = 0 f ib1 = 1 f ibn = f ibn−1 + f ibn−2 i. Write a C program using the fork() system call that that generates the Fibonacci sequence by the child process. ii. If the user input as 5 then the child process has to output up to the 5 that is output must be 0,1,1,2,3,5. iii. Parent has to print the child process id and child has to print the parent process id. iv. Parent has to finish only after the child terminates. v. Is there any process synchronization problem here? Justify your answer. vi. Modify the above program to create a zombie process. How do y ou identify the zombie process? vii. Modify the above program to create an orphan process. viii. Compare and contrast the process and threads.

  • Please I need java code for this question with output: 4.19) The Fibonacci sequence is the...

    Please I need java code for this question with output: 4.19) The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... Formally, it can be expressed as: f ib0 = 0 f ib1 = 1 f ibn = f ibn−1 + f ibn−2 Write a multithreaded program that generates the Fibonacci sequence using either the Java, Pthreads, or Win32 thread library. This program should work as follows: The user will enter on the command...

  • Check the words in bold. The Fibonacci sequence is the series of numbers 0,1,1, 2, 3,...

    Check the words in bold. The Fibonacci sequence is the series of numbers 0,1,1, 2, 3, 5, 8,.... Formally, it can be expressed as: fib0 = 0 fib1 = 1 fibn = fibn-1 + fibn-2 Write a multithreaded program that generates the Fibonacci sequence using the Win32 thread library(not pthreads because it does not work on windows). This program should work as follows: The user will enter on the command line the number of Fibonacci numbers that the program is...

  • Problem 2: (8 pts) The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8.,.. Formal...

    Problem 2: (8 pts) The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8.,.. Formally, it can be expressed as: fib0-0 fibl-1 fibn-fibn-1+fibn-2 Write a multithreaded program that generates the Fibonacci sequence. This program should work as follows: On the command line, the user will enter the number of Fibonacci numbers that the program is to generate. The program will then create a separate thread that will generate the Fibonacci numbers, placing the sequence in...

  • The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .......

    The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... It is defined by the following mathematical expression, with X0 & X1 being 0 and 1, respectively: Xn = Xn-1 + Xn-2 Write a C program using the fork() system call that generates and prints the Fibonacci sequence in the child process. The number of members in the sequence will be determined by a user provided as a user prompted input. Make the parent...

  • 1. Solve synchronization problems inherent in inter-process communication and multi-threaded applications.

    1. Process control system calls: The demonstration of fork, execve and wait system calls along with zombie and orphan states.a. Implement the C program in which main program accepts the integers to besorted. Main program uses the fork system call to create a new process called a child process. Parent process sorts the integers using merge sort and waits for child process using wait system call to sort the integers using quick sort. Also demonstrate zombie and orphan states.b. Implement...

  • Question 3 Program Language C++ Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence...

    Question 3 Program Language C++ Problem 3 Fibonacci Numbers 10 points Fibonacci numbers are a sequence of numbers where each number is represented by the sum of the two preceding numbers, starting with 0 and 1: 0, 1, 1, 2, 3, 5, 8, etc Write a program that repeatedly prompts the user for a positive integer and prints out whether or not that integer is a Fibonacci number. The program terminates when-I is entered. Create a method with the following...

  • The goal of this assignment is to write a multithreaded program (Task3.c) that explores synchronization challenge 1. Assume that we have a shared variable CurrentiD. This is initialized to 1 at t...

    The goal of this assignment is to write a multithreaded program (Task3.c) that explores synchronization challenge 1. Assume that we have a shared variable CurrentiD. This is initialized to 1 at the beginning. 2. Now create 5 threads in your program and assign ID 1,2,3,4,5 to them respectively. You can pass the ID as a parameter when you create the threads. Each of the threads will try to access the variable "CurrentiD" Whenever a thread acquires the variable, it checks...

  • Write a C program to create a parent and child process. Display the pid of the parent process. In the child process, display the pid and compute the Fibonacci series for 10 numbers

    Write a C program to create a parent and child process. Display the pid of the parent process. In the child process, display the pid and compute the Fibonacci series for 10 numbers

  • Complete the following C code by filling all “???”sto write a C program to create a...

    Complete the following C code by filling all “???”sto write a C program to create a child process. Before the child process is created, an integer variable A is defined and assigned value 10. Then in the child process, A is reduced by 5. After the child process completes, the parent process increases A by 5. Then what will A’s value be just before the parent process completes? Why? Write the code and run it to verify your answer. #include...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT