Studying C# - process vs thread


Process

Process is a virtual address space.

Threads

They execute code. They can be considered as a path of execution through a single process. This means they follow a path of execution through an exe and probably many dll's in the process space.

Threads usually have access to all the code within a process space. But in .Net managed code, the accessible of the threads are limited to the app domain.

In windows, when all the the threads have exited from a process space, windows calls the "tear down" method of the process to destroy the process.

Multi threading advantages

1. Can utilize multi-cores in multi-core machines
2. Can give a more responsive UI by increasing the priority for the UI thread.
3. Perform CPU bound operations while I/O operations are waiting to complete.


Disadvantages

In a single thread CPU, it will take more time.

Explanation

This is due to the extra time for scheduler to stop a thread and assign the remaining part of the work to the next thread.









Popular posts from this blog

The pesky scrollbars on Remote desktop - Finally fixed!!

Exploring RedCritter - website for Agile project mangement

API Testing with Rest Assured - Validating the json schema