homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Techno-Talking   » Math-a-holics and Code Junkies   » How does java work?

 - UBBFriend: Email this page to someone!    
Author Topic: How does java work?
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted April 08, 2005 15:02      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
Alright, don't flame me for ignorance, or the soul of your firstborn child will be mine.
I'm a pretty good programmer when it comes to java, and I was just wondering how it was implemented internally. The most efficient algorithm I can think of for managing objects goes something like this:
1.)load all classes; make a list of them all, their parent classes, their children, and give each class a unique I.D. number. a class contains a list of all possible member variables and methods, as well as the code body for the methods.
2.)create all objects, with a class-id number referring to whatever class they belong to. an object is the values for all member variables of a class.
3.)create a reference list- this is important in garbage collection; when an object is no longer referred to, it can be removed and its memory made free to the system.

anyways, any general code-level explanation of how the JVM works would be really helpful

--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
Cap'n Vic

Member # 1477

Icon 1 posted April 08, 2005 15:16      Profile for Cap'n Vic     Send New Private Message       Edit/Delete Post   Reply With Quote 
Tuck your shirt in.

--------------------
(!) (T) = 8-D

Posts: 5471 | From: One of the drones from sector 7G | Registered: Jun 2002  |  IP: Logged
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted April 08, 2005 15:26      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
Wow i totally don't get that

--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
californiarockr
Assimilated
Member # 1986

Member Rated:
3
Icon 1 posted April 08, 2005 16:19      Profile for californiarockr     Send New Private Message       Edit/Delete Post   Reply With Quote 
sorry, youre not even close on this one...

javac creates a bytecode, think of it like any regular non java program for your OS, but different in the fact that its for Java (in fact, solaris systems use java bytecode as their native code). Then the JVM loads this into memory, translates part of it into native bytecode for whatever system its on, and runs.

--------------------
lol

Posts: 361 | From: guess... :/ | Registered: Feb 2003  |  IP: Logged
nerdwithnofriends
Uber Geek
Member # 3773

Icon 1 posted April 08, 2005 16:52      Profile for nerdwithnofriends     Send New Private Message       Edit/Delete Post   Reply With Quote 
okay, thanks (I had gathered that much from other java documentation, but i thought that JVM code was interpreted, not translated at runtime). But I was wondering how it manages the objects and classes and stuff... there still has to be some kind of master table or whatever to manage the relationships between everything, else things like the instanceof operator and garbage collection would not work, right?

--------------------
"The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower." - Robert M. Pirsig

Posts: 948 | Registered: Mar 2005  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted April 09, 2005 14:06      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by californiarockr:
sorry, youre not even close on this one...

javac creates a bytecode, think of it like any regular non java program for your OS, but different in the fact that its for Java
(in fact, solaris systems use java bytecode as their native code). Then the JVM loads this into memory, translates part of it into native bytecode for whatever system its on, and runs.

(emphasis added)
calrockr...I don't believe that's 100% correct. Solaris is a *nix operating system - I tend to doubt that compiled C code on Solaris is binary compatible with Java bytecode. Otherwise, I think you summed it up - Java code is compiled to JVM bytecode, and the JVM (a native application) executes the bytecode. This last part is why Java code will never come up to the speed of C - though using this might get you /lot/ closer.

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9332 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
Orpheus
Highlie
Member # 2397

Member Rated:
3
Icon 1 posted April 09, 2005 21:58      Profile for Orpheus     Send New Private Message       Edit/Delete Post   Reply With Quote 
There are some native java processors though that use java bytecode as their native machine language. Though I think most of them are embedded devices or just specialty processors.

I imagine the JVM probably does all those things you mentioned and more tracking signals, setting up buffers, etc.

--------------------
my cats make me crazy

Posts: 554 | From: Galveston, TX | Registered: Oct 2003  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam