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#
  4. Adding SMP Support

Adding SMP Support

Scheduled Pinned Locked Moved C#
questioncsharpsysadmin
8 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
    Heinz_
    wrote on last edited by
    #1

    Hi, I've just owned an oldie Dual PentiumIII PC for low profile server and specially for programming. I just want to take advantage of SMP for my apps and dual procs system really takes advantage from apps only if the apps is programmed to support smp. I don't know if there's a sentence that should be added in my code or is a parameter in the compiler command. How can i add SMP supports in my C# apps? Thanx. Heinz Suez

    D 1 Reply Last reply
    0
    • H Heinz_

      Hi, I've just owned an oldie Dual PentiumIII PC for low profile server and specially for programming. I just want to take advantage of SMP for my apps and dual procs system really takes advantage from apps only if the apps is programmed to support smp. I don't know if there's a sentence that should be added in my code or is a parameter in the compiler command. How can i add SMP supports in my C# apps? Thanx. Heinz Suez

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Rewrite your app to include multithreading support. It's not something that can just be "turned on" with a switch. Your application must be able to have parts that that run concurrently. For instance, breaking up a problem and having two threads each work on a seperate part of it. Or, in the case of say, a telnet server, one thread handles one client connection and another threads handles another. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Rewrite your app to include multithreading support. It's not something that can just be "turned on" with a switch. Your application must be able to have parts that that run concurrently. For instance, breaking up a problem and having two threads each work on a seperate part of it. Or, in the case of say, a telnet server, one thread handles one client connection and another threads handles another. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        H Offline
        H Offline
        Heinz_
        wrote on last edited by
        #3

        Oh, i though it was as simple as turning a switch on with a special syntax in my code or a parameter in the compilation command. So, you're saying that mi app will automatically detect 2 threads in my code and run each thread with a different processor? In that case i should play a lot with System.Threading

        D 1 Reply Last reply
        0
        • H Heinz_

          Oh, i though it was as simple as turning a switch on with a special syntax in my code or a parameter in the compilation command. So, you're saying that mi app will automatically detect 2 threads in my code and run each thread with a different processor? In that case i should play a lot with System.Threading

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No! You have to write your code to support multiple processors! Your code must be written to create it's own threads where appropriate. There is nothing that will do this for you. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          H 2 Replies Last reply
          0
          • D Dave Kreskowiak

            No! You have to write your code to support multiple processors! Your code must be written to create it's own threads where appropriate. There is nothing that will do this for you. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            H Offline
            H Offline
            Heinz_
            wrote on last edited by
            #5

            Ok, i'll write my own threads inside my code. System.Threading namespace is the way to go? Do i have or can i specify wich processor should handle my thread?

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              No! You have to write your code to support multiple processors! Your code must be written to create it's own threads where appropriate. There is nothing that will do this for you. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              H Offline
              H Offline
              Heinz_
              wrote on last edited by
              #6

              Hi again, i've been surfing the net for a bit help and found code samples referring our topic in intel's site. They use System.Threading for creating new threads (they have code that uses 4 different threads) but how do i know if these threads are handled by diferent processors? cause in the code they don't specify a processor to handle the thread and there's the possibility that a single proc may be running all the threads, how can i specify wich proc to handle threads? Or my pc finds a thread and runs it with a processor and when my pc finds a second thread it runs it with the other proc? Thanks for your help. Sorry if i'm slow learning.

              D 1 Reply Last reply
              0
              • H Heinz_

                Hi again, i've been surfing the net for a bit help and found code samples referring our topic in intel's site. They use System.Threading for creating new threads (they have code that uses 4 different threads) but how do i know if these threads are handled by diferent processors? cause in the code they don't specify a processor to handle the thread and there's the possibility that a single proc may be running all the threads, how can i specify wich proc to handle threads? Or my pc finds a thread and runs it with a processor and when my pc finds a second thread it runs it with the other proc? Thanks for your help. Sorry if i'm slow learning.

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Heinz Suez wrote: but how do i know if these threads are handled by diferent processors? You don't! The system schedules which processor is going to handle which thread. Threads can even be moved between processors. 99% of the time, you really wouldn't have a reason to manually set the processor affinity. but, if you want to take a look at it, ProcessThread[^] in the System.Diagnostics namespace is what your looking for. Be sure to check out the ProcessorAffinity property. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                H 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Heinz Suez wrote: but how do i know if these threads are handled by diferent processors? You don't! The system schedules which processor is going to handle which thread. Threads can even be moved between processors. 99% of the time, you really wouldn't have a reason to manually set the processor affinity. but, if you want to take a look at it, ProcessThread[^] in the System.Diagnostics namespace is what your looking for. Be sure to check out the ProcessorAffinity property. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  H Offline
                  H Offline
                  Heinz_
                  wrote on last edited by
                  #8

                  Thanx man for your help, i got it all clear now.

                  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