LinuxQuestions.org
Visit Jeremy's Blog.
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-13-2016, 11:11 PM   #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, 02:29 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,789

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

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

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

function fork {
	 fork 
}

fork
 
Old 02-14-2016, 11:09 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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 11:10 AM.
 
  


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

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

All times are GMT -5. The time now is 01:00 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
Open Source Consulting | Domain Registration