Talk:COMP 3000 Final Exam Study Guide 2012
There's what I would put down. There may be mistakes...
Concepts
- Processes, threads (particularly in terms of execution contexts and address spaces)
Processes are execution environments with a minimum of one running thread. They all have their own virtual memory address spaces. A process can have many threads.
- What code is in the kernel and what isn't
The kernel boots before anything, so it can't rely on any userland libraries like the C std library. The kernel re-implements much functionality found in said library (printf vs printk).
- Supervisor versus user mode
These are CPU modes. Supervisor allows unrestricted access to the system. Only kernel code (with a few exceptions).
User mode only grants access to the system via system calls.
See CPU Modes
- virtualization basics: what is a VM, what does machine look like inside a VM
- Signals (SIGTERM, SIGKILL, SIGSTOP, SIGCONT, SIGCHLD, SIGSEGV, etc.)
- signal handling: what can be handled, who calls them, how do they work?
- Major system calls: fork, execve, open, close, read, write, lseek, mmap
fork: creates a new process and copies the current process image into the newborn execution context
execve: fills the current process with a new an image from a path.
int execve(const char *filename, char *const argv[],char *const envp[]);
open: grants access to file. Returns a file descriptor referring to that file or -1 for errors. Updates OS table of open files.
int open(const char *pathname, int flags, mode_t mode);
close: terminates access to a file. Flushes buffer, free's allocated space, updates metadata and a buncha other cool stuff.
int close(int fd);
read: reads a certain amount of bytes (count) from a file descriptor (fd) to a buffer pointer (*buf)
ssize_t read(int fd, void *buf, size_t count);
write: writes count bytes to a file descriptor fd from buffer pointed at by *buf. Returns number of bytes written, 0 or -1 for errors. Writes after current file offset (see lseek)
ssize_t write(int fd, const void *buf, size_t count);
lseek: reposition read/write file offset
off_t lseek(int fd, off_t offset, int whence);
whence = SEEK_SET SEEK_CUR SEEK_END
mmap: requests a new memory mapping of a given space within the current process's virtual memory address space. Similar to malloc.
see an answer on SO
- The process hierarchy and zombie processes
- Files, directories, inodes, sparse files
- file permissions: users, groups, others, rwx, where are they stored?
- Basic file-level concurrency, flock
- Ubuntu/Debian alternatives system
- Basic package management on Ubuntu: apt-get, dpkg
- Basic package development: dpkg-dev, dpkg-buildpackage, fakeroot
- filesystem administration: mkfs, fsck, mount, /etc/fstab
- block versus character devices and how they are used
- upstart and init
- init and process hierarchy
- upstart versus System V init scripts
- upstart scripts, basic structure, purpose, common options
- SysV init scripts, basic structure and purpose
- device drivers
- environment variables and command line arguments: how they are passed, how are they stored and accessed
- static versus dynamic linking
- basics of how dynamic linking is implemented (strace-level view)
- strace and ltrace
- Kernel: proc filesystem basics, structure of kernel, relation to C library
- netcat: basic usage
- PATH environment variable and the shell
- basic command line I/O redirection: <, >>, >, |
- shell commands: if, while, for, touch, test (with common tests), echo
- built-in versus external shell commands (and relationship to processes)