Thread: how to execute in two C programs simultaneously.

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    3

    Question how to execute in two C programs simultaneously.

    Hi everybody,

    I want to execute two C programs simultaneously. Is it possible.
    If it is possible, please inform me.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    101
    No it is not possible unless you have two microprocessors. However, the effect of two programs running simultaneously can be simulated through multiple threads or processes. How you go about either of those depends on your compiler and operating system though.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    In Linux/Unix - dead easy

    Just type
    Code:
    ./prog1 &
    ./prog2 &
    Both programs running (more or less) at the same time.
    It's all an illusion though unless you really have multiple processors in your machine. The OS just divides up time between all the active processes to give the illusion that many things are happening at once.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. php to execute c++ programs
    By kdoggfunkstah in forum C++ Programming
    Replies: 8
    Last Post: 07-26-2006, 12:26 PM
  2. Execute prog as other user
    By groorj in forum C Programming
    Replies: 2
    Last Post: 05-04-2005, 12:28 PM
  3. Execute from another program using C#
    By Grayson_Peddie in forum C# Programming
    Replies: 4
    Last Post: 05-04-2003, 12:03 PM
  4. creating DLL's to allow people to execute MFC programs
    By Jamsan in forum Windows Programming
    Replies: 1
    Last Post: 03-03-2003, 02:03 AM
  5. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM