LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-30-2012, 11:38 AM   #1
npk.312
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
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,514

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


Reply


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


All times are GMT -5. The time now is 09:56 PM.

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