Compsys Cheatsheet
Compsys Cheatsheet
GP: used by programs for operands - use MAR to get instruction from Critical Region: region of program where shared resources are ac-
(* + - /) + pointers (can be anything) memory cessed
SP: special functions - decode instruction into operands + Race condition: processes/threads having different results based on
Memory Address Register (MAR) operators who accesses critical region first
for fetching memory addresses - execute Fixed by Mutual Exclusion: only one process at a time in critical re-
Program Counter (PC) instruction gion (lock (optional to use TLS hardware), other process busy waits
memory address of next instruction until lock == 0)
Program Status Word (PSW) Creates Priority Inversion Problem: if p1 is waiting for lock and has
execution mode bit higher priority than p2 inside critical region, will busy wait forever
kernel = 0, user = 1 Fixed by Strict Alteration: take turns running in critical region (turn
Memory Boundaries (MEM) switching after each access)
boundary of current process Yield Mutex: allow other process to run while waiting for lock
Stack Pointer (SP)
points to top of stack
- can only interact with immediate layer above/below TLS: encrypts plain text data of
sockets, extra step to set up
- provide service to layer above (email, file sharing, etc)
crypto at start
- protocols define format for talking to entities in same layer - runs on top of transport layer
TCP/IP Model: Application, Transport, Internet/Network, Link (how HTTPS works)
Transport Layer: User Datagram Protocol (UDP) Transport Layer: TCP Sliding Window
Sends datagrams over IP, connectionless Controls how much data to send/receive based on whether its processed
- datagram = packet that is purely data, no connection set up Window Size: header in TCP, how much data left in receiver’s buffer
- 3-tuple sockets, 5-tuple packets - if full, sender waits until enough space for next segment
- simple + efficient thanks to small headers - can still send ACK packets with no data, zero window probes so the receiver
- unreliable since no error + flow control + no resending bad packets re-announces the ack number and Window Size
- only ever guessing client/server are same connection
- client: dynamic port <-> server: well-known port
Multiplexing: combine streams into single for IP, split out afterwards
- port numbers specify well-known port of server it wants
- servers spawned on packet request, don’t need to be always up Window Update: receiver tells sender packets are now all read, send more
Ports: 0-65535, well-known (0-1023), registered (1024-49151), rest Persist Timer: start on sender receiving zero-size window, periodically send
are dynamic (for clients) zero window probes
- can also send urgent (priority) segments using URG flag
Transport Layer: Transmission Control Protocol (TCP) Segment Loss: repeat ACK of last in-order packet for every received segment
Reliably sends data/segments over IP, connection-oriented - after 3 duplicate packets (4 identical ACKs), sender can be sure of loss and
- data given to TCP in byte streams, converts to segments (can’t tell resend lost packet
where data ends—data reconstructed by other TCP entities using the Go-back-N: retransmit everything again from lost packet
headers) - receiver doesn’t need to store packets but can cause buffer overflow
- data sent both ways simultaneously => fully duplex Selective Repeat: only send lost packet (fast retransmit)
- receiver must store packets since packets can arrive out of order