Introduction    

Processes and Threads   

Advantages and disvantages    

User and kernel level threads  

Quiz    

________________________________________
Introduction
        A thread is short for a thread of execution. Threads are a way for a program to fork (or split) itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Threads and processes differ from one operating system to another, but in general, the way that a thread is created and shares its resources is different from the way a process does.In most Tradition operatins systems, each process has an address space and a single thread of control. However, there are situations in which it is desirable to  have multiple threads of control that share a single address space, but run in quasi-parallel, as though they were in fact separate processes.

        Consider, for example, a file server that has to block occasionally waiting for the disk. If the server had multiple threads of control, a second thread would run while the first one was sleeping. The net result would be a higher throughput and better performance. It is not possible to achieve this goal by creating two independent server processes beacuse they must share a common buffer cache, which requires them to be in the same address space.

       Multiple threads can be executed in parallel on many computer systems. This multithreading generally occurs by time slicing, wherein a single processor switches between different threads, in which case the processing is not literally simultaneous, for the single processor is only really doing one thing at a time. This switching can happen so fast as to give the illusion of simultaneity to an end user. For instance, most PCs today only contain one processor core, but you can run multiple programs at once, such as typing in a document editor while listening to music in an audio playback program; though the user experiences these things as simultaneous, in truth, the processor quickly switches back and forth between these separate processes. On a multiprocessor or multi-core system, now coming into general use, threading can be achieved via multiprocessing, wherein different threads and processes can run literally simultaneously on different processors or cores.

       Many modern operating systems directly support both time-sliced and multiprocessor threading with a process scheduler. The operating system kernel allows programmers to manipulate threads via the system call interface. Some implementations are called a kernel thread, whereas a lightweight process is a specific type of kernel thread that shares the same state and information.

       Absent that, programs can still implement threading by using timers, signals, or other methods to interrupt their own execution and hence perform a sort of ad hoc time-slicing. These are sometimes called user-space threads.