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. Process VS Thread

Process VS Thread

Scheduled Pinned Locked Moved C#
helpvisual-studioperformancequestion
3 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.
  • D Offline
    D Offline
    Den2Fly
    wrote on last edited by
    #1

    Hi everybuddy, We are developing a project in which a set of various assemblies should be loaded into memory and run. We have two strategies to do that: 1. Starting each assembly code in separate thread 2. Starting each assembly code in separate process The problem is that I can't find a good reason for one of these ways, while my knowledge about important differences between 'Process' & 'Thread' is not complete. In the topic I am looking to find these answers: 1. In the case of threads, can some error in code running in one thread cause problems for execution of other assembly codes in other threads, and even prevent them from running? if yes what type of errors may cause this situation? 2. what would happen if operating system, managed all applications in set of threads instead of set of processes? Thank you so much for your note and any help --- "Art happens when you least expect it."

    F 1 Reply Last reply
    0
    • D Den2Fly

      Hi everybuddy, We are developing a project in which a set of various assemblies should be loaded into memory and run. We have two strategies to do that: 1. Starting each assembly code in separate thread 2. Starting each assembly code in separate process The problem is that I can't find a good reason for one of these ways, while my knowledge about important differences between 'Process' & 'Thread' is not complete. In the topic I am looking to find these answers: 1. In the case of threads, can some error in code running in one thread cause problems for execution of other assembly codes in other threads, and even prevent them from running? if yes what type of errors may cause this situation? 2. what would happen if operating system, managed all applications in set of threads instead of set of processes? Thank you so much for your note and any help --- "Art happens when you least expect it."

      F Offline
      F Offline
      Febret
      wrote on last edited by
      #2

      Basically, there exists a relation one-to-many between processes and threads. That is, a process can host one or more threads but the inverse is not true. All the threads inside a process share the same memory space, while each different process has its own heap. Threads are in general a lighter solution that processes when you need concurrency, but not isolation of the memory space. As for your questions: 1: If one thread throws an unhandled exception your entire application should stop. In the case or processes, in one 'crashes' the others keep running. If you implement a good exception handling mechanism, using threads should not be a problem anyway. 2: Using threads inside an operating system means having all the system memory in common to all the application running inside the system. This means that every piece of code can read and write memory of other applications. In other words, applications would not be isolated, the failure on one program can lead, through memory violations, to the failure of the entire system. Also, there would be no way of preventing malicious code to write on memory areas owned by other threads. Hope this was useful

      D 1 Reply Last reply
      0
      • F Febret

        Basically, there exists a relation one-to-many between processes and threads. That is, a process can host one or more threads but the inverse is not true. All the threads inside a process share the same memory space, while each different process has its own heap. Threads are in general a lighter solution that processes when you need concurrency, but not isolation of the memory space. As for your questions: 1: If one thread throws an unhandled exception your entire application should stop. In the case or processes, in one 'crashes' the others keep running. If you implement a good exception handling mechanism, using threads should not be a problem anyway. 2: Using threads inside an operating system means having all the system memory in common to all the application running inside the system. This means that every piece of code can read and write memory of other applications. In other words, applications would not be isolated, the failure on one program can lead, through memory violations, to the failure of the entire system. Also, there would be no way of preventing malicious code to write on memory areas owned by other threads. Hope this was useful

        D Offline
        D Offline
        Den2Fly
        wrote on last edited by
        #3

        A very complete reply, the only thing I can add is a "Thank you" and that is all :-) --- "Art happens when you least expect it."

        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