Lab 2 - FL13
Lab 2 assignment is due on Wednesday, September 4
Thursday, September 5, by 7pm in your svn repository.
On June 4, 1996 an unmanned Ariane 5 rocket launched by the European Space Agency exploded just forty seconds
after lift-off. The rocket was on its first voyage, after a decade of development costing $7 billion. The destroyed
rocket and its cargo were valued at $500 million.
On February 25, 1991, during the Gulf War, an American Patriot Missile battery in Dharan, Saudi Arabia, failed to
intercept an incoming Iraqi Scud missile. The Scud struck an American Army barracks and killed 28 soliders.
What do both events have in common? As it turns out, some basic errors in binary computation caused both of these tragedies. In
this Lab, we'll explore the limitations of binary computation and see what went wrong in both of these cases.
More command line tricks
For this assignment, we'll be using a program written for it called
to perform binary computations. Before we can start using
it, we need to learn a few more command line tricks.
Recall from Lab 1 that Unix terminal commands have the following syntax:
Recall that many programs take files and directories as arguments, which are written as
describe how to get
to the file from the current working directory, while
describe how to find the file from the
. What you
may not be aware of is that program
can also be a path. In fact, all programs are files that exist on the filesystem just like
documents. You can see where a program is located with the “which” program:
Try it with the “echo” program. When I run it, I get “/bin/echo”. “bin” is short for “binary”, since, as you'll soon discover in this class,
programs are encoded in binary machine code. On Unix systems, a directory that contains executable (runnable) binaries is called
“bin” by convention.
Remember that I said program
can be a path? You can prove it:
replaces paths starting with a "~" references your home directory. For example, to go to your ece198jl directory, you can
A “~” followed by another user's name represents their home directory. We can use the tilde to access the ece198jl class account's
program [arg1 .
which program1 .
'Programs are paths too!'