Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-30-2012, 11:38 AM   #1
LQ Newbie
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
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?
Old 10-31-2012, 11:50 AM   #2
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,765

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Sorry, we won't do your homework


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] C fibonacci and prime Balvinder87 Programming 11 09-03-2012 01:15 PM
PC-BSD (fibonacci) Partitioning explorer *BSD 6 05-27-2009 06:20 PM
Fibonacci generation without using temorary variable muskvar Programming 2 09-26-2007 09:16 AM
Fibonacci with fork BrokenFighter Programming 10 03-10-2007 10:41 PM
Big O notation - fibonacci sequence debiant Programming 13 09-10-2006 12:10 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration