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. .NET (Core and Framework)
  4. Multi-processing

Multi-processing

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpc++question
7 Posts 3 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.
  • C Offline
    C Offline
    cateyes99
    wrote on last edited by
    #1

    In .Net, we know multithreading, but is it possible to do multi-processing, if I really need, like in C/C++ env? Or multi-appdomain is the alternative in .Net? Thanks, :laugh:

    C 1 Reply Last reply
    0
    • C cateyes99

      In .Net, we know multithreading, but is it possible to do multi-processing, if I really need, like in C/C++ env? Or multi-appdomain is the alternative in .Net? Thanks, :laugh:

      C Offline
      C Offline
      Curtis Schlak
      wrote on last edited by
      #2

      Not sure what you mean, here. Your use of the word "multi-processing" is ambiguous. True multi-processing requires more than one processing unit. With kernel-level threads, which .NET has, you can have multiple threads run on multiple processors. If you're asking can .NET spawn new processes (like fork()), then, yes, it can do that, too. Finally, AppDomains offer a lighter-weight, dedicated memory in-process process. Does that answer your question?

      "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

      C 1 Reply Last reply
      0
      • C Curtis Schlak

        Not sure what you mean, here. Your use of the word "multi-processing" is ambiguous. True multi-processing requires more than one processing unit. With kernel-level threads, which .NET has, you can have multiple threads run on multiple processors. If you're asking can .NET spawn new processes (like fork()), then, yes, it can do that, too. Finally, AppDomains offer a lighter-weight, dedicated memory in-process process. Does that answer your question?

        "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

        C Offline
        C Offline
        cateyes99
        wrote on last edited by
        #3

        Thanks. Basically, just same as you said like fork() in Unix, the new created process will run in its own process container and truly isolated from the parent process, so failure in this process won't bring down others. whether it's supported in the kernel mode or the user mode, is not the concern yet. As you said, "it can do that", can you direct me to some info of how to do it? Thanks.

        D C 2 Replies Last reply
        0
        • C cateyes99

          Thanks. Basically, just same as you said like fork() in Unix, the new created process will run in its own process container and truly isolated from the parent process, so failure in this process won't bring down others. whether it's supported in the kernel mode or the user mode, is not the concern yet. As you said, "it can do that", can you direct me to some info of how to do it? Thanks.

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

          Just look up the System.Diagnostics.Process class.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          1 Reply Last reply
          0
          • C cateyes99

            Thanks. Basically, just same as you said like fork() in Unix, the new created process will run in its own process container and truly isolated from the parent process, so failure in this process won't bring down others. whether it's supported in the kernel mode or the user mode, is not the concern yet. As you said, "it can do that", can you direct me to some info of how to do it? Thanks.

            C Offline
            C Offline
            Curtis Schlak
            wrote on last edited by
            #5

            Here you go: a link to the Process[^] class.

            "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

            C 1 Reply Last reply
            0
            • C Curtis Schlak

              Here you go: a link to the Process[^] class.

              "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

              C Offline
              C Offline
              cateyes99
              wrote on last edited by
              #6

              Thanks you and Dave Kreskowiak, but looks like that this System.Diagnostics.Process class just provides access to local and remote processes and enables you to start and stop local system processes, not let us create a new process and let us run our code in it. Or I might get something wrong, could you give me a small example?

              C 1 Reply Last reply
              0
              • C cateyes99

                Thanks you and Dave Kreskowiak, but looks like that this System.Diagnostics.Process class just provides access to local and remote processes and enables you to start and stop local system processes, not let us create a new process and let us run our code in it. Or I might get something wrong, could you give me a small example?

                C Offline
                C Offline
                Curtis Schlak
                wrote on last edited by
                #7

                If you're looking for the C# equivalent to

                // in file foo.c

                if(fork()) {
                // Do parent process stuff here
                } else {
                // Do child process stuff here
                }

                then I have to disappoint you by reporting that the .NET runtime supports no such system-like call. However, I would challenge the decision to do this by saying, "Hey, that's provedural code out the yin-yang and, since we're ostensibly using an object-oriented framework, then we should seek object-oriented solutions." Just my 0.02 USD.

                "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

                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