starting processes

Hi all,

could anybody there give me a good hand? :slight_smile:

Ok! that’s the thing. I’d like to know what is the best way to start several
processes (no threads) from the same point inside a program, i.e.

main()
{


spawnp(mode, Name_Of_Process);

}


Best way means in my case

  • Full memory protection among process
  • Fastest and most efficient way to do it

Many thanks

JcD

Ok! that’s the thing. I’d like to know what is the best way to start several
processes (no threads) from the same point inside a program, i.e.

main()
{
.
.
spawnp(mode, Name_Of_Process);
.
}


Best way means in my case

  • Full memory protection among process

Neutrino always has a degree of memory protection between processes.

  • Fastest and most efficient way to do it

The spawn family is pretty much the fastest way, as opposed to using system()
which exec’s a shell to run the program, and thus is slower.

Ok thanks Chris!

But… have a look at that

spawnl(P_OVERLAY,“process1”,NULL);

spawnl(P_NOWAITO,“process1”,NULL);

spawnl(P_NOWAIT,“process1”,NULL);

Imagine that parent process only does

  • displays out “I’m the parent”
  • in between the messages it starts process1 up
  • displays out “Process1 run”

Process1 only displays out “I’m the child”.

What is supposed to be the output of these 3 different versions?

Why that siilly question? well, I got only child output
“I’m the parent”
“I’m the child”

with P_OVERLAY.

with the other P_ the output is
“I’m the parent”
“Process1 run”.

Moreover, with the same code (i think so!!), after trying with the other
P_xx I tried again with P_OVERLAY and… surprise

“I’m the parent”
“Process1 run”.

So, how to run child processes either 1,2,3 or any of them… :slight_smile:

Any ideas?

Cheersssss

JcD




“Chris Foran” <cforan@qnx.com> wrote in message
news:Voyager.001114101422.1892389A@cforan…

Ok! that’s the thing. I’d like to know what is the best way to start
several
processes (no threads) from the same point inside a program, i.e.

main()
{
.
.
spawnp(mode, Name_Of_Process);
.
}


Best way means in my case

  • Full memory protection among process

Neutrino always has a degree of memory protection between processes.

  • Fastest and most efficient way to do it

The spawn family is pretty much the fastest way, as opposed to using
system()
which exec’s a shell to run the program, and thus is slower.

Hi,
Just forget about last message!!
I really need glasses!!

:slight_smile:)

JcD


“juan carlos” <jcd@dcs.st-and.ac.uk> wrote in message
news:8urr8l$rss$1@inn.qnx.com

Ok thanks Chris!

But… have a look at that

spawnl(P_OVERLAY,“process1”,NULL);

spawnl(P_NOWAITO,“process1”,NULL);

spawnl(P_NOWAIT,“process1”,NULL);

Imagine that parent process only does

  • displays out “I’m the parent”
  • in between the messages it starts process1 up
  • displays out “Process1 run”

Process1 only displays out “I’m the child”.

What is supposed to be the output of these 3 different versions?

Why that siilly question? well, I got only child output
“I’m the parent”
“I’m the child”

with P_OVERLAY.

with the other P_ the output is
“I’m the parent”
“Process1 run”.

Moreover, with the same code (i think so!!), after trying with the other
P_xx I tried again with P_OVERLAY and… surprise

“I’m the parent”
“Process1 run”.

So, how to run child processes either 1,2,3 or any of them… > :slight_smile:

Any ideas?

Cheersssss

JcD




“Chris Foran” <> cforan@qnx.com> > wrote in message
news:Voyager.001114101422.1892389A@cforan…
Ok! that’s the thing. I’d like to know what is the best way to start
several
processes (no threads) from the same point inside a program, i.e.

main()
{
.
.
spawnp(mode, Name_Of_Process);
.
}


Best way means in my case

  • Full memory protection among process

Neutrino always has a degree of memory protection between processes.

  • Fastest and most efficient way to do it

The spawn family is pretty much the fastest way, as opposed to using
system()
which exec’s a shell to run the program, and thus is slower.