•Most computers can only execute oneprogram instruction at a time, butbecause they operate so fast, theyappear to run many programs andserve many users simultaneously.•The computer operating system giveseach program a "turn" atrunning, then requires it to wait whileanother program gets a turn. Each ofthese programs is viewed by theoperating system as a task for whichcertain resources are identified andkept track of.
The operating system manages eachapplication program in your PC system(spreadsheet, word processor, Webbrowser) as a separate task.If the program initiates an I/Orequest, such as reading a file or writingto a printer, it creates a thread.
In a two state process model from timeto time the currently running processwill be interrupted and the dispatcherportion of the OS will select some otherprocess to run.The unit of dispatching is usuallyreferred to as a thread or lightweightprocess.
Multithreading refers to the ability of anOS to support multiple, concurrent paths ofexecution within a single process.
SINGLE THREADED APPROACHES•MS-DOS supports a single user processand a single thread.•Some UNIX, support multiple userprocesses but only support one threadper process.
MULTITHREADED APPROACHES•Java run-time environment is a single processwith multiple threads•Multiple processes and threads are found inWindows, Solaris, and many modern versions ofUNIX
SINGLE THREADED ANDMULTITHREADED PROCESS MODELS
BENEFITS OF THREADS• It takes far less time to create a new thread than to create a brand-new process.• It takes less time to terminate a thread than a process• It takes less time to switch between two threads within the same process than to switch between processes.• Threads enhances efficiency in communication between different executing programs.