Course Title |
Entities and issues: |
| Project Management | "Crashing a Project" (a method for making projects go faster), Excel (particular spreadsheet software). The issues include how to "crash" and how to use spreadsheets. |
| Guitar Playing | Guitars. The issues include concepts and skills require for playing them. |
| History of Religion | Religions and their beliefs, practices and historical development. The issues include how these items were created, changed and influenced. |
For example, within the block { int XX; .... } a memory location within the stack is allocated and XX is bound to it when control flows into the block. When control flows out of the block, this binding is destroyed. (An optimizing compiler might generate assembly language code that doesn't use a memory location on the stack for XX, but makes the program work just as if the stack were actually used, except the program might run faster. But still, how XX works obeys the rules of C/C++, assuming the compiler is correct.)
In (X=3), the value of variable X is made to be 3. The value of the whole expression is 3, so in fact the expression (Y=(X=3)) makes the values of both X and Y be 3. In (X==3) the value of X is left unchanged. The computer retrieves the value of X , compares it to 3, and makes the value of the expression be 0 if the two compared values are different and be 1 if the two compared values are equal.
It's important for class members to Raise Questions and Issues about the projects as well as any other course material.
The use of read, write, open and close is REQUIRED in project 1:Using fstreams, fread, printf, cin >>, cout <<, etc is not acceptable. Synopsis of read: (number of bytes actually copied if this number is >0) = read( file descriptor, pointer to space to read, count); Use file descriptor value 0 (an integer) to read from the terminal that runs to process. Space in which to read must be allocated ahead of time. Recall how to do this: char buffer[SIZE]; static or automatic (means in the stack) depending on where this declaration appears
(In C/C++, the expression buffer denotes the address of the first byte of the allocated array.)dynamic or programmer controlled allocation, done on the heap: C++ way: char *pbuff; pbuff = new char[SIZE]; C way: char *pbuff; pbuff = malloc(SIZE); Do not mix the C and C++ ways in the same program. Allocated space MUST be at least as large as the maximum number of bytes requested: count <= SIZE
Otherwise, there might be a disaster: your program will display mysterious bugs or crash, or a worse disaster:It would APPEAR to work correctly, but it will crash or give wrong results when somebody else uses it on another system. But then, you won't know it and won't be around to fix it.
read returns a number always <= (less than or equal) to count. The meaning of read returning 0 varies with the kind of source the file descriptor describes. For a disk file, this signifies that the position indicator is at the end of the file. For an network socket, this signifies the connection has closed. If read returns a negative value, it will be -1. This indicates some kind of error. The nature of the error is coded by the value of global variable errno.
- Registers - a small number (32 integer registers in MIPS) of cells, each stores 32 bits.
- i386 or Pentium computers have a smaller number of registers.
They have the names EAX, EBX, ECX, ..., ESI, ESD, ESP,- Memory (better called Randomly Accessible Addressable Memory, or RAM)
- Addresses: 32 bit numbers 0 - 232 (4 Gig, approx 4 Billion of them)
- Are like coordinates that cover a very large city
- There might or might not be a "house" or storage facility at each address
- Allocated memory cells containing the stored data
- When given a currently valid address, the memory system can do
- a read operation: copy the data i.e. value, stored at that address, or
- a write operation: copy given data into the storage facility with that address, so its value becomes the given data.
One job of the operating system is to copy the part of an executable file containing machine instructions into the memory, just like any other program would copy data. Then, the operating system would direct the computer to use this data as instructions.
The values in all the REGISTERS (both explicit ones and others used to hold results of comparisons) The contents of ADDRESSABLE MEMORY (instructions, data and stack): The current values in all currently allocated locations in memory. Information about which file descriptors are valid (i.e. OPEN) and what each describes, whether it be a file or a socket. The value of the PROGRAM COUNTER (a special register): The address of the next instruction to execute when the process is resumed after it is stopped.