NOTES.md 1.41 KB
Newer Older
Mattia Monga's avatar
Mattia Monga committed
1
# Errors & improvements for the text
Mattia Monga's avatar
Mattia Monga committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

## http://pages.cs.wisc.edu/~remzi/OSTEP/intro.pdf (v.0.92)

### p. 3

```sh
gcc -o cpu cpu.c -Wall
```

On my machine (gcc (Debian 6.3.0-8)), an explicit `-lpthread` is needed.

### p. 4

```sh
./cpu A & ; ./cpu B & ; ./cpu C & ; ./cpu D &
```

Incorrect with `bash`. Should be:

```sh
./cpu A &  ./cpu B &  ./cpu C &  ./cpu D &
```

Better to mention also the command to kill them (`bash`)

```sh
kill %1 %2 %3 %4
```
Mattia Monga's avatar
Mattia Monga committed
30 31 32 33 34 35 36

or (`psmisc` utils)

```sh
kill --exact ./cpu
```

Mattia Monga's avatar
Mattia Monga committed
37
It is also worth noting that if one has a number of cores $\geq 4$, the scheduling
Mattia Monga's avatar
Mattia Monga committed
38 39 40 41 42
of the four processes is deterministic with a high probability. This is
misleading and does not correspond to the output shown in the text. One can have
a more interesting output with a number of processes greater than the number of
the cores.

Mattia Monga's avatar
Mattia Monga committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
## p. 5

```sh
./mem
```

The current version of the code
(http://pages.cs.wisc.edu/~remzi/OSTEP/Code/code.intro.tgz) requires an
argument.

```sh
./mem 0
```

Also, modern Linux machines have *address space layout randomization* (ASLR), a
security measure designed to make memory addresses difficult to predict (and
different for each run). To disable ASLR in a `bash` session:

```sh
setarch $(uname -m) -RL bash
```

Mattia Monga's avatar
Mattia Monga committed
65 66 67 68 69
### p. 7

`threads.c` should be `threads.v0.c`

On my machine 100000 is too low to get a data race.
Mattia Monga's avatar
Mattia Monga committed
70

Mattia Monga's avatar
Mattia Monga committed
71 72 73 74 75 76 77 78
### p. 9

`io.c` doesn't compile without `sys/stat.h` 

```c
#include <sys/stat.h>
```