LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-20-2007, 02:53 AM   #1
kpkant123
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
creating 10 process


can anyone tell me how to Create ten processes and display useful information about them including PID, starting-time in unix using c or c++ language. i tried to create 10 different processes using fork and exec but i couldn't display those process info:PID,STIME.

my sample code

......
......
pid = fork();
if(pid == 0)
{
execl("/bin/ls", "ls");
}
elseif(pid == -1)
{
/error handling
}
else
{
execl("/bin/ps", ""ps);
}
.......
........
parent process execute 'ps' command
child process execute 'ls' command
the script should display pid and stime of those processes:'ps' and 'ls'. like this i want to create 10 processes and display info.please give me ur suggestions to develope a code myself.
 
Old 05-20-2007, 05:22 AM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
use popen along with the command that is used to
to display the process information and list of files.
 
  


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
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 05:48 PM
Error creating te child process for this terminal nevxille Linux - Newbie 3 10-17-2006 01:46 AM
Creating a custom process id cbutcher Linux - General 2 04-29-2005 06:59 AM
creating/running process... gmasterleo2000 Programming 4 12-07-2003 12:37 PM
Creating New Linux Distribution Process liguorir Linux - Software 2 11-10-2003 11:20 AM

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

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