Thread: Proccess and Thread ?

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Proccess and Thread ?

    I have two questions:

    1.) What is the difference between a proccess and a thread?

    2.) Does windows support proccess, or is it only working with threads?


    Thanks.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    ˇAmo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Think of a process as a program. Think of a thread as a subpart of a program.

    Although that description is not exact, it helps you get the gist of the difference.


    Basically, processes can stand alone while threads cannot. Windows supports both.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    is there a way then to do something like the fork() in unix, only on windows?


    also, I know when you place some code as part of a child proccess, it runs next to the parent proccess and not as part of it. is that the same with threads?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You use threads in Windows to simulate fork() functionality from Unix.
    When a thread creates anothter thread, both threads are part of the same address space (process).

    gg

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Windows supports processes, threads and fibers, which are like manually scheduled threads.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    fork() creates a copy of a process, not a thread as such. It's functionality can, indeed, be simulated, but it is not the same.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    No one is claiming they are the same. Since you can't clone a process in Win32, the only way to simulate it is with threads.

    gg

  8. #8
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    so... can I make a piece of code to run on it's own, next to the other code?

    look, i have the next thing:

    I have some code running.
    in the middle of that code i have a long loop.
    and then the code continues.


    what i want to do is to place this long loop in such a way so it won't hold the rest of the code back, so i won't need to wait for the loop to finish, before i continue.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  9. #9
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981

  10. #10
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Thank you for all your help.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 03-08-2008, 05:42 AM
  2. Get info about a proccess
    By Queatrix in forum Windows Programming
    Replies: 3
    Last Post: 12-04-2006, 02:07 PM