In traditional operating systems, each process address space and the single thread of control. In fact, it is almost the definition of the process. However, often there are cases where it is desirable to control the various strands of the same address space running in quasi-parallel as if they are separate processes. except that was shared address space. In this excerpt from his book, Modern Operating Systems, Andrew Tanenbaum said these cases and their consequences.
Despite the large thread in the process execution, process and issues related to other concepts. Processes are pooling resources and sharing issues are the entities that received run on the CPU. Thread is a single sequence stream within a process. As the discussion of some of the characteristics of the process, they are sometimes called lightweight processes. In this case, different threads of execution flows. Given the many threads that are popular methods to improve application concurrency.
The CPU goes back and forth quickly between threads and the illusion that the threads can run simultaneously. As an example of the traditional methods of process by a thread, the thread in one of several states (running, blocked, or ready-ready) to be. Each thread has its own stack. Since the wire will usually call for different methods and therefore a different version of the story. Therefore, you must own thread stack. The operating system is the portion of the wire, the basic unit of CPU use wire. A wire or from a program counter (PC), a set of registers and stack memory. Materials are not independent of other processes, such as the son of the results with other threads that code section, data section, the operating system resources known shared tasks such as file and open signs.
€ The unit is essentially the use of CPU threads, which means it runs a production process – is the deal. Thus, each process has at least one thread (thread).
€ This means we now have a shared set of metadata and the process of discussion:
1. The address space of the process, manages global variables, or more specific, such as open files, child processes if any, and signals and signal handlers do not care if some knowledge of accounting.
2. In Tools, on the wire by hand, others, and his stack, registers, variables and the current execution state. This is part of the control blocks of the Tools.
€ Some advantages of a child through the process: lightness it takes less time to create and destroy, are emerging in the context of a more rapid, which share memory and files without calling kernel system calls.
€ There are two main drivers of threads:
1. Kernel threads in Windows child, child provided by the kernel, making control of kernel programming heavier, but it’s the only way a process can be performed on two different processors, for example.
2. The user-level threads or Windows application tools fiber son to run the application and lack many benefits, such as the fact that once their blocks, they are all blocked. On the other hand, the kernel does not handle them, and then we are free to do whatever we want. Coroutines applications using threads in general manage their time.