CS 207
Final Exam
Ondich
Due 5:00 PM Monday, November 22, 1999
For this exam, you may not consult with people other than
Jeff Ondich. Otherwise, you may use any sources of
information, including books and the Internet.
The first question in the Java section below will be worth
15 points. Each of the rest of the numbered questions will
be worth 5 points.
Most of the questions on this exam can be answered correctly
in very few sentences. Brevity and clarity are desirable, so
feel free pursue them both.
Have fun.
I: The Java Virtual Machine
As you are probably aware,
Java is a programming language devised by researchers at
Sun Microsystems. Java was originally designed
to facilitate programming for networkable consumer devices (cell
phones, global positioning devices, toys, remotely accessible
microwave ovens,...).
Some of the features that made Java appropriate for
for programming for these kinds of embedded systems--security,
good exception handling, automatic garbage collection
(that is, the prevention of
memory leaks due to allocation of memory that is never later freed),
etc.--have also made it appropriate for transmitting programs
over the Web. That's why Java became famous overnight,
and why its independent existence as a general-purpose programming
language has been hard to see through all the hype about fancy
Web pages.
One of the most interesting features of Java is the means by
which its designers intended it to be translated into machine
language. Part of the specification of Java is the specification
of the Java Virtual Machine. The JVM has a relatively
simple instruction
set that has many features in common with most assembly languages,
including the MIPS and PDP8/E assembly
languages. The JVM instructions are called bytecodes, for
reasons that you will discover.
When you compile a Java program, you don't compile it directly into
the machine language of a particular processor. Instead, you compile
it into the JVM instruction set. The resulting bytecode "executable"
doesn't run on any real machines directly. But since the bytecodes
are like instructions found in most machine languages, the translation
from JVM bytecodes to any particular machine language is relatively simple.
When Java programs (applets) are shipped from Web server to Web browser,
they are sent as bytecodes, which the browser translates (or gets
translated by a separate program, usually called a JVM implementation,
or just a JVM) to the machine
language of the real machine on which the browser is running.
This intermediate interpretation step allows the the downloader's
browser/JVM/OS combo to enforce security, among other things.
The following questions concern the Java Virtual Machine. You can
find the complete JVM specification at
http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html
If this document moves before 11/22/99, please let me know. I've
downloaded a complete copy just in case.
- Discuss the costs and benefits of using bytecodes
as an intermediate step between Java and machine languages.
What parts of the computing system (considered broadly to include
the various levels of hardware and software, as well as the users,
hardware designers, compiler writers, applications programmers, etc.)
pay the costs, and what parts reap the benefits?
One page of discussion will be sufficient for
the purposes of this exam (though this question has
undoubtly occupied thousands of hours at Sun and elsewhere).
You might find it interesting in this context to know that one
of the earliest implementations of Pascal--UCSD Pascal--used a
scheme almost identical to Java's. Its intermediate language
was called "p-code," which survived for a while until Turbo Pascal
came along (this is an over-simplification of the events, but
it is true that Borland, in a sense, exploited a weakness
in the p-code idea). Turbo did not use p-code.
- Briefly describe the JVM instruction format.
- Both MIPS and JVM have instructions whose main purpose is to
support function-calling. Which instructions are they?
- What is a JVM frame? How is it different from
the stack frames you saw g++ generating?
- Which features of IEEE 754 are not used by JVM?
- Which JVM opcodes are "reserved?" What does it mean for
an opcode to be reserved? What are these opcodes reserved for?
- Above, I said "the resulting bytecode 'executable' doesn't
run on any real machines directly," and when I wrote that
sentence for my Fall 1996 CS207 final exam, it was true. Is
it still true?
II: Overclocking
There's an interesting Web site called Tom's Hardware Guide,
where Tom provides spectacularly detailed information about computer
hardware. One of Tom's favorite topics is "overclocking," which
you can learn about at
http://www.tomshardware.com/overclock.html and
http://www.tomshardware.com/overclocknews.html.
- In terms of performance as measure in Patterson and Hennessy,
pages 62-63, how does overclocking improve performance? If viewed
through the lens of Amdahl's law, is overclocking a productive
way to improve performance, or not?
- According to Tom, there's one big danger in overclocking your
computer. What is it? How does he recommend you deal with that danger?
- Evidently, many people believe overclocking to be unethical.
Based on Tom's rebuttal, briefly reconstruct their arguments.
Do you agree with Tom, his critics, or neither?
- What has Intel done to prevent overclocking? Under what conditions
does Tom say that Intel has chosen not to prevent overclocking, and why?
- To what does Tom attribute most reports of "unoverclockable" AMD K6 chips?
III: Unicode
You know ASCII pretty well. Now it's time to get familiar with Unicode.
Take a look at http://www.unicode.org.
- Briefly, what is Unicode?
- What organization or organization is responsible for the creation
and maintenance of the Unicode standard?
- List two languages that you have never heard of that are
supported by Unicode. Where and by whom are these languages spoken?
- What is the difference between a glyph and a
character? Which one does Unicode specify?
- In what sense is Unicode compatible with ASCII?
- If you wanted to get a new character or script added to Unicode
(ancient Egyptian, say, or maybe Klingon...), how would you need
to proceed?
IV. That's all, folks
Thanks for a great term. Have a relaxing break.