What are the rules regarding spawning new threads within other running threads? I have a C# app that handles two basic threads in the background. I recently introduced some heavy duty IO stuff, and I was thinking of setting them off inside threads. Are threads nested within themselves cool?
Threads aren't modelled as a hierarchy for the majority of their processing; the concept of "nesting" simply doesn't exist.
A thread executes in parallel to all other threads, regardless of which thread created it. The only things which matter in the creation of a thread is whether it is a background thread or a foreground thread and the priority of the thread:
Priority determines how many slices of time the thread is given when competing with other threads for resources. Higher priority means more slices.
Foreground threads keep a process alive until their work is completed. For background threads, when all foreground threads complete execution in a process, the process ends and the background threads are terminated, regardless of their work completed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With