Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have always been told that thread creation is cheap, especially when compared to the alternative of creating a process. If the program you are talking about does not have a lot of operations that need to run concurrently then threading might not be necessary, and judging by what you wrote this might well be the case. Some literature to back me up:</p> <p><a href="http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/threads.htm" rel="noreferrer">http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/threads.htm</a></p> <blockquote> <p>Threads are cheap in the sense that</p> <ol> <li><p>They only need a stack and storage for registers <strong>therefore, threads are cheap to create.</strong></p></li> <li><p>Threads use very little resources of an operating system in which they are working. That is, threads do not need new address space, global data, program code or operating system resources.</p></li> <li><p>Context switching are fast when working with threads. The reason is that we only have to save and/or restore PC, SP and registers.</p></li> </ol> </blockquote> <p>More of the same <a href="http://www.cs.brown.edu/research/thmon/thmon2a.html" rel="noreferrer">here</a>.</p> <p>In <a href="http://rads.stackoverflow.com/amzn/click/0470279931" rel="noreferrer">Operating System Concepts 8th Edition</a> (page 155) the authors write about the benefits of threading:</p> <blockquote> <p><strong>Allocating memory and resources for process creation is costly.</strong> Because threads share the resource of the process to which they belong, it is more economical to create and context-switch threads. Empirically gauging the difference in overhead can be difficult, but in general it is much more time consuming to create and manage processes than threads. In Solaris, for example, creating a process is about thirty times slower than is creating a thread, and context switching is about five times slower.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload