|
|
Line 1: |
Line 1: |
| Here are some (unofficial) answers to the midterm practice questions
| | MOVED |
| | |
| 1) False. Sparse file means holes. Zeroes aren't holes.
| |
| YOu need to move the file pointer. You have to use a
| |
| seek. The data will be READ as zeros, though...
| |
| Look up truncate command and strace it. It ain't just writing zeros
| |
| | |
| 2)
| |
| Nothing happens. Env vars aren't globals. They're passed in with Execve. Environments
| |
| variables are typically process specific.
| |
| | |
| 3)
| |
| rwx
| |
| | |
| 4)
| |
| Kill the parent
| |
| Why? init will own the zombie process and then kill it
| |
| | |
| 5)
| |
| chmod +x
| |
| Default non executable. Need to make it executable. (--x)
| |
| | |
| 6)
| |
| Software interrupt
| |
| | |
| 7)
| |
| Don't know... Undefined. Can not depend on ordering
| |
| | |
| 8)
| |
| True. That's the purpose of signals
| |
| Register a normal C function as a signal handler
| |
| Some are implemented by default (sigkill)
| |
| Signals can be called at any point in execution.
| |
| | |
| 9)
| |
| Sequentially (sysV). Shell script that runs every ''command'' sequentially
| |
| | |
| Upstart does in in parrallel though...
| |
| | |
| 10)
| |
| execve DOES NOT RETURN ANYTHING. Process image is replaced.
| |
| | |
| The program itself calls the signal handler
| |
| | |
| 11)
| |
| fsck <- wrapper function
| |
| fsck.FMT <- called by fsck for a specific format (ex: fsck.ext4)
| |
| | |
| 12)
| |
| The kernel. The kernel is the only thing that can allocate.(execve)
| |
| This also makes sense because execve is a system call.
| |
| | |
| 13)
| |
| Sparse file.
| |
| | |
| 14)
| |
| lspci, lshw.
| |
| In /proc/, you may be able to also.
| |
| These commands display the machine's "hardware".
| |
| | |
| Not /dev/ because that's the abstraction.
| |
| | |
| | |
| 15)
| |
| At the command line, the $PATH variable is where the shell looks for binaries/files.
| |
| The path is walked when the fullPATH/filename of the command line hasn't been specified
| |
| | |
| 16)
| |
| Some libraries make no sys calls (strlen). Libraries that do basic string and math
| |
| operations -> no sys calls
| |
| | |
| Programs with lots of I/O will use lot of sys calls
| |
| | |
| 17)
| |
| nice and renice
| |
| nicess is policy value (default value and you can modify this)
| |
| priority (dynamic) is based on niceness and the amount of time the process has run on
| |
| cpu
| |
| Priority doesn't apply to I/O. I/O will continue despite other processing having high
| |
| priority. I/O will always slow down the system.
| |
| | |
| 18)
| |
| The former requires a library card and a telephone.
| |