Explain threads in details?, Operating System

What are threads?

A thread - sometimes called as an implementation context or a lightweight process - is a single sequential flow of control within a program. We use threads to separate tasks. While we run one of the applets it creates a thread that performs the operation. Every thread is a sequential flow of control within the same program (the browser). Every operation runs independently from the others but at the same time.

A thread is alike to the sequential programs described previously. A single thread as well has a beginning and a sequence and an end. At any given point of time during the runtime of the thread there is a single point of execution. Though, a thread itself isn't a program; a thread can't run on its own. Relatively it runs within a program.

A thread is the single sequential flow of control within a program. Threads perform two or more tasks at once. The real excitement surrounding threads isn't about a single sequential thread. Relatively, it is about the use of multiple threads running at the same time and performing different tasks in a single program.

A Web browser is an instance of a multithreaded application. Within a usual browser, you are able to scroll a page while it is downloading an image or an applet, play sound and animation concurrently and print a page in the background while you download a new page or watch three sorting algorithms race to the finish.

Some texts call a thread as a lightweight process. A thread is alike to a real process in that both have a single sequential flow of control. Though, a thread is considered as a lightweight for the reason that it runs within the context of a full-blown program and takes advantage of the resources allocated for that program and the program's environment.

The same as a sequential flow of control, a thread ought to carve out some of its own resources within a running program. For instance, a thread should have its own execution stack and program counter. The code running inside the thread works merely within that context. Some other texts use implementation context as a synonym for thread.


Result of calling the start method on a Thread object:

 

1. The thread goes into the Runnable position and the run method is invoked.

The two ways you are able to provide the implementation for a thread's run method:

 

1. Create a Thread subclass that dominates the run method.

2. Write a class that executes the Runnable interface and the run method

Posted Date: 6/22/2013 7:06:14 AM | Location : United States







Related Discussions:- Explain threads in details?, Assignment Help, Ask Question on Explain threads in details?, Get Answer, Expert's Help, Explain threads in details? Discussions

Write discussion on Explain threads in details?
Your posts are moderated
Related Questions
Regard as a computer system that runs 5000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks take place about twice per month and the operator must

FIFO page replacement This is the easiest page replacement algorithm. Here the 1 st page toward the inside is the 1 st to leave that is the oldest page leaves. To execute th

What is dispatch latency? The time taken by the dispatcher to stop one process and begin another running is known as dispatch latency.

What is paging? Paging is a memory management scheme that authorizes the physical-address space of a process to be noncontiguous. Paging evades the considerable problem of fi

Question 1 Explain single Partition Allocation and Multiple Partition Question 2 What is PCB? What useful information is available in PCB? Question 3 Explain Preemptive and No

This assignment is based on Programming Project 6.40 in Silbershatz. Implement the ProducerXConsumer program according to the instructions for Project 6.40 for both Linux and Win32

Define logical address and physical address. An address formed by the CPU is referred as logical address. An address seen by the memory unit that is the single loaded into the

Mention the various features that characteristics the deadlock condition .  The four circumstances that give rise to deadlock condition are: 1) Mutual exclusion : As a minim

Q. Presume that a scheduling algorithm at the level of short-term CPU scheduling favours those processes that have used the least processor time in the recent past. Why this algori

Q. Explain Message passing among systems? Communications- Message passing among systems requires messages to be turned into packets of information and sent to the network contr