VelocerOpen the app

Velocer › Flashcards › University of Wisconsin–Madison › CS 544: Intro to Big Data Systems · UW-Madison

CS 544: Intro to Big Data Systems · UW-Madison

CS 544 flashcards for the midterm. · by orbital_index · 103 cards

University of Wisconsin–Madison

Study this deck Embed

  1. What does the redirection operator > do in a shell command?It overwrites stdout (file descriptor 1) and sends it to the specified file.
  2. What is the difference between > and >> in shell redirection?> overwrites the target file, while >> appends stdout to the end of the file.
  3. How do you redirect only stderr to a file?Use cmd 2> file, which redirects file descriptor 2 (stderr) to the file.
  4. What does the &> operator do?It redirects both stdout and stderr to the same file.
  5. What does the pipe operator | do?It sends stdout of the first command to stdin (file descriptor 0) of the second command.
  6. Why use the -u flag with python3 -u server.py > log.txt?It forces unbuffered stdout/stderr so logs appear immediately instead of waiting for the 4 KB–8 KB buffer to fill.
  7. In an IP address, what do the prefix and suffix identify?The prefix identifies the network, and the suffix identifies the host.
  8. What does a port number identify on a host?It identifies the specific running process or socket on that host.
  9. Which command lists processes listening on ports?ss -tulpn lists processes listening on ports.
  10. In docker run -p V:C, what do V and C represent?V is the VM (host) port and C is the container port being mapped.
  11. What does the SSH command ssh -L localhost:L:localhost:V user@vm accomplish?It tunnels laptop port L to VM port V, forwarding local traffic through the SSH connection to the VM.
  12. In the container-to-VM-to-laptop port chain, what URL do you open in the laptop browser?http://localhost:L/, where L is the local laptop port chosen in the SSH tunnel.
  13. What memory regions do threads within the same process share, and what do they keep private?Threads share the heap (global variables, objects) and code segments, but each thread has its own private stack (local variables) and instruction pointer (program counter).
  14. Why is total += 1 not atomic in Python?It compiles to multiple bytecode instructions (LOAD_GLOBAL, BINARY_OP, STORE_GLOBAL), so a context switch between load and store can cause lost increments.
  15. What is the recommended way to use a threading.Lock in Python, and why?Use with lock:, which automatically acquires and releases the lock even if an exception occurs.
  16. What is the TOCTOU bug in the context of locking, and how do you avoid it?A condition check on shared state (e.g., if q != 0:) must be inside the critical section; otherwise another thread can change the state between the check and its use (e.g., 1 / q).
  17. Does holding a lock prevent the OS scheduler from context-switching to another thread?No. Holding a lock only blocks other threads that call lock.acquire() on that same lock; the scheduler can still switch to other threads.
  18. What is the difference between coarse-grained and fine-grained locking?Coarse-grained acquires/releases a lock once outside a large loop (faster, ~160 ms), while fine-grained acquires/releases inside every iteration (slower, ~469 ms) but holds the lock for shorter periods.
  19. What does the Global Interpreter Lock (GIL) do in standard CPython?It allows only one thread to execute Python bytecode at a time, so CPU-bound Python threads don't run in parallel.
  20. Which operations release the GIL in standard CPython?I/O operations and C extensions such as NumPy and PyArrow release the GIL.
  21. What is python3.14-nogil and what does it enable?It is a free-threaded build of Python 3.14 that disables the GIL, allowing CPU-bound Python threads to scale across multiple CPU cores.
  22. What is a race condition?A bug where the outcome depends on the unpredictable timing/interleaving of threads accessing shared state, such as lost increments from non-atomic total += 1.
  23. What is a critical section?A region of code that accesses shared state and must be executed atomically, typically protected by a lock.
  24. What is the difference between RUN and CMD in a Dockerfile?RUN executes commands at image build time and commits a new read-only layer; CMD sets the default command executed at container start time.
  25. Why should apt-get update and apt-get install be combined in a single RUN layer?Splitting them into separate RUN commands causes stale layer caching bugs on later rebuilds, since the cached update layer may not re-run.
  26. Which Dockerfile instruction sets the base image?FROM.
  27. What does the COPY instruction do in a Dockerfile?It copies files from the build context into an image layer.
  28. What does the docker build command do, and what does the -t flag specify?It builds an image from a Dockerfile; -t tags the resulting image with a name.
  29. In docker run, what does the -d flag do?Runs the container detached (in the background).
  30. What does the -p flag do in docker run?Maps a host port to a container port, e.g. 127.0.0.1:5000:5000.
  31. What does the -v flag do in docker run?Mounts a host directory into the container, optionally read-only with :ro.
  32. What does the -e flag do in docker run?Sets an environment variable inside the container.
  33. What does the -m flag do in docker run?Sets a memory limit for the container, e.g. -m "4g".
  34. What is the purpose of docker exec -it <container> bash?Opens an interactive shell inside an already running container.
  35. How do you follow the logs of a detached container?Use docker logs -f <container> to follow its stdout/stderr.
  36. What is the difference between docker exec and docker run?docker exec runs a command in an already running container; docker run starts a new container from an image.
  37. Why should you use apt-get -y instead of apt in a Dockerfile RUN command?apt is interactive and may prompt for input, breaking non-interactive image builds; apt-get -y avoids prompts.
  38. What is the build context in Docker?The set of files available to the build, from which COPY can pull files into the image.
  39. What is the formula for cache hit rate?Hit Rate = Hits / (Hits + Misses).
  40. How does FIFO eviction work in a cache?FIFO evicts the oldest inserted key, regardless of how recently it was accessed.
  41. How does LRU eviction work in a cache?LRU evicts the key whose most recent access (hit or miss) was furthest in the past.
  42. In an LRU implementation using an evict_order list, what happens on a cache hit?The key is removed from evict_order and re-appended to the right (becoming the most recently used).
  43. In an LRU implementation, what happens on a miss when the cache is full?Pop the victim from the left of evict_order (evict_order.pop(0)) and delete it from the cache.
  44. What data structure from Python's collections is commonly used to implement LRU?collections.OrderedDict (or a dict plus an evict_order list).
  45. What distinguishes FIFO from LRU in terms of access recency?FIFO ignores recent accesses and evicts by insertion age; LRU evicts based on the time since the last access.
  46. In LRU, what does the left end of evict_order represent?The least recently used key, which is the next eviction victim.
  47. In LRU, what does the right end of evict_order represent?The most recently used key.
  48. On a cache miss in LRU, is the newly inserted key added to evict_order?Yes, it is appended to the right as the most recently used key.
  49. Does a cache hit change eviction order under FIFO?No, FIFO eviction order depends only on insertion order, so hits do not affect it.
  50. Does a cache hit change eviction order under LRU?Yes, a hit moves the key to the most recently used position.
  51. What dominates the cost of small random reads on an HDD?Seek time (moving the head) plus rotational latency dominate small random reads on an HDD.
  52. What dominates the cost of very large sequential transfers on an HDD?Data transfer bandwidth dominates very large sequential transfers.
  53. How many bits are in a byte, and what is 8 MB/s in Mbps?1 Byte = 8 bits, so 8 MB/s = 64 Mbps.
  54. What does tmpfs store files in?tmpfs stores files directly in RAM/memory.
  55. How does row-oriented storage lay out data on disk?It stores entire rows contiguously, e.g. r1c1, r1c2, r1c3, r2c1, r2c2, r2c3.
  56. What workload is row-oriented storage ideal for, and why?Transactional (OLTP) workloads, because they typically read and write whole records.
  57. Give examples of row-oriented storage formats/systems.CSV and MySQL (OLTP) are row-oriented.
  58. How does column-oriented storage lay out data on disk?It stores each column contiguously, e.g. r1c1, r2c1, ..., r1c2, r2c2, ...
  59. What workload is column-oriented storage ideal for?Analytical (OLAP) workloads that scan and aggregate a few columns across many rows.
  60. Give examples of column-oriented formats/systems.Apache Parquet, Apache Arrow, and BigQuery Capacitor/ColumnIO.
  61. What is projection pushdown in columnar storage?Reading only the bytes of the selected columns from disk, e.g. pa.parquet.read_table("file.parquet", columns=["colA"]).
  62. Why does columnar storage avoid schema inference overhead?A binary header stores exact column types, unlike CSV which requires text parsing.
  63. Why does columnar storage compress better than row storage?Homogeneous values within a column compress far better using techniques like Run-Length Encoding (RLE) and dictionary encoding.
  64. How does columnar layout improve CPU cache locality?Summing a contiguous column vector pulls 64-byte cache lines filled purely with target elements, avoiding cache-line waste.
  65. What does memory-mapped Arrow (mmap) do for large files?It maps a massive .arrow file into virtual address space so the OS pages data in on demand without exhausting RAM.
  66. Which is better for OLTP: row-oriented or column-oriented storage?Row-oriented storage, because OLTP reads and writes whole records.
  67. Which is better for OLAP: row-oriented or column-oriented storage?Column-oriented storage, because analytics scan and aggregate a few columns over many rows.
  68. What format does Protobuf use for serialization in RPCs?A binary row/message format used for remote procedure calls.
  69. How are Protobuf integer types like int32 and int64 encoded?They use varint encoding.
  70. In Protobuf varint encoding, what determines the number of serialized bytes for an integer?The size of the runtime value, not the declared bit-width (intX).
  71. Why can a small value in an int64 field take only 1 byte in Protobuf?Because varint encoding depends on the magnitude of the runtime value, so small numbers use fewer bytes regardless of the declared type.
  72. How can gRPC systems tolerate container failures when replicated backend dataset servers sit behind caching proxies?Use client-side retries with failover across backend stubs.
  73. What does varint encoding mean in Protobuf?A variable-length integer encoding where the number of bytes depends on the value's magnitude.
  74. What does the HDFS NameNode store in memory?The file tree metadata and the block map, which records which DataNodes hold which blocks.
  75. What do HDFS DataNodes store, and how does the NameNode detect their failures?DataNodes store the actual fixed-size data blocks on local disks and send periodic heartbeats to the NameNode, which uses them to detect DataNode failures.
  76. What is the main limitation of MapReduce that makes iterative algorithms slow?It writes intermediate results to HDFS disk (with replication) between every job, making multi-step iterative algorithms like ML and graph processing very slow.
  77. In MapReduce, if an input has N key/value records, how many times is map(...) called?N times—once per input record, regardless of unique keys.
  78. Why is MapReduce slow for multi-stage joins and graph processing?Because it persists intermediate results to replicated HDFS disk between every job, adding heavy I/O overhead.
  79. What is the key difference between a transformation and an action in Spark?Transformations are lazy and return a new RDD/DataFrame without executing anything; actions are eager and materialize a result or write output, triggering execution.
  80. What defines a narrow transformation in Spark?One input partition maps to one output partition with no network shuffle, and it executes within a single stage.
  81. What defines a wide transformation in Spark?Multiple input partitions are combined into output partitions via a network shuffle, which introduces a stage boundary.
  82. What is the hash partitioning rule in Spark?For P partitions (0 to P-1), a row with key x goes to partition hash(x) % P. For example, hash=10 with P=5 goes to partition 0.
  83. What does MEMORY_ONLY caching do, and what is its main drawback?It stores deserialized JVM objects in RAM for fastest access, but uses more bytes due to pointer and header overhead.
  84. How does MEMORY_ONLY_SER or DISK_ONLY caching differ from MEMORY_ONLY?It stores compact serialized bytes, using less space, but requires CPU serialization and deserialization.
  85. When does Spark use a Broadcast Hash Join (BHJ)?When joining a small table (fits in executor memory) with a huge table; Spark broadcasts only the small table to every executor, avoiding shuffling the huge table.
  86. When does Spark use a Shuffle Sort Merge Join (SMJ), and how does it work?When both tables are large; it hash-partitions both tables by the join key across the network, sorts each partition, and merges them.
  87. How can you eliminate the shuffle in a Shuffle Sort Merge Join?Pre-bucket both Hive tables on the join key using CLUSTERED BY (id) INTO N BUCKETS.
  88. What is the difference between a Transformer and an Estimator in Spark MLlib?A Transformer has .transform(df) (e.g., VectorAssembler, fitted PipelineModel); an Estimator has .fit(df) returning a Transformer/Model (e.g., DecisionTreeClassifier, unfitted Pipeline).
  89. What is the core architectural difference between Cassandra and systems like HDFS or HBase?Cassandra is masterless and peer-to-peer, while HDFS uses a NameNode and HBase uses an HMaster with RegionServers where each row belongs to one RegionServer.
  90. How does Cassandra decide which node(s) store a row?It hashes the row's Partition Key to a token on a ring, and token ranges (vnodes) are assigned to physical nodes.
  91. With replication factor RF, where is a row with token t stored?On the first RF distinct nodes encountered moving clockwise (increasing token order, wrapping around) on the ring.
  92. In Cassandra's primary key, what does the Partition Key determine?Which node(s) store the partition, via hashing.
  93. In Cassandra's primary key, what do the Clustering Key(s) determine?The sorted order of rows within that partition.
  94. Why is a Cassandra INSERT described as an upsert?Because it is keyed by the full primary key (Partition Key + Clustering Key); inserting a row with an existing full key overwrites the previous row.
  95. What are Cassandra static columns used for?They store data shared by all rows in the same partition, such as company metadata alongside daily records in a denormalized table.
  96. What query limitations does CQL have regarding JOINs and GROUP BY?Cassandra supports no JOINs, and GROUP BY only by partition key plus a prefix of clustering keys.
  97. What condition guarantees strong consistency in Cassandra?The read quorum R and write quorum W must overlap: R + W > RF.
  98. If RF = 4 and W = 2, what minimum R gives strong consistency?R = 3, since R must be greater than RF - W = 2.
  99. How is the QUORUM consistency level computed?Q = floor(RF/2) + 1.
  100. How many node failures can a Cassandra cluster with RF replicas tolerate on writes and reads?RF - W failures on writes and RF - R failures on reads.
  101. How is a Kafka topic structured?It is a distributed append-only log split into ordered Partitions for parallelism, replicated across Brokers.
  102. What rule governs partition assignment within a Kafka consumer group?Each partition is assigned to at most one consumer in the group, so N partitions allow up to N parallel consumers.
  103. What are Kafka's three delivery semantics?At-most-once, at-least-once, and exactly-once (via checkpointing offsets with output writes or transactional producers).

Velocer is free: spaced repetition and your own cards from any document.

PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import

More decks from University of Wisconsin–Madison