CSC 8400 Computer Systems Fall 2009

Section 1

FAQ

Dr. Thomas Way


Question 0: What is this FAQ all  about?

Answer 0: This FAQ is all about providing answers to questions posed by CSC 8400 students. Students who email questions to the instructor will have their questions answered here in the form of text, graphics or other multimedia such as PowerPoint slides or streaming video.


Question 1: What is the URL for our class web site?

Answer 1: For Fall 2009, the web site is at http://www.csc.villanova.edu/~tway/courses/csc8400/f2009.


Question 2: What is the ISBN number for our textbook?

Answer 2: ISBN 0-13-034074.


Question 3: Any hints on problems 2.42 and 2.43?

Answer 3: See sections 2.1.8, 2.1.9 and 2.1.10, including practice problems 2.11, 2.12, 2.13 and 2.14 (with solutions at the end of the chapter) in the textbook. Also examine (and try?) the program "printbytes.c" that is linked on the schedule for our second class meeting. There are a lot of clues about "bit masking," bitwise operators, logical operators and shift operators that should be quite helpful.


Question 4: In Chapter 2, what does "word size" refer to? Is this what is meant when it is referring to a 32 bit and 64 bit operating system, for instance?

Answer 4: Yes, and it goes beyond the OS. It is really a 32-bit or 64-bit processor on top of which everything else must be designed to work (i.e., the operating system, applications, etc.). When something has a 32-bit word, what it is saying is that all of the fundamental operations and components operate on things 32 bits at a time. Each memory location holds 32 bits, when you add two numbers each one is kept in 32 bits (as is the result), etc. For a little more explanation, see pages 7 and 32 in the textbook


Question 5: When I try to run the "make" command, I get a "command not found" error. How can I fix this:?

Answer 5: This is caused by "make" not being in your current "path." To fix this, do this:

Copy my ".profile" to your account:
1) Login to your account, stay in your home directory
2) Type: cp /mnt/a/tway/.profile .    <- note the dot at the end
3) Exit, then login again. Make should now work.


Question 6: How is multiplication implemented at the machine level? In the textbook, the multiplication operation takes 4 cycles while the shift operation takes 1 cycle and which is why some optimizing compiler will replace * with shift. Everything boils down to 1's and 0's, so how is multiplication actually done using binary and logical operators?

Answer 6: Thanks for the great question!

Multiplication is an area where lots of research has been done, and many interesting,
efficient and exotic algorithms have been devised to perform the operation at the
machine level. In the end, two algorithms are most widely used. For smaller integers,
the "Shift and Add" algorithm is used, benefiting from what we know about left-shift
being the same a multiplying by powers of 2. In the general case, the most widely
used algorithm is the "Peasant Multiplication" algorithm which uses shifts and sums
and is particularly fast when performed with binary numbers.

The best and most condensed descriptions of these, and other cool multiplication
algorithms, is found of all places on the Wikipedia Multiplication algorithm page.

If you are interested in trying your hand at creating a multiplication function that
is fast and uses only shifting and adding, here is a workshop assignment I gave
out a couple semesters ago:
Write a C program that multiplies two integer values. This function
may ONLY use addition, subtraction, AND, OR, XOR, NOT, left-shift
and right-shift operators, and should handle both signed and unsigned

values. The program should accept the two values on the command line.

Question n: This is a question?

Answer n: This is an answer.


Question n: This is a question?

Answer n: This is an answer.


Question n: This is a question?

Answer n: This is an answer.


 

This is some blank space. Nice.

 


Last updated: 11/04/2009