CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Posts
    76

    What is the difference between process and thread

    Can anybody tell me the difference
    between process and thread?


  2. #2
    Join Date
    Mar 2001
    Location
    Málaga - Spain
    Posts
    393

    Re: What is the difference between process and thread

    Hi !,

    In theory, If I have understand what you mean with proccess and thread, here you are:

    - Process: It is created in a different space than the program so it has own variable space, to share data with another proccess it needs to make change of context and you have to find a complicated way ( like global memory...).

    - Threads, they are created in the same space than the proccess that created it, so you can use the same space of variables, and it needs not to make context changes to cooperate with the parent thread, so it goes faster, one bad thing, is that to access to variables you need to use somethings ( Mutex, Critical Sections, Semaphores), to avoid that to threads make changes at the same time in one variable.

    Hope this helps, Bye !
    Braulio


  3. #3
    Join Date
    Aug 2021
    Posts
    1

    Re: What is the difference between process and thread

    The processes and threads are independent sequences of execution, the typical difference is that threads run in a shared memory space, while processes run in separate memory spaces.
    • A process has a self-contained execution environment. A process generally has a complete, private set of basic run-time resources; in particular, each process has its own memory space.

    • Threads exist within a process — every process has at least one. Threads share the process's resources, including memory and open files. This makes for efficient, but potentially problematic, communication.

    An example keeping the average person in mind:

    On your computer, open Microsoft Word and a web browser. We call these two processes.

    In Microsoft Word, you type something and it gets automatically saved. Now, you have observed editing and saving happens in parallel - editing on one thread and saving on the other thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured