Operating Systems 2020W Lecture 13

From Soma-notes
Jump to navigation Jump to search

Video

Video from the lecture given on February 26, 2020 is now available.

Notes

Lecture 13 - midterm review!
----------------------------
poll posted on running native Linux

Topics:
 - assignment 2 solutions
 - key concepts
 - your questions!

THE TEXTBOOK IS HELPFUL TO REVIEW
 - it helps with the concepts!
 - but emphasis is different, so use it selectively
 - not all concepts are in the textbook

Concepts relevant to midterm:
 - OS kernel
 - user mode/supervisor mode
 - root user/unprivileged users
 - uid, gid, euid, egid, username, groups
 - file permissions: user, group, other, read, write, execute
 - types of files: regular files, directories, symbolic links, block devices,
   character devices
 - hard links
 - setuid bit, setgid bit
   - why are programs setuid root?
   - how does this interact with uid, euid of a process
     (after execve of a setuid root process)?
 - logical vs physical sizes of files
 - relationship between shell operators (>, <) for redirecting standard input, output and underlying system calls, file descriptors
    - connection with open, dup2
 - relationship between execve, command line arguments, environment variables
 - login shells, how only some programs are allowed to be shells
   (and what changing the login shell changes for a user)
 - ssh key-based authentication
   - identity keys (local) vs authorized_keys
   - known_hosts (remote host public keys stored locally)
   - how to enable public key auth for a user
   - how hosts are identified using their public keys
 - running commands on remote hosts via ssh
   - runs them via a shell
   - why do that versus just do an execve
 - stat vs lstat vs fstat
   - using file descriptors versus filenames
   - following or not following symlinks
   - info returned (all the inode metadata)
 - deleting a file is just unlinking (every regular file is a hard link)
   - link count for an inode
 - copying vs making a hard link vs making a symbolic link
   - when does the inode stay the same versus change
   - if you delete one, how does it affect the other
     (A hardlinked to B, delete A versus
      A symlinked to B, delete A)
 - holes in files
   - how seeking + writing past end of file will create them
   - effect on logical vs physical size of a file
 - filesystem structure: inodes, directories, superblocks
   - role of lost+found, fsck, mkfs
 - sshfs
   - how its weirdness relates to restrictions on userspace programs,
     remote hosts (with different uid/gid mappings)
 - tty's, pseudo tty's (/dev/tty1, /dev/pts/0)
   - as character devices
   - relationship to standard in/out/error for interactive programs
 - local vs global variables in C
 - difference between function calls, library calls, system calls
   - library calls are dynamically linked functions
 - basic idea of dynamic linking
 - how shells find external programs
   - PATH environment variable
 - process termination (exit system call, signals)
 - process return values & wait system call
 - fork, execve
   - role in running external commands in the shell
 - signal handlers
   - registering
   - when called
   - concurrency
   
Concepts not so relevant for midterm (but will come up later):
 - secure hashes
 - pipes
 - gdb, strace
   - but should know things you could only learn by using those tools
 - exact details of structure of ext4
 - CPU registers, stack vs heap

Requested clarifications
 - uid vs euid
 - inodes
 - hard links