Core java interview questions on Thread



1.What is multithreading?
Multithreading is a process of executing multiple threads simultaneously. Its main advantage is:
Threads share the same address space.
Thread is lightweight.
Cost of communication between process is low.

2.What is thread?
A thread is a lightweight subprocess.It is a separate path of execution.It is called separate path of execution because each thread runs in a separate stack frame.

3.What is the difference b/w preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.

4.What does join() method?
The join() method waits for a thread to die. In other words, it causes the currently running threads to stop executing until the thread it joins with completes its task.

5.What is difference b/w wait() and sleep() method?

6.Is it possible to start a thread twice?
No, there is no possibility to start a thread twice. If we does, it throws an exception.

7.can we call the run() method instead of start()?
yes, but it will not work as a thread rather it will work as a normal object so there will not be context-switching between the threads.

8.What about daemon threads?
The daemon threads are basically the low priority threads that provides the background support to the user threads. It provides services to the user threads.

9.Can we make the user thread as daemon thread if thread is started?
No, if you do so, it will throw IllegalThreadStateException

10.When Should we interrupt a thread?
We should interrupt a thread if we want to break out the sleep or wait state of a thread.

11.What is Garbage Collection?

12.What is gc()?

13.What is the purpose of finalize()method?

14.Can an unreferenced objects be referenced again?

15.What kind of thread is garbage collector thread?

16.What is the difference between final,finally and finalize?

17.What is the purpose of runtime class?

18.How will you invoke external process in java?



Related Post

Comments

JimmyHef
          ! ! : http://kinovalenok.tv/ : 2018 : 2019 : hd 720 2018 : http://kinovalenok.tv/2129-007-koordinaty-skayfoll-skyfall-2012.html 007: / Skyfall (2012) : / Il principe abusivo (2013) / Il principe abusivo (2013)
AngelSon
          ! ! : : 2019 2019 : hd http://inspacefilm.ru/serialy/ 2019 : http://inspacefilm.ru/triller/ 2018 : http://inspacefilm.ru/9577-tancevalnaya-akademiya-dance-academy-sezon-1-3-20102013.html / Dance Academy ( 1-3) (20102013) : " 2" 2017 " 2" 2017
Robertimmom
         Hello, tired of sitting with no money? I was just a poor student, and now i make 900$ - 1000$ every day here: http://9binaryoptions.net/uploads/reviews/make-big-money.htm - how to make money online easy It works! Checked. Good luck to all! This Additional income in the network is available in all countries! These articles will help you: http://9binaryoptions.net/uploads/reviews/supplemental-income.htm Binary options brokers Review http://9binaryoptions.net/brokers.html Start Now!
Tommykit
          ! ! : http://sportmanlife.ru/ : http://sportmanlife.ru/kak-stat-krasivoy/ : Ekstraslim http://sportmanlife.ru/78-ekstraslim.html : http://sportmanlife.ru/40-falloston.html
RoccoScent
         ! ! : : hd 2019 : 2019 2018 2018 : 720 2019 : http://kinoserialtv.net/2253-fors-mazhory-suits-sezon-1-2011.html - / Suits ( 1) (2011) : http://kinoserialtv.net/11916-podvedeny-itogi-igromira-2016-i-comic-con-russia-2016.html
Kevingem
          ! : http://limonos.ru : http://limonos.ru/krasivye_devushki/ http://limonos.ru/706-10-lyubopytnyh-faktov-o-strannostyah-evolyucii-chelovechestva.html 10 http://limonos.ru/5898-sokrushayuschiy-ldy.html
KennethObero
         ??иве?! п?икол?н?й ? ва? ?ай?! ?а?ел ин?е?е?н?? баз? кино: ?е?иал? онлайн в ?о?о?ем ка?е??ве без ?еги???а?ии http://inspacefilm.ru/ ?де??: а?диокниги ?л??а?? бе?пла?но ??н?ези л???ие http://inspacefilm.ru/fentezi/ ?ей?инг 2018 ?де??: ?мо??е?? онлайн л???ие ????кие д?ам? Смо??е?? онлайн л???ие д?ам? ?пи?ок 2018 Т??: ?мо??е?? док?мен?ал?н?е ?ил?м? ?о?о?его ка?е??ва ?мо??е?? л???ие док?мен?ал?н?е ?ил?м? ?пи?ок 2018 ?де??: http://inspacefilm.ru/8247-sumerechnaya-deva-i-amneziya-tasogare-otome-x-amnesia-sezon-1-2012.html Смо??е?? С?ме?е?на? ?ева и ?мнези? / Tasogare Otome X Amnesia (Сезон 1) (2012) онлайн бе?пла?но Т??: ?ело?и ?изни / Nichijou (2011) онлайн Смо??е?? ?ело?и ?изни / Nichijou (2011) онлайн бе?пла?но Т??: http://inspacefilm.ru/14103-fanat-potrebovavshiy-peredelat-poslednih-dzhedaev-otkazalsya-ot-peticii.html
taxiunlasse
         Се?ви? Яндек? ?ак?и-??о возможно??? ?дела?? заказ ав?омобил? к?да и когда ?годно. Сдела?? заказ ав?о в? може?е ??ем? ?по?обами: ?е?ез ?пе?иал?ное мобил?ное п?иложение, зака?ав его, на ?ай?е, по ?еле?он? ?ндек? ?ак?и. Т?еб?е??? ?каза?? в?ем? когда необ?одима ав?омобил?, ?об??венн?й ?еле?онн?й номе?, ме??оположение. ?ожно заказа?? ?ак?и ? де??ким к?е?лом дл? пе?евозки де?ок, ве?е?ом по?ле в???е? л???е п?ибегн??? к Я. ?ак?и, ?ем ?е??? в ??ан?по?? не??езв?м, в а??опо?? или на вокзал ?покойнее во?пол?зова???? Яндек? ?ак?и нен?жно д?ма?? где о??ави?? ?во? ав?ома?ин?. ?пла?а п?оизводи??? безнали?н?м или нали?н?м пе?еводом. ??ем? под?езда Яндек? ?ак?и ?о??авл?е? о? 5 до 5 мин?? в ??еднем. ??еим??е??ва ?або?? в на?ем Я. ?ак?и: ?омен?ал?на? ?еги???а?и? в п?иложение, ?езна?и?ел?на? коми??и?, ?пла?а мгновенна?, ?о??о?нн?й по?ок заказов, ?пе?а?о? к??гло???о?но на ?в?зи. ?л? в?полнени? ?або? в ?ак?и владел??? ав?омобил? ?лед?е? за?еги???и?ова???? ?амом? и ма?ин?, ??о в ?елом займ?? 5 мин. ??о?ен? аг?ега?о?а ?о??ави? не ?в??е 20 % о?до?ода. ?? ?може?е пол??и?? за?пла?? когда вам ?добно. У ва? по??о?нно об?за?ел?но б?д?? за?вки. ? ?л??ае п?облем возможно ?в?за???? ? к??гло???о?но ?або?а??ей ?л?жбой ?оп?овождени?. Yandex ?ак?и да?? возможно??? г?ажданам б????о доб?а???? до ме??а назна?ени?. ?аказ?ва? данное Yandex ?ак?и в? пол??ае?е пе?вокла??н?й ?е?ви? в го?оде. ?ндек? ?ак?и ?ама?а ?або?а?? : подкл??ение к ?ндек? ?ак?и ?ама?а
Richardcop
         де??кий ?по??ивн?й комплек? к?пи?? в мо?кве к?пи?? де??кий ?по??ивн?й комплек? в мо?кве http://www.mother.ru/phorum5/read/8/488528/501155.html#msg-501155 http://forumok.org/topic5860-3.html#post127308 http://mskaforum.ru/showthread.php?t=66099 http://partnerusa.net/post64653.html#p64653 https://salda.ws/f/topic.php?p=6353#post_6353 де??кий ?по??ивн?й комплек? ?ал?н го?ка де??ка? пла??икова? к?пи?? http://forumok.org/topic5860-3.html#post127308 http://partnerusa.net/post64653.html#p64653 http://www.mother.ru/phorum5/read/8/488528/501155.html#msg-501155 http://forum.ssa.ru/cat-dizayn-proektyi/topic-1646-page-2.html#post44228 ?по??ивн?е комплек?? дл? да?и ? го?кой ???ник на заказ де??кие гимна??и?е?кие ??енки ?ли?н?е де??кие иг?ов?е пло?адки де??ка? ?по??ивна? пло?адка ?воими ??ками http://marimama.ru/forum/17-11146-1#639272 https://salda.ws/f/topic.php?p=6353#post_6353 http://virtuozi.com/showthread.php?t=33909 http://thedacha.ru/showthread.php/1861-%D0%BA%D0%B0%D1%87%D0%B5%D0%BB%D0%B8-%D0%B4%D0%BB%D1%8F-%D0%B4%D0%B0%D1%87%D0%B8 http://www.mother.ru/phorum5/read/8/488528/501155.html#msg-501155 пе?екладина дл? ?вед?кой ??енки де??кие го?ки дл? дома ?о?о ?вед?ка? ??енка ме?алли?е?ка? ба??ейн ? го?кой де??кий де??кий ?по??ивн?й комплек? дл? мал??ей http://virtuozi.com/showthread.php?t=33909 http://forumok.org/topic5860-3.html#post127308 http://marimama.ru/forum/17-11146-1#639272 http://naydem-vam.ru/viewtopic.php?id=16917#p29127 пе?о?ни?? дл? де?ей http://www.mother.ru/phorum5/read/8/488528/501155.html#msg-501155 http://forumok.org/topic5860-3.html#post127308 http://thedacha.ru/showthread.php/1861-%D0%BA%D0%B0%D1%87%D0%B5%D0%BB%D0%B8-%D0%B4%D0%BB%D1%8F-%D0%B4%D0%B0%D1%87%D0%B8 ?по??ивна? пло?адка http://thedacha.ru/showthread.php/1861-%D0%BA%D0%B0%D1%87%D0%B5%D0%BB%D0%B8-%D0%B4%D0%BB%D1%8F-%D0%B4%D0%B0%D1%87%D0%B8 http://mskaforum.ru/showthread.php?t=66099 http://marimama.ru/forum/17-11146-1#639272 де??кие иг?ов?е комплек?? дл? поме?ений ?ли?н?е де??кие ка?ели дл? да?и https://salda.ws/f/topic.php?p=6353#post_6353 http://virtuozi.com/showthread.php?t=33909 http://partnerusa.net/post64653.html#p64653 http://marimama.ru/forum/17-11146-1#639272 гимна??и?е?кий ???ник к?пи?? ?по??ивн?е комплек?? дл? дома http://mskaforum.ru/showthread.php?t=66099 http://forum.ssa.ru/cat-dizayn-proektyi/topic-1646-page-2.html#post44228 https://salda.ws/f/topic.php?p=6353#post_6353 http://marimama.ru/forum/17-11146-1#639272 ган?ели к?пи?? ?по??ивн?й ?голок дл? мал??ей в ква??и?? к?пи?? http://marimama.ru/forum/17-11146-1#639272 ?адов?е ка?ели к?пи?? гимна??и?е?ка? ??енка http://thedacha.ru/showthread.php/1861-%D0%BA%D0%B0%D1%87%D0%B5%D0%BB%D0%B8-%D0%B4%D0%BB%D1%8F-%D0%B4%D0%B0%D1%87%D0%B8 http://forumok.org/topic5860-3.html#post127308
unlasse
         Sorry for making you review this message which is probably to be taken into consideration by you as spam. Yes, spamming is a poor thing. On the various other hand, the most effective method to discover something brand-new, heretofore unidentified, is to take your mind off your everyday troubles as well as show rate of interest in a subject that you might have considered as spam prior to. Right? [url=https://kingswayjewelry.com/]black engagement ring[/url] We are a team of young men who have chosen to begin our very own service and also make some cash like many other individuals on Earth. What do we do? We offer our visitors a large selection of remarkable hand-crafted rings. All the rings are made by the ideal artisans from throughout the United States. Have you ever seen or worn a green opal ring, timber ring, fire opal ring, Damascus ring, silver opal ring, Turquoise ring, blue opal ring, pink ring, meteorite ring, black ring or silver ring? This is just a small component of what you can constantly discover in our shop. Made in the UNITED STATES, our handmade rings are not just lovely and original gifts for, state, a wedding or birthday celebration, but additionally your talisman, a point that will definitely bring you good luck in life. As settlement for your time invested in reviewing this message, we give you a 5% price cut on any thing you have an interest in. We are looking forward to meeting you in our store!
houzz optimization
         With Houzz controling the search engine outcomes of your crucial keyword, it is vital that when web traffic probably to Houzz that you will show on top of their directory. We can assist - Houzz smo Manhattan : [url=https://houzzilla.com]houzz support[/url] Right Below at HouZzilla we have a designated team of marketer that particularly service Houzz management as well as optimization. We are all "Qualified Houzz Advertising And Marketing Professionals"- a Houzz advertising and marketing training program with a certification test. As experts in Houzz account administration along with optimization, Client HouZzilla frequently obtains clients leading natural Houzz positionings including in Round Rock, along with in unrestricted towns across the country.

©candidjava.com