Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. what are threads and processes

what are threads and processes

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    please can you explain me what are threads and what are processes and what is the difference between the two ? thank you a lot

    W E 2 Replies Last reply
    0
    • L Lost User

      please can you explain me what are threads and what are processes and what is the difference between the two ? thank you a lot

      W Offline
      W Offline
      Wayne Fuller
      wrote on last edited by
      #2

      This won't be a very in depth answer, for more information check out "Advanced Windows" by Jeffrey Richter. A process is an instance of a running program. You start a program, it will run in a seperate "process". A process must own at least one thread to execute the code in its process. A thread runs within a process. A process can hold many threads, but it has to have at least one. A thread is what actually executes the code in a process. I know this is very brief, but I hope it helps a little. :-O Wayne

      L 1 Reply Last reply
      0
      • W Wayne Fuller

        This won't be a very in depth answer, for more information check out "Advanced Windows" by Jeffrey Richter. A process is an instance of a running program. You start a program, it will run in a seperate "process". A process must own at least one thread to execute the code in its process. A thread runs within a process. A process can hold many threads, but it has to have at least one. A thread is what actually executes the code in a process. I know this is very brief, but I hope it helps a little. :-O Wayne

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        thanks, it helped a lot ... so process is running program each thread have its own registers like ax,bx,CS:IP. Right ? Use threads the same memory - memory of process ??? can one process access threads of another process? one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???

        S P 2 Replies Last reply
        0
        • L Lost User

          thanks, it helped a lot ... so process is running program each thread have its own registers like ax,bx,CS:IP. Right ? Use threads the same memory - memory of process ??? can one process access threads of another process? one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???

          S Offline
          S Offline
          Scott
          wrote on last edited by
          #4

          A good source would be Joseph M. Newcomer's articles on this site, under General Category Threads Processes & IPC.:) Scott! Put the big rocks in the glass jar first!

          1 Reply Last reply
          0
          • L Lost User

            please can you explain me what are threads and what are processes and what is the difference between the two ? thank you a lot

            E Offline
            E Offline
            Erik Funkenbusch
            wrote on last edited by
            #5

            A process is a thread container. The process defines the memory context in which 1 or more threads run. You can't have a process without at least one thread.

            L 1 Reply Last reply
            0
            • L Lost User

              thanks, it helped a lot ... so process is running program each thread have its own registers like ax,bx,CS:IP. Right ? Use threads the same memory - memory of process ??? can one process access threads of another process? one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???

              P Offline
              P Offline
              Peter Sjostrom
              wrote on last edited by
              #6

              "... so process is running program each thread have its own registers like ax,bx,CS:IP. Right ?" Not my expertise, but I think so, yes. "Use threads the same memory - memory of process ???" Same EXE image, yes. Global variables/objects is also shared between threads within a process. Locally defined variables/objects within a thread are not shared between threads. "can one process access threads of another process?" Don't think so. "one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???" Yes, web servers usually contain many more threads than 20. Our company has software running 50+ threads also, a lot being threads with different tasks. Word uses a separate thread to print documents too, for example.

              1 Reply Last reply
              0
              • E Erik Funkenbusch

                A process is a thread container. The process defines the memory context in which 1 or more threads run. You can't have a process without at least one thread.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                thanks a lot everybody, you really helped me!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups