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#
  4. Limit to one cpu

Limit to one cpu

Scheduled Pinned Locked Moved C#
question
5 Posts 4 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.
  • M Offline
    M Offline
    Mr Rogers
    wrote on last edited by
    #1

    Is there anyway to programmatically limit an application to one cpu? I have a third party tool that dies on multiprocessor computers but it works great on one processor. Any ideas? :~

    A D P M 4 Replies Last reply
    0
    • M Mr Rogers

      Is there anyway to programmatically limit an application to one cpu? I have a third party tool that dies on multiprocessor computers but it works great on one processor. Any ideas? :~

      A Offline
      A Offline
      Arun Bhalla
      wrote on last edited by
      #2

      Is your application multithreaded? It could be that your code is not actually thread-safe, but you haven't actually tested it enough on uniprocessor machines to see it fail.

      1 Reply Last reply
      0
      • M Mr Rogers

        Is there anyway to programmatically limit an application to one cpu? I have a third party tool that dies on multiprocessor computers but it works great on one processor. Any ideas? :~

        D Offline
        D Offline
        Daniel Turini
        wrote on last edited by
        #3

        On Task Manager you can use "Set Affinity..." menu to limit it to only one CPU. There are API calls to control processor affinity. Yes, even I am blogging now!

        1 Reply Last reply
        0
        • M Mr Rogers

          Is there anyway to programmatically limit an application to one cpu? I have a third party tool that dies on multiprocessor computers but it works great on one processor. Any ideas? :~

          P Offline
          P Offline
          parths
          wrote on last edited by
          #4

          There's a Win32 API function SetProcessAffinityMask Maybe that can help "It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman "Philosophy is a study that lets us be unhappy more intelligently." -Anon.

          1 Reply Last reply
          0
          • M Mr Rogers

            Is there anyway to programmatically limit an application to one cpu? I have a third party tool that dies on multiprocessor computers but it works great on one processor. Any ideas? :~

            M Offline
            M Offline
            Mr Rogers
            wrote on last edited by
            #5

            Sweet, thanks for the quick replys. Arun My application that uses the third party tool is not multithreaded. Daniel Yeah, I saw that in the task manager, that's what led me to believing that the multi cpu was the problem because when I did set the affinity to just one cpu it works great. parths Sweet, I'll have to try that out and see if I can limit it using that call. UPDATE: I tried that SetProcessAffinityMask method and it worked like a charm. I added what I did to the www.pinvoke.net/[^] collection. Love that site. Thanks for you help.

            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