6

Possible Duplicate:
Green Threads vs Non Green Threads

Why are Java threads implemented at the user level in the JVM called "green threads"? Is it by analogy to environmentalism, meaning to suggest that they are less wasteful than OS threads, or something else?

EDIT: Some references to where the term is used:

Community
  • 1
  • 1
Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
  • 4
    @BrianRoach- I think the OP's question is why they're called "green," not what they are. – templatetypedef Feb 13 '12 at 20:54
  • Correct. I am asking *why* they are called green threads, not what they are. (See subject and first sentence.) If you let me know what about my phrasing was unclear, I'd be happy to edit my question, or one of you can yourself. – Ellen Spertus Feb 13 '12 at 20:57
  • 2
    @espertus- If this question does get closed, please let me know and I'll vote to reopen it. I think that people are misinterpreting what you're asking and thinking that this is a duplicate question. – templatetypedef Feb 13 '12 at 21:07
  • source for being called "green"? since i have not heard that (i.e. they are NOT called). if you mean why back in the day solaris threads were called green - cause the OS didn't support 'em and they were implemented in a cheaper (less resource consuming than process) way - hence green. But nomenclature has not been used for like 13 years now. – bestsss Feb 14 '12 at 20:04
  • @templatetypedef, who calls them "green"? – bestsss Feb 14 '12 at 20:07
  • @bestss- I'm not sure, actually! But I think that's beside the point, since if it's a term used in some communities or even historically then I'm interested to learn more. – templatetypedef Feb 14 '12 at 20:15
  • @templatetypedef, if you have some source, it's possible to track down the origin; i have not heard it since 1999 or so. Sun used to release java w/ 'green threads' and i'd imagine it's a leftover. It's possible to run grep on hotspot from openjdk for any reference in the comments. I know about the displaced object header but the green threads seems obsolete (to me) – bestsss Feb 14 '12 at 20:22

3 Answers3

8

About green threads

This is just a name of the project (library) that was using this approach many years before

Anton
  • 5,831
  • 3
  • 35
  • 45
4

Green has many possible meanings, if it is using a generally accepted meaning. For me it made sense to call it "green" to mean

Youthful; vigorous: at the green age of 18.

Not mature or ripe; young: green tomatoes.

Brand-new; fresh.

Lacking sophistication or worldly experience; naive.

http://www.thefreedictionary.com/Green

Community
  • 1
  • 1
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Thanks for taking my question seriously. That hasn't been a problem with my prior SO questions, including ones about naming, but somehow this one rubbed people the wrong way. – Ellen Spertus Feb 13 '12 at 21:07
  • 1
    Sometimes apparently naive questions have interesting answers, which many only occur to you many years later. There are no stupid questions, but I do get annoyed by repetitive ones. – Peter Lawrey Feb 13 '12 at 21:13
  • Thanks, although I don't think this question is naive. I'm a professor preparing a lecture on threads and suspect my students will be curious as to why green threads are called that. I'm lucky enough to have curious students and want to be able to answer their questions. – Ellen Spertus Feb 13 '12 at 21:29
  • I don't think its naive either. But often, off topic questions can appear so. – Peter Lawrey Feb 13 '12 at 22:17
1

A friend provided me with the historical answer: the "green" apparently comes from the Green Team, the original code name of the Java project.

Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101