How Multi-threading is important in JAVA
By santhosh8611
What is Multitasking?
Running more than one task concurrently is called multitasking. All the tasks will be executed by CPU. Even though it looks more than one task at a time, but practically its not possible. CPU can execute only one task at a time.
As a user of computer we can observe multiple programs running on computer which is happening because of Operating System CPU Scheduling Algorithm.
Some of the famous Algorithm's implemented successfully is
1. First Come First Serve.
2. Round Robin.
3. Shortest Job First.
4. Priority Based.
5. Non - preemptive.
The task of all these algorithm is switching the CPU from one task to other task. I can also put in this way that is allocating the CPU time for all the tasks which have been started.
What are the two types of multitasking
Two types are
1. Process Based.
2. Thread Based.
Process is nothing but a program. Process based is nothing but running multiple programs concurrently. Every program will have its own memory space. Communication between programs , data sharing are too expensive in process based multitasking.
Thread Based is very interesting. Thread is nothing but a part of program. In other words running different parts of same program concurrently.
All threads will share the same memory space. Memory will not be allocated separately for each threads. Data sharing, context switching, communication between programs is inexpensive compared to process based multitasking.
Process Based Multitasking Diagram
Thread Based Multitasking Diagram
Thread based multitasking in java
Multi-threading
|
|
Java Programming with Oracle JDBC, Donald Bales, Excellent Book
Current Bid: $5.74
|
|
|
java script bible 3rd edition computer programming book
Current Bid: $5.00
|
|
|
Java Foundation Classes in A Nutshell, David Flanagan, Very Good Book
Current Bid: $5.74
|
Comments
nice post...
santosh,can you tell me how to publish a hub?
this is my facebook profile link....http://www.facebook.com/avid.netsolution
please tell me, how to publish a hub? Bcaz after some days,my hubs got unpublished.
dude if your hubs are not published, those unpublished hubs you have to delete ir first. click on start a new hub and follow the steps..its simple..as i see ur profile has been banned from hubpages..so u cant use the same account to publish hubs...create a new one and please writing a hub is not so easy as u think...think and publish a hub..read terms and conditions..
sure// will publish a hub with complete details of it...
ok sure..will check and will let u know
rajkishor09 3 months ago
good article but i think you should elaborate process based and thread based multitasking little bit.