• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Default Thread

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how many default threads in java..


in oracle docs mention that only one thread i.e main thread..

but in jvm specification mention that two default threads..i.e daemon and non-daemon...

and how we proved that default thread is created before main()...
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You sure you're reading that right? There are two types of thread: daemon and non-daemon.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daemon and non-daemon are types of threads, not actual instances of threads. Normally the JVM will exit when all non-daemon threads have stopped. Daemon threads automatically get stopped when the JVM exists.

How many threads there are in an "empty" JVM is implementation-dependent. There is one thread that runs the main() method, and there might be one or more other threads for example for garbage collection or other background tasks.

Java code always runs in a thread. So the thread that runs the main() method must be created before the main() method runs, otherwise there would be no way to run the method.
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
then if anyone ask that how many default threads created by jvm then what will i given..
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:You sure you're reading that right? There are two types of thread: daemon and non-daemon.




ya i am sure....
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritesh raushan wrote: ya i am sure....


Can you give us a reference?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritesh raushan wrote:then if anyone ask that how many default threads created by jvm then what will i given..



That it is implementation dependent, there will be a minimum of one, but usually more.
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for Mathew......webpage
 
Sheriff
Posts: 27527
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a broken link -- would you like to try again?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritesh raushan wrote:for Mathew......webpage


I don't see anything about daemon and non-daemon threads in http://docs.oracle.com/javase/tutorial/essential/concurrency/procthread.html

Or was that some other page you were trying to link to?
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote:

Ritesh raushan wrote:for Mathew......webpage


I don't see anything about daemon and non-daemon threads in http://docs.oracle.com/javase/tutorial/essential/concurrency/procthread.html

Or was that some other page you were trying to link to?

....

i know there is no daemon and non-daemon thread you should be read jvm specification where declared......
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritesh raushan wrote:

Darryl Burke wrote:

Ritesh raushan wrote:for Mathew......webpage


I don't see anything about daemon and non-daemon threads in http://docs.oracle.com/javase/tutorial/essential/concurrency/procthread.html

Or was that some other page you were trying to link to?

....

i know there is no daemon and non-daemon thread you should be read jvm specification where declared......



You said: "in jvm specification mention that two default threads"

However, you have not provided a link to where it says that in the JVM spec. The link you provided (http://docs.oracle.com/javase/tutorial/essential/.../procthread.html) is not valid, and even if you filled in the "..." part, would not point to the JVM spec.

If you're making a claim that the JVM spec says something, then you need to provide a valid link to the part of the JVM spec that supports your claim.
 
reply
    Bookmark Topic Watch Topic
  • New Topic