11/9/04
This one may be best left for after the exam,
also. The first question is clearly bothering many of you, based on the
questions about .EXTERNAL tonight. The second question absolutely can
wait until after the exam.
In any case, a student writes:
Dear Dr. Patt, Hi, this is ****************** from your EE306 class, I just wanted to ask you a few questions that may or may not be related to one another. First, I know what a linker does, but I am unsure of what is playing the role of linker for any LC3 programs that we write and assemble. Just to make sure I understand, allow me to state the situation as I have interpreted it. If mememory serves me correctly, when we assemble something in our LC3 assembler, it creates a .obj file, and that .obj file is the module, and a linker takes a bunch of modules and links them together to execute them in a bigger program. So, in that case, does that mean that the LC3 simulator is serving as our linker and that is where we must load each individual module before we can run all the modules as a bigger program? Also, at the review session i heard you mention the 'executable image'; do you just mean that all of the modules are loaded into the simulator and then they are run, or is an executable image an actual file that can be run without a simulator or compiler such as a .exe file?
I think you have a very good understanding, and in
fact your question makes me wonder if it was a mistake for me to introduce
.EXTERNAL at all in 306. You are not using .EXTERNAL in your programs. You are writing ONE module
in LC-3 Assembly Language, and the Assembler is producing the object module,
which is to the Simulator what an .exe file is to a real computer.
My reasoning for introducing .EXTERNAL was I wanted you to understand the
generation of programs, interaction with the math library, separately
assembled programs, etc. because that is the way the real world works, and
I had hoped I could provide some insight into how the world works. In the
real world, you would (whether in assembly language or in C, C++, Java, or
whatever) have the ability to assemble/compile your program in separate
modules which then get linked together by the Linker into one executable
image (yes, the .exe file) that actually runs on the real machine. Since
you already have so many pieces of the puzzle, it was one small additional
step (I thought) to get you to have the insight into this, EVEN THOUGH in
your work on the LC-3, your programs are single modules.
It turns out that some of my colleagues at Illinois who I discuss teaching
with (and I) have been discussing whether the above is a good thing to do,
or whether it adds more confusion than it is worth. I am gathering from
your message that you think it would be better left for after 306. I am
sure I will flipflop on this one again and again between now and when I teach
306 next (in Fall, 2006).
Lastly, on a different note, I understand the idea of each program having a priority and that if a program is interrupted by another program with a higher priority, the computer will temporarily stop the first program and move to the more urgent one, but what i don't understand is how this is actually done. How is it that the computer determines which program has the higher priority? Where are these priorities stored so that they can be compared to one another? Thank you very much for your time. << name withheld to protect one who is perhaps becoming senile before his time >> P.S. I enjoy the humor in some of your emails, but i would ask that if you send this to the class, please be gentle in your criticisms. Also, i have read the book, so if there is something in there that I have missed, maybe i am becomming senile long before my time and my memory is failing me :)
Actually, I thought I did cover it in the book,
although perhaps you have not read that far ahead yet. Or, perhaps I did
not cover it in a very clear way. In any case, it is in Chapter 10. I
think I will defer answering this one now, however, since we will talk
about it in class next week -- maybe Monday, but probably on Wednesday.
Good luck on the exam on Wednesday.
Yale Patt