Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-24-2004, 02:08 AM   #1
Registered: Apr 2004
Location: India
Posts: 42

Rep: Reputation: 15

i am new to linux. i just to want to know that if a command like fork() exists in Linux and if yes please tell me the use of it.


Old 05-24-2004, 04:11 AM   #2
Registered: Apr 2004
Location: France
Distribution: Mandrake
Posts: 67

Rep: Reputation: 15
fork ? Of course

Yes, of course fork exists in linux/C, and is similar to what it does in UNIX.

All these linux/unixes are multiprocesses operating systems, which means that at any given time, you have multiple process running in parallel (windows does the same since I guess
windows 98). ( ps -ef gives you all the running processes)

You have the ability, inside one process, to launch a new one. Each living process has a unique ID number (called PID) and a number referring to its parent ID (called PPID), i.e. the process which launched this one.

when you use the fork() command, you duplicate your original process. The processes are similar to each other, exept the PID and PPID. (fork return the pid of the child process)

Now, by cheking inside the two processes their own pid, you can induce each of them to perform a different task. You have many way to synchronize them. Look at the man pages for

fork, waitpid, ptrace,clone, exec, ...

I think the same concept in windows is called multithreading.


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
more on fork() feetyouwell Programming 6 09-17-2004 11:18 AM
fork beginner_84 Programming 2 08-20-2004 04:53 AM
Fork again Avatar33 Programming 13 08-22-2003 01:41 PM
fork() lowlifeish Programming 3 11-04-2002 10:50 AM
Fork Ztyx Linux - General 1 08-31-2002 11:25 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:13 AM.

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