Künstliche Intelligenz — Oberstufe (C1/C2) 2: Operating Systems, Concurrency, Networking Protocols & Distributed Systems

[Deutsch] Künstliche Intelligenz: Processes, threads, deadlocks, virtual memory, TCP/IP, DNS, HTTP/3, Raft consensus, CAP theorem, and distributed caching

Level
advanced
Languages
de → de
Cards
32
Markdown
Künstliche Intelligenz — Oberstufe (C1/C2) 2: Operating Systems, Concurrency, Networking Protocols & Distributed Systems (.md)

Flashcards (32)

#Front (Term / Question)Back (Definition / Answer)ExampleMultiple-Choice Options
1What is a race condition, and what defines a critical section in concurrent programming?A race condition occurs when concurrent thread output depends on non-deterministic execution timing; a critical section is a code block accessing shared mutable state that must not be concurrently executed.
2In the Raft consensus algorithm, how does leader election work, and what role do randomized election timeouts play?If a follower receives no heartbeat, it becomes a Candidate and requests votes; randomized timeouts (e.g., 150–300 ms) prevent split votes by ensuring one candidate typically times out and wins a majority vote first.
3What problem does HTTP/2 solve over HTTP/1.1, and what is its binary framing mechanism?Eliminates HTTP application head-of-line blocking by multiplexing multiple independent bidirectional streams over a single TCP connection using binary framing (HEADERS and DATA frames) and HPACK header compression.
4What is Belady's anomaly in operating system page replacement?The counterintuitive phenomenon where increasing the number of physical page frames results in more page faults, occurring in FIFO page replacement (impossible in stack algorithms like LRU).
5How does the Cache-Aside (Lazy Loading) caching pattern function?The application first checks the cache: on a hit, it returns the cached data; on a miss, it reads from the database, writes the fetched data into the cache, and returns it.
6Trace the recursive DNS resolution process for resolving a new domain name (e.g., example.com).Client queries Recursive Resolver -> Root DNS server (returns .com TLD server) -> TLD server (returns authoritative nameserver for example.com) -> Authoritative Nameserver (returns A/AAAA record) -> Resolver caches and returns IP to client.
7How does Consistent Hashing minimize key redistribution when server nodes are added or removed?Hashes both keys and nodes to positions on a 360° circular hash ring; a key is assigned to the next clockwise node; adding or removing a node only moves keys in its immediate adjacent partition (O(K/N) keys moved).
8What is the Cache Stampede (Thundering Herd) problem, and how is it prevented?Occurs when a popular cached key expires, causing massive concurrent requests to hit the database simultaneously; prevented by distributed mutex locking (single flight) or probabilistic early expiration (XFetch).
9What are the four Coffman conditions necessary and sufficient for a deadlock to occur?1. Mutual Exclusion 2. Hold and Wait 3. No Preemption 4. Circular Wait.
10How does TCP sliding window flow control prevent a sender from overwhelming a receiver?The receiver advertises its available buffer capacity in the TCP header Receive Window (rwnd) field; the sender limits in-flight unacknowledged bytes to min(cwnd, rwnd).
11How does Preemptive Round-Robin CPU scheduling function, and what trade-off governs time quantum selection?Each ready process receives a fixed time slice (quantum); if too large, responsiveness degrades to FCFS; if too small, CPU context switching overhead degrades throughput.
12What is the Circuit Breaker pattern in microservices distributed architectures?A pattern with three states: Closed (requests pass through), Open (failures exceed threshold, calls fail fast without hitting dependency), and Half-Open (trial requests test if service has recovered).
13Compare the 7 layers of the OSI model with the 4 layers of the TCP/IP model.OSI: Physical, Data Link, Network, Transport, Session, Presentation, Application. TCP/IP: Network Interface (Link), Internet, Transport, Application.
14What does the PACELC theorem state extending the CAP theorem?If there is a Partition (P), choose Availability (A) or Consistency (C); Else (E), choose Latency (L) or Consistency (C).
15Describe the packets exchanged during the TCP Three-Way Handshake connection establishment.1. Client sends SYN (with client initial sequence number ISN_c). 2. Server replies with SYN-ACK (ISN_s and ACK = ISN_c + 1). 3. Client sends ACK (ACK = ISN_s + 1).
16What is the critical failure mode of the Two-Phase Commit (2PC) protocol?It is a blocking protocol: if the coordinator crashes during Phase 2 after cohorts have voted YES, cohorts remain indefinitely blocked holding locks, unable to abort or commit autonomously.
17How does Transport Layer Security (TLS 1.3) establish confidentiality and integrity?Uses Diffie-Hellman (ECDHE) for ephemeral asymmetric key exchange to provide forward secrecy, authenticates server via X.509 certificates, and encrypts payload with symmetric authenticated ciphers (AEAD like AES-GCM or ChaCha20-Poly1305).
18How does the Two-Phase Commit (2PC) protocol ensure atomic distributed transactions across multiple nodes?Phase 1 (Prepare): Coordinator asks all cohorts to prepare and vote YES/NO; Phase 2 (Commit): If all voted YES, coordinator writes commit and broadcasts COMMIT; if any voted NO or timed out, broadcasts ABORT.
19What are the key operational differences between TCP and UDP at the transport layer?TCP is connection-oriented, provides guaranteed delivery, ordered streams, error recovery, flow and congestion control; UDP is connectionless, unordered, lightweight, with minimal overhead and no retransmissions.
20What is the Raft Log Matching property, and how does the leader enforce it?If two logs contain an entry with the same index and term, they are identical up to that index; the leader overwrites conflicting uncommitted follower entries with its own log entries.
21How does a Mutex differ from a Counting Semaphore?A Mutex provides mutual exclusion with thread ownership (only the thread that locked it can unlock it); a counting semaphore is an atomic signaling counter (sem_wait/sem_post) permitting up to N concurrent threads without ownership.
22What is the fundamental difference between an operating system process and a thread?A process has an independent virtual address space, file descriptors, and security context; threads within the same process share the process address space, heap, and code, but have private registers and stacks.
23State the CAP Theorem and explain the operational trade-off required during a network partition.A distributed system can guarantee at most two of Consistency, Availability, and Partition Tolerance; because network partitions (P) are unavoidable, systems must choose between Consistency (CP, failing unavailable requests) or Availability (AP, returning stale data).
24Why does the active closer in a TCP connection enter the TIME_WAIT state for 2*MSL (Maximum Segment Lifetime)?To ensure the final ACK is reliably delivered to the remote peer (resending if lost) and to allow stale duplicate packets in the network to expire before socket reuse.
25How can deadlock be prevented by eliminating the Circular Wait condition?Impose a global total ordering on all lockable resources and require every thread to acquire locks strictly in increasing numerical order.
26What information is saved and restored during an operating system context switch?CPU hardware registers, program counter (PC), stack pointer, processor status flags, and memory management registers (CR3/page table pointer in PCB).
27What sequential steps occur when an instruction triggers a page fault exception in the CPU?1. MMU detects unmapped PTE and raises page fault trap. 2. OS locates frame on disk swap. 3. OS reads disk page into a free physical frame. 4. OS updates PTE with valid bit and physical frame number. 5. OS restarts the faulting instruction.
28Why was HTTP/3 developed to run over QUIC (UDP) rather than TCP?In HTTP/2 over TCP, a single dropped packet stalls all multiplexed streams (TCP head-of-line blocking); QUIC runs over UDP and handles independent packet recovery per stream with 0-RTT/1-RTT connection setup.
29What is virtual memory paging, and what hardware component accelerates virtual-to-physical address translation?Dividing virtual and physical memory into fixed-size blocks (pages and frames) mapped via page tables; accelerated by the Translation Lookaside Buffer (TLB), an on-chip associative cache.
30Compare Write-Through and Write-Back (Write-Behind) distributed caching patterns.Write-Through synchronously writes to cache and database simultaneously (high durability, higher write latency); Write-Back writes immediately to cache and queues asynchronous batch writes to database (low latency, risk of data loss on crash).
31How does TCP Congestion Control transition between Slow Start and Congestion Avoidance?During Slow Start, cwnd doubles every RTT (exponential growth) until it reaches the slow start threshold (ssthresh), where it switches to Congestion Avoidance, increasing cwnd by 1 MSS per RTT (additive increase).
32What is Eventual Consistency in distributed systems, and what ensures that replicas eventually converge?If no new updates are made, all replicas will eventually return identical values; convergence is achieved using conflict resolution protocols like vector clocks, CRDTs, or Last-Write-Wins (LWW).