Midterm 2 prep questions: function arguments Python - positional, keyword (invoke) - all positional before any keyword - defining: all comb of kw-only, pos-only, both - defining: *args gets left over positional - defining: **kargs gets left over keyword decorators @a.b(340) def f(x,y,z): return x+y+z tmp = a.b(340) def f(x,y,z): return x+y+z f = tmp(f) concurrency + parallelism (overview, diff) concurrent if both start before either ends parallel if both working at same instant in time concurrent is a superset of parallel parallel implies concurrent thread vs coroutine -- code comparison def thr(): return threading.Thread(target=runme) cor = runme lock vs condition condition is a lock and more more: wait, notify, notify_all with lock: .... with condition: while !something_i_want(): condition.wait() ... change_what_someone_wants() condition.notify() Coffman conditions circular wait mutual exclusion hold-and-wait no premption dining philosophers artist deadlock TCP/UDP/DHCP and when to use them DHCP: used to connect to ISP, and thus the internet; gives you an IP address UDP: gives port numbers to IP packets -- fast is more imprtant than reliable TCP: UDP + reliable, in-order delivery -- reliable is more important than fast (usually) DNS lookup counting how many . are in hostname socket vs pipe both: 2-way communication between processes via file descriptors socket uses network, pipe uses file system what does data look like from socket, pipe bytes