LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Fibonacci using Fork() (https://www.linuxquestions.org/questions/linux-newbie-8/fibonacci-using-fork-4175434762/)

npk.312 10-30-2012 10:38 AM

Fibonacci using Fork()
 
Hi all,

I have an assignment of writing a C program using fork()(using process and not thread) that generates the Fibonacci sequence in the child process and then have the parent process to print out the sequence. I'll have to make the processes share memory (mutual exclusion issue) in addition to making the parent process wait for the child process to finish (synchronization issue).
Also I'll have to write two versions for the Fibonacci program: one to demonstrate a race condition between two processes and the other to show two processes communicating via a shared memory safe-guarded by a semaphore.

But I don't know how to do that. Can anyone please help me out with this?

RockDoctor 10-31-2012 10:50 AM

Sorry, we won't do your homework


All times are GMT -5. The time now is 04:59 AM.