multiple processes

Discussion in 'C++' started by Vikas Vijay, Jul 20, 2003.

  1. Vikas Vijay

    Vikas Vijay Guest

    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
     
    Vikas Vijay, Jul 20, 2003
    #1
    1. Advertising

  2. Vikas Vijay

    John Carson Guest

    "Vikas Vijay" <> wrote in message
    news:
    > 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)
     
    John Carson, Jul 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhishek Srivastava
    Replies:
    9
    Views:
    3,986
    Ashish
    Feb 3, 2004
  2. =?Utf-8?B?bWFicmlu?=

    Multiple worker processes/ViewState

    =?Utf-8?B?bWFicmlu?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    462
    bruce barker
    Mar 4, 2005
  3. Jeff Rodriguez
    Replies:
    23
    Views:
    1,161
    David Schwartz
    Dec 9, 2003
  4. Smegly
    Replies:
    1
    Views:
    1,122
    Mitchell
    May 19, 2004
  5. Marc Heiler
    Replies:
    1
    Views:
    183
    Robert Klemme
    May 24, 2009
Loading...

Share This Page