Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


phani
Green Thread
1 Answer(s)      6 years and 6 months ago
Posted in : Java Beginners



Advertisement
View Answers

May 19, 2008 at 1:50 PM


Hi friend

Green threads are simulated threads within the VM and were used prior to going to a native OS threading model in 1.2 and beyond. Green threads may have had an advantage on Linux at one point (since you don't have to spawn a process for each native thread), but VM technology has advanced significantly since version 1.1 and any benefit green threads had in the past is erased by the performance increases over the years.

This is simple program of thread

public class ThreadExample extends Thread {
public ThreadExample(String str) {
super(str);
}
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i + " " + getName());
try {
sleep((int)(Math.random() * 1000));
} catch(InterruptedException e){
System.out.println(e);
}
}
System.out.println("Complete! " + getName());
}
public static void main (String[] args) {
new ThreadExample("Roseindia").start();
new ThreadExample("javajazzup").start();
new ThreadExample("newstrackindia").start();
System.out.println("Welcome to Roseindia");
}
}

----------------------------
Read for more information

http://www.roseindia.net/java/


Related Tutorials/Questions & Answers:
Green Thread - Java Beginners
Green Thread  Hello, Can any one say the definition and use of Green Thread in java. Thanks in advance...  Hi friend Green threads... threading model in 1.2 and beyond. Green threads may have had an advantage
thread
thread  can parent thread be dead if child thread is not dead
Advertisements
Thread
Thread  Thread Life Cycle
Thread
Thread  what is the use of thread
Green UML
Green UML       green is a LIVE round-tripping editor, meaning that it supports both software engineering and reverse engineering. You can use green to create a UML
Thread
Thread  Explain two ways of creating thread in java. Explain at three methods of thread class.   Java Create Thread There are two main ways of creating a thread. The first is to extend the Thread class and the second
Thread
Thread  What is multi-threading? Explain different states of a thread... processor system. States of Thread: New state ? After the creations of Thread instance the thread is in this state but before the start() method invocation
Thread
to the thread constructor eventhough we had created only one thread and if you say we have added to point to the current thread then why we have not added this in the following line "s=s1" Pls reply...... class MyThread extends Thread { Thread
Thread
Thread  class Extender extends Thread { Extender(Runnable run...(); } public void run(){ System.out.println("Extender Thread is Started :"); //new Thread(new Implementer()).start(); } } class Implementer
Thread
Thread  what happen when we call the Wait(),Notify() and NotifyAll() methods in the Thread
Thread
Thread  will this code work..? class A extends Thread { public...=" + i); } public static void main(string args[]) { A a = new A(); Thread t = new thread(a); t.start(); } } Is it possible to run above program with out
Green Laser
Green Laser       Green laser is a gas laser using mercury and argon it generates a green beam..., astronomy, and in sea, while green laser is especially used in astronomy
Thread
Thread  Write a Java program to create three theads. Each thread should produce the sum of 1 to 10, 11 to 20 and 21to 30 respectively. Main thread....   Java Thread Example class ThreadExample{ static int
Thread
Thread   there are two threads running at a time.. when am updating a values in database. both thread halt and stop for moment till it get updated into database... so i dnt want thread to get halts for tht moment of period. whats
How to write a stylish green text, write a stylish green text, stylish green text
How to write a stylish green text       If you want to write a stylish green text, come to this example. Some steps are mention here that will help you to write similar easily. New
This is 18 set of different shades of Lime Green
:5px 0px 5px 5px; } This is 18 set of different shades of Lime Green covers light Lime Green to darker Lime Green. Name/String Code
This is the 26 color set of Green ranging from light to darker.
:5px 0px 5px 5px; } This is the 26 color set of Green ranging from light... Green 1 #00FF00 Green 2 #004626 Green 3 #1E4D2B Green 4 #00FF6F Green 5 #00693E
Thread in java
Thread in java  which method will defined in thread class
Thread restart
Thread restart  hello,, can dead thread restart?   hii, A dead Thread can't restart not even by calling start() again on that object
java Thread
java Thread  what is purpose of Thread
Daemon thread
Daemon thread  what is need of daemon thread
Daemon thread
Daemon thread  what is need of daemon thread
This is the 18 color set of Spring Green ranging from light to darker.
:5px 0px 5px 5px; } This is the 18 color set of Spring Green ranging from light
Java thread
Java thread  How can a dead thread be restarted?  A dead thread cannot be restarted
Java thread
Java thread  What are the high-level thread states
Java thread
Java thread  What are the ways in which you can instantiate a thread
Java thread
Java thread  What invokes a thread's run() method
Thread method
Thread method  What is the purpose of the wait(), notify(), and notifyAll() methods
Java thread
Java thread  What is the difference between process and thread
Java thread
Java thread  What's the difference between a thread's start() and run() methods
Demon thread
Demon thread  What is demon thread? why we need Demon thread?  ... there are daemon thread by killing them abruptly.Any thread can be a daemon thread.../thread/daemon-threads.shtml
Advertisements
 

 

 

DMCA.com