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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Thread management

Thread management

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestionc++announcementlounge
2 Posts 2 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.
  • H Offline
    H Offline
    Henrik
    wrote on last edited by
    #1

    Hello, I start at least 4 threads in my program (besides the main program thread). They all have ::WaitForSingleObject(...); in them, one is for file notification update, one is for other stuff, anyway, my question is, how much does this IMPACT on program speed & memory consumption in general (depending on CPU and memory)? (I'm working on a small file manager app coded in MFC). If anyone got any comments I'm happy to here them. How many threads could one run with ::WaitForSingleObject(...); in them before it would get noticable (depending on CPU and memory)?... How many threads does a normal window program run, and a Windows 95/98/XP session in general? So all you thread experts, gimme comments! :cool: Cheers, Henrik

    M 1 Reply Last reply
    0
    • H Henrik

      Hello, I start at least 4 threads in my program (besides the main program thread). They all have ::WaitForSingleObject(...); in them, one is for file notification update, one is for other stuff, anyway, my question is, how much does this IMPACT on program speed & memory consumption in general (depending on CPU and memory)? (I'm working on a small file manager app coded in MFC). If anyone got any comments I'm happy to here them. How many threads could one run with ::WaitForSingleObject(...); in them before it would get noticable (depending on CPU and memory)?... How many threads does a normal window program run, and a Windows 95/98/XP session in general? So all you thread experts, gimme comments! :cool: Cheers, Henrik

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      A thread that is blocked in a WaitFor...() call uses no CPU time. If all your threads are running, the CPU will be doing more context-switching, which is an expensive operation (on the order of 200 CPU cycles, IIRC). Each thread uses memory, of course, for its stack and whatever state info the OS keeps on it. But if your threads are blocking for the majority of the time, I don't think you'd run into problems. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

      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