LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-16-2003, 10:57 AM   #1
sniff
Member
 
Registered: Jan 2003
Location: Durham UK
Distribution: openSUSE/Debian/ubuntu
Posts: 362

Rep: Reputation: 42
Forking and multiprocessors


Hello,

If I use forking to create a child process in linux, will linux run that process on a different processor to the main process if it will mean the program runs quicker?

Hope that makes sense...
Sniff
 
Old 02-16-2003, 11:11 AM   #2
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
If you have a multiprocessor system, it may choose to do so.

Alex
 
Old 02-16-2003, 12:15 PM   #3
Silent Bob
Member
 
Registered: Feb 2003
Location: Ireland
Distribution: Debian
Posts: 56

Rep: Reputation: 15
It depends on what the priority of the process/its child are and the priorities of other processes on the system.

Processes are put into a reasonably complicated scheduler which decides which processes run and where. If you really need it to run faster then upping the priority will certainly help.

If you don't have many other processes running and the extra processors are idle then I would imagine that the child would be run on another processor to increase CPU utilisation.
 
Old 02-17-2003, 11:26 AM   #4
sniff
Member
 
Registered: Jan 2003
Location: Durham UK
Distribution: openSUSE/Debian/ubuntu
Posts: 362

Original Poster
Rep: Reputation: 42
Hi,
Sounds like it might work, I will let you know how I get on. I'm writing programs that model population genetics and they are very processor intensive. Is there a way of increasing the priority of a process in code?

Sniff
 
Old 02-18-2003, 05:28 PM   #5
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
man 3 nice

might be what you want.

Alex
 
  


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
Forking Related.. abhijeetudas Linux - General 2 06-09-2005 01:58 AM
piping /forking geminigal Programming 3 04-10-2005 09:49 PM
Forking under Slackware 10 DD32 Slackware 10 07-16-2004 03:30 PM
Forking is very slow jspenguin Linux - General 2 05-29-2004 02:03 PM
Help! Forking errors! strider Linux - General 10 04-25-2002 12:22 PM

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

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