Flag This Hub

How Multi-threading is important in JAVA

By


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

Process Based
See all 2 photos
Process Based
Source: Process Based

Thread Based Multitasking Diagram

Thread Based
Thread Based
Source: Thread Based Multitasking

Thread based multitasking in java

Comments

rajkishor09 3 months ago

good article but i think you should elaborate process based and thread based multitasking little bit.

newarrival4u 3 months ago

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.

santhosh8611 3 months ago

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..

santhosh8611 3 months ago

sure// will publish a hub with complete details of it...

santhosh8611 3 months ago

ok sure..will check and will let u know

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working