LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-14-2016, 12:11 AM   #1
Sibasish
LQ Newbie
 
Registered: Feb 2016
Posts: 1

Rep: Reputation: Disabled
Unhappy fork(fork()) is it possible...!!!


if it is possible how it works..???
 
Old 02-14-2016, 03:29 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,646

Rep: Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509Reputation: 3509
I do not really understand what do you want to achieve. It is possible in general.

Last edited by pan64; 02-14-2016 at 01:15 PM.
 
Old 02-14-2016, 11:21 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 10,226
Blog Entries: 7

Rep: Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528Reputation: 2528
have you tried it?
why shouldn't it work.
Code:
#!/bin/bash

function fork {
	 fork 
}

fork
 
Old 02-14-2016, 12:09 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,080

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
It is posssible, albeit with some complaints from the C compiler since fork() does not take an argument, but what are you trying to accomplish? The process tree you would end up with after fork(fork()) is
Code:
                parent
                  /\
                 /  \
                /    \
             child1 child2
                       \
                        \
                      child3

Last edited by rknichols; 02-14-2016 at 12:10 PM.
 
  


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
LXer: HTML5: To Fork or Not to Fork LXer Syndicated Linux News 1 07-25-2012 08:58 PM
FORK vishnu anand Linux - Newbie 1 01-05-2012 04:16 PM
Regarding Fork() sankumar Programming 2 12-19-2008 09:02 AM
using fork() culin Programming 12 01-17-2007 11:59 PM
more on fork() feetyouwell Programming 6 09-17-2004 12:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

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

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