
CS485G Spring 2015 6
8. You can also use a program:
1 typedef unsigned char
*
pointer;
2 void show_bytes(pointer start, int len){
3 int i;
4 for (i = 0; i < len; i += 1) {
5 printf("%p\t0x%.2x\n",start+i, start[i]);
6 }
7 printf("\n");
8 }
9 int a = 15213;
10 printf("int a = %d;\n", a);
11 show_bytes((pointer) &a, sizeof(int));
The output is:
int a = 15213;
0x11ffffcb8 0x6d
0x11ffffcb9 0x3b
0x11ffffcba 0x00
0x11ffffcbb 0x00
8 Memory organization
1. We usually address memory in bytes, although older computers used
to measure in “words”, which could be of any length (PDP-10: 36 bits
per word).
2. When a program is running, we call it a process.
3. From a process’s point of view, memory looks like a long array, start-
ing at byte address 0 and going to some limit determined by the op-
erating system. (On Linux for x86, memory is limited to 3GB.)
4. The operating system creates a separate address space for each pro-
cess. We say that process address spaces are virtual, because when a
process refers to address n, it is very likely not at physical address n.
5. Because processes get individual address spaces, they cannot read or
write in each other’s address spaces, although the operating system
can also arrange for some sharing.
Comentarios a estos manuales