Hi everyone,
One of my collegue at work said that on a 4 CPU server, it's better to
write a program that forks 4 "sub-processes" instead of writing a
single process program (ie : a program that doesn't call fork())
I guess the theory behind this is that each one of the 4 sub-processes
can be processed by a separate CPU, which means that in a ideal
scenario, 4 instructions can be processed "at the same time".
What is your opinion on this ? 4 2482 sc*********@hot mail.com <sc*********@ho tmail.comwrote:
One of my collegue at work said that on a 4 CPU server, it's better to
write a program that forks 4 "sub-processes" instead of writing a
single process program (ie : a program that doesn't call fork())
I guess the theory behind this is that each one of the 4 sub-processes
can be processed by a separate CPU, which means that in a ideal
scenario, 4 instructions can be processed "at the same time".
While your collegue might be right, this is the wrong place for
a discussion since it doesn't got anyhing to do with C, which is
the topic of this group (and the C standard doesn't even consider
that there could be more than one program running at a time). Per-
haps you should ask in a UNIX group (e.g. comp.unix.progr ammer)
since fork() historically came form UNIX (if I am not completely
mistaken) or in comp.programmin g, where all kinds of questions
related to programming get discussed.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\______________ ____________ http://toerring.de
Well, I guess you're right but since it was in the context of a C
program... well, never mind : thanks for answering !
In article <11************ **********@g4g2 000hsf.googlegr oups.com>, sc*********@hot mail.com <sc*********@ho tmail.comwrote:
>One of my collegue at work said that on a 4 CPU server, it's better to write a program that forks 4 "sub-processes" instead of writing a single process program (ie : a program that doesn't call fork())
I guess the theory behind this is that each one of the 4 sub-processes can be processed by a separate CPU, which means that in a ideal scenario, 4 instructions can be processed "at the same time".
This is reasonable if your program can be decomposed into parts that
can be run simultaneously, without much need to communicate. If they
need to share data, you may find it easier to use multiple threads
inside a single program. How you do this depends on your system;
C itself does not include any thread mechanism.
Bear in mind that other people using the server may be annoyed at your
making full use of it...
-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
"sc*********@ho tmail.com" <sc*********@ho tmail.comwrites :
Hi everyone,
One of my collegue at work said that on a 4 CPU server, it's better to
write a program that forks 4 "sub-processes" instead of writing a
single process program (ie : a program that doesn't call fork())
I guess the theory behind this is that each one of the 4 sub-processes
can be processed by a separate CPU, which means that in a ideal
scenario, 4 instructions can be processed "at the same time".
What is your opinion on this ?
Look up Amdahl's law.
http://en.wikipedia.or g/wiki/Amdahl's_law
It is discussed in this great book: http://www.amazon.com/Programming-PO.../dp/0201633922 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Benoit Dejean |
last post by:
hello, i have a question about forking processes
atm, i have some code which i want to rewrite
os.system("cd ~ && exec " + cmd + " & disown")
i want to remove this os.system call
|
by: Josh Denny |
last post by:
I am trying to write a simple file transfer server in perl that will
reside of both windows and linux platforms. Basically, it accepts a
connection, forks a process, and then should close the child. on
windows, it dies after "accumulating" 64 children opened - however,
they should all (or most) have exited by that time. Any idea how to
get my children to exit and free up space for more connections?
Thanks - Josh
here's the relevant...
|
by: marconi |
last post by:
hallo there,
Can anyone help me to look at my fork problems? I can't seem to
work up the piping..the reason i need that for is because i need to
make a counter global to client and server.(once fork start,
counter will reset). This allow me to communicate with my
counter.....pls help and thanks a lot
|
by: steve |
last post by:
I was given the following code, and asked what the possible outputs
could be. We're learning about processes and forking.
int value;
int main(){
int pid, number = 1;
value = 2;
pid = fork();
value = value + 2;
number = number + 2;
|
by: chad.vice |
last post by:
I have a CGIC program that generates reporting output on-the-fly. At
times this generation can take a long time, and session timeouts occur
while users wait for the page results to be displayed.
To alleviate this problem, I would like to use fork(), so that a parent
process notifies the user that the report will be e-mailed, while a
detached child process generates and sends the report.
However, it appears that even without a "wait"...
| |
by: JoeW |
last post by:
Now before I go into detail I just want to say that this is purely for
my own benefit and has no real world usage. I remember way back when
the tool for *nix systems called forkbomb was created. I recently
explained it to a friend of mine and at that time decided to see if I
could replicate it in C#. I have created an application that, to me at
least, mimics what fork would/should do on *nix/bsd systems. I know
that fork spawns a new...
|
by: Rafael Giannetti Viotti |
last post by:
Hi,
I am working with the subprocess.py module in Python 2.4.4 and I am
confused about it's functionality. It uses the standard pipe-fork-exec
method to start a subprocess:
# create pipes
pid = fork()
|
by: Falcolas |
last post by:
Hi all,
This may be more of a Linux question, but it relates to how Python
forks...
Today, I implemented a pretty simple listener script using os.fork.
The script runs fine, and performs as expected, but the process table
is left with an odd entry for every fork called.
I'm running on Slackware 9, under the 2.4 kernel, Python 2.5.1.
|
by: 3srt |
last post by:
Hello,
I created a simple 'server' script that will accept input from a cgi script. The server will handle multiple connections on the same port, also. In a nut shell, this 'server' script will take in variables, and fork off a process to sleep for a given amount of time, and then send the user an email (and perform other functions).
Here is my problem: I receive a confirmation e-mail once the connection has been made, but i do not...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |