I need help with this 3 questions 1.Explain how a Java program is taken from sou
ID: 3788913 • Letter: I
Question
I need help with this 3 questions
1.Explain how a Java program is taken from source code and run on a machine. How translation, virtual machines and interpretation come into play?
Do the same for an assembly language, C and Python Program.
2.For each of the following choose mainframe or COTS
Ease of maintenance
Backward compatibility
Cost
3.For each of the following choose RISC or CISC
Cost per MIP
Backward compability
Supports many instructions
Supplies more registers
Common in embedded systems
Please help this assignment is due soon
Explanation / Answer
1)
Java :
First of all,java source is not directly converted into executable code to run on machine.They are first compiled into bytecode, which the JVM (Java Virtual Machine) then executes at runtime. Java source code is compiled into bytecode when we use the javac compiler. The bytecode gets saved on the disk with the file extension .class. When the program is to be run, the bytecode is converted, using the just-in-time (JIT) compiler. The result is machine code which is then fed to the memory and is executed.
Java virtual machines are used to compile the byte code and convert into the executable machine code.So that the Java program can run on the machine.
Interpretation : here JVM is used as interpreter in order to run the converted byte code as Java commands so that they get converted into machine code and program will be executed
C program :
C program :
Python:
Very much similar to Java. Byte code will be generated and then python interpreter is used to convert the byte into executable machine code
3)
Cost per MIP - RISC is preffered
Backward Compability - CISC is preferred (sole reason why INTEL didn't move from CISC to RISC)
Supports many instruction - CISC is preferred
Supplies more registers - RISC is preferred
Common in embedded systems - RISC is mostly used ( but with some CISC features )
2)
Ease of maintanence - mainframe
backward compatibilty - COTS
cost- mainframe (less cost )