ISO 9001:2015 Certified Company

Sukrala IT Services Pvt. Ltd.,
SCO 23-24-25, Level 3rd,
SEC 34-A, Chandigarh.
Phone: 99-88-74-1983, 0172-503-1983

Multithreading

  • 0

Multithreading

Multithreading in Java

Multithreading is a process of executing multiple threads concurrently.
It is a combination of Multi + threading, where multi means multiple and thread means sub_process.

So, before understanding thread we should first understand what is process, as thread is a sub process means a part of a process.

Multithreading

Process:

Definition : Exceutable state of a program is known as process.
That means, everything that system (Computer) execute is known as process e.g, playing music, working with software like Microsoft word document, playing game etc are the examples of process.

Each process is a combination of one or more than one thread(s).

e.g; Microsoft office word document : It consists of multiple threads like one thread take the keyboard information for displaying content and simultaneously another thread do check on the content spelling.

So from above content we came to know that multiprocessing and multithreading both are part of multitasking.

Difference between Multiprocessing and MultiThreading :

Multiprocessing Multithreading
Multiple process have their own memory location, as different software has different memory allocation in our. As thread is a subpart of process it shares common memory allocation as that of process.
As process are on different memory location therefore context switching time(time taken by processor to move from one process to another to allocate resources) is more. Where threads has very small context switching time.

Multithreading is mostly mostly used in games,animation.

Thread:

Definition : Thread is a light weighted sub-process.

Threads in java :
There are two ways to implement threads in java:

  • By extending Thread class
  • By implementing Runnable interface

Thread class is a predefined class in java heaving multiple methods to start and execute threads.

Whereas runnable is an Interface heaving run method only.

As java doesn’t support multiple inheritance with classes, it always provide an alternative to perform multiple inheritance with interface (as in case of multithreading it provide Runnable interface).

Example: with Thread class

Class ThreadDemo extends Thread
{
Public void run()
{
System.out.println(“Thread Execution code”);
}
Public static void main(String args[])
{
ThreadDemo a = new ThreadDemo()
a.start();
}
}

Example: with Runnable interface

Class ThreadDemo implements Runnable
{
Public void run()
{
System.out.println(“Thread Execution code”);
}
Public static void main(String args[])
{
ThreadDemo a = new ThreadDemo();
Thread t1 = new Thread(a);
t1.start();
}
}

Working of thread:
Threads complete its process or execution in five steps, known as life cycle of thread.

Java Thread state are as follows:

  1. New
  2. Runnable
  3. Running
  4. Non-Runnable
  5. Terminate

android training in Chandigarh - multithreading

  1. New -> Thread is in new state when we create an instance of thread class.
    e.g ThreadDemo a=new ThreadDemo(); //in case of extending thread;

    Thread t1=new Thread(a); //in case of implementing interface.

  2. Runnable -> Thread is ready to run but waiting for resource allocation.
    i.e when we call start() method in program.
  3. Running -> When resources are allocated to thread..
    when start() method finds run() method // backend task
  4. Non-Runnable/ blocked -> when thread is alive, but due to some reasons not eligible to run.
  5. Terminate -> Either Thread execution is completed or forcefully terminated.

When we want to create animated screens for android application, then we use multithreading concept. Android training in Chandigarh help you to create animated screen while creating android mobile applications.

Facebook Comments


Contact Us

PHP Training in Chandigarh

PHP Training in Chandigarh
Rated PHP training in Chandigarh 5/5 based on 9963 reviews

Facebook Comments

Facebook Comments

Chandigarh’s First Youtube Channel-Video Management Laboratory Setup

Adwords video Certification

SEO courses in chandigarh

Adwords Search Certificate

best seo training institute in Chandigarh

Adwords Shopping Certification

SEO course in chandigarh

Adwords Display Certification

SEO course in chandigarh

Google Analytics Certification

Best SEO training in chandigarh

Bing Ads Certification

digital marketing course in chandigarh

Student Review

CCNA Training in Chandigarh
PHP Training in Chandigarh 5/5 stars
I am really satisfied with CCNA Training in Chandigarh at CBitss Technologies. All credits goes to my professional trainer & CBitss. They trained me well with many practical exercises.

CCNA Training in Chandigarh

CCNA Training in Chandigarh
Rated PHP training in Chandigarh 5/5 based on 9969 reviews

Testimonials

  • web designing company in chandigarh

    Amit Thakur

    CBitss Technologies is a place where I got the right track for my future as i have completed my course from here and now, I am working in a MNC company. All trainers are well experienced and motivate to learn more & new things. I am feeling proud that i am a student of CBitss and also thankful to our mentors.

  • Android course in chandigarh

    Harman Singh

    Miss. Pooja has multiple methods to make learning fun and easier for students. She has always been excited in sharing her creative ideas with us through practical & logical approach. A special attention is given to every individual student so that one could do practical work independently.

    I am proud and thankful, beyond words, for being a part of CBitss Technologies.

  • Mandeep Singh

    The technology experts who have been provided by this training organization have been highly skilled professionals. They have been willing to take on the full role of a real mentor in this organization and have been accountable for standards within an outstanding training environment.

    I am delighted with the level of training & placement services offered by CBitss Technologies.

  • php industrial training in chandigarh

    Kamini

    We were all hugely pleased with JOB placement provided by CBitss Technologies just after completion of our training.Being girls we found homely environment. The feedback here is that it was by far the best expert trainers we've ever seen.
    Along with technical skill on latest technologies, we were also given inspiration and urge to do hard work by virtue of which we could get JOB.

  • Best android training institute in chandigarh

    Khushlender

    I would strongly recommend CBitss Technologies because they have dedicated JOB placement department which groom the candidates for interview preparation and skill development. The way they keep on informing the candidates about new job vacancies and need of job is really a helping tool.

  • SEO training institute in Chandigarh - Bhavna

    Bhawna

    Digital marketing is one of the best and easiest strategyfor marketing. I have done digital marketing course from CBitss Technologies. It is one of best SEO training institute in Chandigarh, which are thoroughly discussed all SEO techniques used to get top Google ranking of our website. All staff at CBitss are very co-operative and give all their attention to students.
    “ I am very happy that I am a part of CBitss Technologies and I have learnt many new things from CBitss.”

  • web designing course in chandigarh sector 34

    Gurpreet Kaur

    CBitss Technologies provide me excellent training in Web Designing. I enjoyed working with all of my instructors. I have learned a lot from Web designing training in Chandigarh during my six month training. Competent instructors, up-to-date material, and an overall outstanding quality of training and facilities provided by CBitss Technologies. A special attention is given to all students, so I think CBitss is a Best place for learning Web designing.
    “ I am thankful for being a part of CBitss Technologies.”

  • php training institute in chandigarh

    Rajneesh Singh

    The staff at CBitss Technologies are always very polite and helpful and have dealt efficiently with our queries or concerns we may have had during entire training.
    They are pro-active in checking if everything is satisfactory and I would highly recommend their services. Today I am working in IT park Chandigarh and whole credit goes to my mentors at CBitss.

  • Redhat linux certification in Chandigarh

    Diwaker joshi

    All staff at CBitss Technologies connect with the candidates at an emotional level and made a lasting impression. Specially, Mr. Navneet Sharma is passionate and persuasive trainer, and his ability to ignite the trainees into action is remarkable,his creative designs and his explanation that makes us to think is marvellous.

error: Content is protected !!