LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-19-2005, 02:34 PM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
Daemon Processhas already been asked (and possibly answered).


Hi i am trying to create a daemon process

if (pid<0){
printf("Error creating child process ");
}
if (pid >0){
exit(0);
}
sid=setsid();
if (sid<0){
perror("Problem with the child process");
}


What i know is that i have to fork for a new process ... The new process that now runs in to background.. I also know that the daemon code should be inside a while statement so as to run continiously
while(1){
//do your job
}

I want to know if this code will consume all the cpu or not
 
Old 09-19-2005, 05:24 PM   #2
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Hi,

No, it will behave like any other process and go through the scheduler.
 
  


Reply



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
DVD Shrink - Been asked, but never answered knappster Linux - Software 95 09-19-2005 12:11 AM
this wine question was asked in '03 but never fully answered... breezewax Linux - Software 3 09-24-2004 08:33 AM
Probably been answered, BUT........ phatbastard Slackware 2 09-08-2004 09:05 PM
Very Frequently Asked/Answered Questions ppuru LQ Suggestions & Feedback 7 07-30-2004 01:32 AM
Mark threads as answered jeremy LQ Suggestions & Feedback 6 12-28-2002 05:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:45 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