Start by clearly defining processes and threads, emphasizing that processes are independent execution units with separate address spaces, while threads are lightweight units within a process sharing the same address space. Then explain the overhead of CPU switching between them, distinguishing between context switch costs for processes (higher due to TLB flush, cache invalidation) and threads (lower due to shared memory). Finally, relate this to trade-offs in system design, such as choosing threads for concurrency vs. processes for isolation.
Pro tip: Mention that while thread context switches are cheaper, they still incur kernel overhead, and in some cases (e.g., user-level threads), switching can be extremely fast but lacks kernel awareness. This shows depth and awareness of real-world performance considerations.
Explain that a process is an independent program in execution with its own memory space, resources, and state. It is the unit of resource allocation and protection.
Describe a thread as a lightweight unit of execution within a process, sharing the process's memory and resources but having its own stack, registers, and program counter.
Discuss the overhead when the CPU switches between processes vs. threads. For processes: higher overhead due to TLB flush, cache invalidation, and full context save/restore. For threads: lower overhead because they share the same address space, so no TLB flush or cache invalidation is needed.
Explain the implications: processes offer isolation and fault tolerance but are heavier; threads offer faster communication and context switching but require careful synchronization and can affect each other.
Summarize how this knowledge informs design decisions, such as using threads for I/O-bound tasks and processes for CPU-bound tasks requiring isolation.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Concurrency is about structure, parallelism is about execution, said that fine.
Start by clearly defining concurrency and parallelism, emphasizing that concurrency is about dealing with multiple tasks at once (structure) while parallelism is about executing multiple tasks simultaneously (execution). Then, describe a common concurrency bug like a race condition or deadlock, and explain prevention strategies such as using locks, atomic operations, or design patterns. Finally, relate it to a real-world scenario, ideally in a financial systems context like Citi, to show practical understanding.
Pro tip: Mention that concurrency bugs are often non-deterministic and hard to reproduce, so prevention through design (e.g., immutability, message passing) is more effective than debugging. Also, highlight the importance of testing under load and using tools like thread sanitizers.
Explain that concurrency is about managing multiple tasks that can be interleaved, often on a single core, while parallelism is about executing multiple tasks simultaneously on multiple cores. Use analogies if helpful, like a juggler (concurrency) vs. multiple jugglers (parallelism).
Choose a well-known bug such as a race condition (e.g., two threads incrementing a shared counter) or deadlock (e.g., two threads waiting for each other's locks). Briefly explain how it occurs and its potential impact.
Discuss techniques to prevent the bug: for race conditions, use locks, atomic variables, or synchronization; for deadlocks, use lock ordering, timeouts, or avoid nested locks. Emphasize design-level solutions like immutability or message passing.
Connect the concepts to a financial or high-performance system, such as handling concurrent transactions in banking. Mention how Citi might value robust concurrency control for data consistency and low-latency trading.
Conclude by noting that concurrency and parallelism are not mutually exclusive and involve trade-offs between performance, complexity, and correctness. Highlight the importance of choosing the right model for the problem.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Start by defining TCP and UDP and their core differences, then explain when to choose each based on application requirements. Finally, dive into TCP's flow control and congestion control mechanisms, highlighting their importance in reliable data transfer.
Pro tip: Relate the concepts to real-world scenarios, such as financial transactions (TCP) vs. live streaming (UDP), to show practical understanding. Also, mention that TCP's congestion control is crucial for network stability, which is particularly relevant in high-frequency trading environments like Citi's.
Briefly describe TCP as connection-oriented, reliable, and ordered, and UDP as connectionless, unreliable, and unordered. Mention their respective headers and overhead.
Contrast reliability, ordering, speed, overhead, and use cases. Highlight that TCP guarantees delivery and order, while UDP is faster and more efficient for real-time applications.
Discuss scenarios: choose TCP for applications requiring reliability (e.g., web, email, file transfer) and UDP for real-time, low-latency applications (e.g., VoIP, video streaming, gaming).
Explain how TCP uses sliding window and receiver advertisements to prevent overwhelming the receiver. Mention that it ensures the sender doesn't send more data than the receiver can handle.
Explain algorithms like slow start, congestion avoidance, fast retransmit, and fast recovery. Mention how TCP adjusts sending rate based on network congestion to avoid collapse.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Classic question but the scope is massive.
Structure your answer as a clear, layered narrative that follows the request from the browser through DNS, TCP/TLS, HTTP, server processing, and rendering. Emphasize the key decision points and protocols at each stage, and connect them to broader system design and integration concerns relevant to a financial institution like Citi.
Pro tip: Highlight security and performance considerations (e.g., HTTPS, caching, CDNs, load balancers) and tie them to Citi's need for reliable, low-latency, and secure systems. This shows you think beyond the textbook flow and understand enterprise constraints.
Explain how the browser parses the URL, checks its cache, and resolves the domain to an IP address via DNS (recursive resolver, root, TLD, authoritative). Mention DNS caching and TTL.
Describe TCP three-way handshake, TLS handshake for HTTPS, and then the HTTP request being sent. Include details like HTTP methods, headers, and cookies.
Cover how the request reaches the server (load balancer, reverse proxy, application server), how it's processed (API calls, database queries), and the HTTP response (status code, headers, body).
Explain how the browser parses HTML, builds the DOM, fetches subresources (CSS, JS, images), constructs the CSSOM, and renders via layout, paint, and composite.
Mention browser caching, service workers, and how subsequent requests may be served from cache. Also note performance metrics like First Contentful Paint and Time to Interactive.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.