473,413 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

multiple processes

hello all,
I have a c++ code in which is sth like

while(i < N)
{
....
do some processing in c++ to create file abc
system("simulator_name < abc")
......c++ ... processing......
}
The problem is my simulator takes some time T to load and only then
starts working on the file abc.After completion the simulator is
exited and the same thing(loading + execution happens in next
iterations..) Since the number of iterations are huge (wasted time NT)
i want something like :

open the simulator only once( just doing system("simulator_name") and
get the handle to the simulator prompt. From then on i just load the
new "abc" file in each iteration, wait for the simulation to complete
(do not exit the simulator) and start my new iteration.

I read about creating a new child process(popen command) etc but could
not figure out exactly how to get a handle to the prompt, and wait
till the simulation is completed. Also the child process is not to be
killed otherwise i lose the handle.
I would appreciate any help/references in this regard. There is
nothing simulator specific. You can imagine a simple gdb command in
place of simulator_command and handle at gdb>

-Thanks
Vikas
Jul 19 '05 #1
1 3722
"Vikas Vijay" <vi****@ececs.uc.edu> wrote in message
news:ce*************************@posting.google.co m
hello all,
I have a c++ code in which is sth like

while(i < N)
{
...
do some processing in c++ to create file abc
system("simulator_name < abc")
.....c++ ... processing......
}
The problem is my simulator takes some time T to load and only then
starts working on the file abc.After completion the simulator is
exited and the same thing(loading + execution happens in next
iterations..) Since the number of iterations are huge (wasted time NT)
i want something like :

open the simulator only once( just doing system("simulator_name") and
get the handle to the simulator prompt. From then on i just load the
new "abc" file in each iteration, wait for the simulation to complete
(do not exit the simulator) and start my new iteration.

I read about creating a new child process(popen command) etc but could
not figure out exactly how to get a handle to the prompt, and wait
till the simulation is completed. Also the child process is not to be
killed otherwise i lose the handle.
I would appreciate any help/references in this regard. There is
nothing simulator specific. You can imagine a simple gdb command in
place of simulator_command and handle at gdb>

-Thanks
Vikas

This is operating system specific (the boost threads library may allow you
to make this somewhat platform independent, but I doubt that it will do the
complete job). I suggest that you post to a newsgroup for your operating
system.

Alternatively, it might be simpler to integrate your while() loop into your
simulator (perhaps your simulator could retrieve data from a file giving
instructions for each run).
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Primo | last post by:
Hello, I am building a data management application with the following processes: Process 1 is a Windows service which uses FileSystemWatcher to monitor a directory. Process 2 opens a file...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
5
by: Jeremy | last post by:
I have a core VB service that monitors a database, and based on data in the records will execute code to send email notifications. Problem: I don't want my main program code to halt and wait for...
2
by: Brett | last post by:
What are the advantages/disadvantages of using one process with multiple threads or doing the same task with multiple processes, each having one thread? I see using multiple threads under one...
22
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load...
4
by: Gregory Gadow | last post by:
I've cobbled together a PrinterClass that takes a text file and dumps it to a printer. The app using is has multiple threads, all of which need access to a shared instance. Can someone point me to...
4
by: colson | last post by:
I know how to create a new process using System.Diagnostics.Process and wait for the process to end using WaitForExit(). How do I wait for multiple processes? Is there an equivalent to...
4
by: Diffident | last post by:
Hello All, IIS 6.0 - I have an application which resides in its own application pool. Does anyone know if we can create multiple application pools for the same application? If we can create...
2
by: comp.lang.php | last post by:
I have an app that is going berzerk on its own; without any code or environmental changes of any kind, for some bizarre reason it will randomly just hang, spawn multiple Apache processes and...
19
by: Zytan | last post by:
I want multiple instances of the same .exe to run and share the same data. I know they all can access the same file at the same time, no problem, but I'd like to have this data in RAM, which they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.