Explain threads in details?, Operating System

Assignment Help:

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


Related Discussions:- Explain threads in details?

Explain first fit algorithm, FIRST FIT ALGORITHM Scanning a list along...

FIRST FIT ALGORITHM Scanning a list along with if a free hole is available with necessary space for the process to allocate it allocates the process in that space. The first s

Explain structure, Explain Structure The Grammar for programming langua...

Explain Structure The Grammar for programming language is a formal description of Structure

Beladys anomaly algorithm, Q.  You have devised a fresh page-replacement a...

Q.  You have devised a fresh page-replacement algorithm that you think may be optimal. In a few contorted test cases Belady's anomaly occurs. Is the fresh algorithm optimal? Descr

Determine the scheduling technique, The scheduling technique in which CPU i...

The scheduling technique in which CPU is allocated to the process with least CPU-burst time is known as  Shortest job first Scheduling is a scheduling technique in which CPU i

Operating system.., What is the use of FIFOs in client-server applications

What is the use of FIFOs in client-server applications

Designing issues in a network-scalability, Scalability Scalability is t...

Scalability Scalability is the ability of the system to adapt to increased service load. A scalable system will respond more gracefully to increased load than a non scalable on

Describe why it could and how such effects could be minimize, Q. In followi...

Q. In following Section we mentioned that disabling interrupts frequently could affect the system's clock. Describe why it could and how such effects could be minimized.

Explain the proper distribution of functionality and code, Explain the Prop...

Explain the Proper Distribution of Functionality and Code It is important to note that the bandwidth of the server operating system and server processor availability is fixed.

Why system calls have to be implementing by a interpreter, Q. What system c...

Q. What system calls have to be implementing by a command interpreter or shell in order to start a new process? Answer: In the UNIX systems a fork system call followed by an ex

Plot a function for value of heights, The performance of a file system depe...

The performance of a file system depends upon the cache hit rate (fraction of blocks found in the cache). If it takes 1 msec to satisfy a request from the cache, but 40 msec to sat

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd