Skip to main content
Multithreading exploits the fact that most of the time the tasks (parts) of the same program are either waiting for the other resources to become free, or waiting for some timeout to occur. In the above example (spreadsheet), scroll operation is waiting for the calculation to be completed. If these parts or tasks can be described as independent threads, they can run individually and they don’t have to wait for the other threads to be completed. One can automatically switch from one task that is ready to wait to another task that is ready. In multithreading, two different tasks – performs calculations and scrolling, form two different threads. When the first thread performs calculation, the second thread can make the window scroll down. This would give the notion of both the operation being performed simultaneously to the user and improves the effectiveness of the application.

Multithreading can be done in a single-processor or multiple processor environments. In a multiple processor environment, different threads can run on different processors.

In a single-processor system, however the things happen in a different way. In such a system, multiple threads share the CPU time. The operating system is responsible for scheduling and allocating resources to threads. This arrangement is very practical as a thread does not always need the CPU time. It might have to wait for user input or it might have to display something on the screen. During that time, the other thread takes over the CPU. The previous thread can then resume after the current thread has either utilized all CPU time or the thread has ended.


Post a Comment

Popular posts from this blog

C# Interviews Questions

Amatya  Feel free to share information Email WhatsUp 09731764134
1. What is C#? C# is an object oriented, type safe and managed language that is compiled by .Net framework to generate Microsoft Intermediate Language. 2. What are the types of comment in C# with examples? i)Single line
 // Single Line
ii. Multiple line (/* */)
/* Amatya
iii. XML Comments (///).Eg:/// XMLComments 3. Can multiple catch blocks be executed? No, Multiple catch blocks can’t be executed. Once the proper catch code executed, the control is transferred to the finally block and then the code that follows the finally block gets executed. 4. What is the difference between public, static and void? Public declared variables or methods are accessible anywhere in the application. Static declared variables or methods are globally accessible without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execu…

ASP .Net Basic Concept

Feel Free to share the Information Email: WhatsUp: 09731764134
Any one who want to develop a web application must have the following systems:

1. A web server.
2. An editor to develop the web pages.
3. A browser to view the web page you develop.
4. A database program like MS Access, SQL Server etc, if your web site need to save data into a database.

In the real world situation, a web server will be hosted on a secure server, located in a safe place and will be always connected to high speed internet. However, to develop a web application, you don't need to worry about security and internet connectivity. You can use your own development computer as the 'Web Server'. Web Server:-
There are several types of web servers. But if you like to develop ASP.NET web applications, you need a specific web server called 'Internet Information Server' (IIS).

IIS comes as part of Windows. But it is not installed by default, when you install Windows. Editor to d…
Importing Classes and Packages The first two lines of the following listing import two classes used in the applet: Applet and Graphics. import java.applet.Applet; import java.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello world!", 50, 25); } } If you removed the first two lines, the applet could still compile and run, but only if you changed the rest of the code like this:
public class HelloWorld extends java.applet.Applet { public void paint(java.awt.Graphics g) { g.drawString("Hello world!", 50, 25); } } As you can see, importing the Applet and Graphics classes lets the program refer to them later without any prefixes. The java.applet. and java.awt. prefixes tell the compiler which packages it should search for the Applet and Graphics classes. Both the java.applet and java.awt packages are part of the core Java API -- API that every Java program can count on being …