KatInterview

Memory Management, Secure Transport, and Protocol Trade-offs

System DesignModel answer
MediumModel answerSystem Designfundamentalsnetworkingmemory-management

Last updated

Contrast storage duration and allocation, explain TLS-based security in HTTPS, and compare reliable streams with unreliable datagrams.

You are interviewing for a platform engineering role. The interviewer asks you to explain three foundational concepts that appear in production debugging and architecture decisions:

  1. Storage duration and heap allocation: Contrast objects with automatic storage duration against those allocated on the heap. Discuss lifetime, ownership semantics, and failure modes such as dangling pointers or memory leaks. Explain how resource management strategies like RAII or garbage collection affect these risks.

  2. HTTP versus HTTPS: Describe what a secure transport layer adds when HTTPS is used instead of plain HTTP. Cover authentication, confidentiality, integrity verification, and certificate validation. Identify what threats remain even with HTTPS in place.

  3. TCP versus UDP: Compare these transport protocols in terms of connection semantics, delivery guarantees, ordering, flow control, message framing, and latency characteristics. Explain why "UDP is faster" oversimplifies the trade-off and discuss when each protocol is appropriate.

For each topic, provide concrete examples, distinguish protocol guarantees from implementation details, and describe real-world failure scenarios or debugging symptoms that arise from misunderstanding these concepts.

Hints

Hint 1

Lifetime and ownership are independent of whether a pointer variable is used to access an object.

Hint 2

HTTPS wraps HTTP inside TLS but does not change the HTTP request structure or application-level vulnerabilities.

Hint 3

Reliability and ordering can be layered on top of UDP; the protocol itself only provides framing and checksums.