← Bitkernel Interview Insights

Bitkernel·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Bitkernel had me do a technical phone screen for a software engineer role and the whole thing was basically a deep dive on TCP internals. Not what I expected going in.

Questions Asked (5)

Q1

During the TCP three-way handshake, which of the following is true: (A) the server enters SYN_SENT after waiting 2MSL on receiving the client's SYN, (B) the server enters SYN_RCVD after receiving the client's ACK, (C) the client can be in ESTABLISHED while the server is still in SYN_RCVD, or (D) if the server never gets the client's final ACK it closes the connection after 2MSL?

System DesignTechnical Trade-offs
Author's notes

I almost picked B because I was rushing and confused which segment triggers SYN_RCVD.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Evaluate each option by recalling the TCP state transitions during the three-way handshake, focusing on the exact sequence of messages and the resulting states. Eliminate incorrect options by identifying which states are entered at which points and the timers involved. Confirm the correct option by reasoning through a scenario where the client and server states can differ.

Pro tip: Mention that the client can be in ESTABLISHED after sending the final ACK, while the server remains in SYN_RCVD until it receives that ACK. This demonstrates a deep understanding of the handshake and the asymmetry in state transitions.

1. Recall the three-way handshake sequence

List the messages exchanged: client sends SYN, server responds with SYN-ACK, client sends ACK. Note the states each side enters after sending/receiving each message.

2. Analyze each option against the sequence

For each option, check if the described state transition or timer matches the standard TCP behavior. Eliminate options that contradict the sequence.

3. Focus on state asymmetry

Consider that the client and server can be in different states at the same time. Specifically, after the client sends the final ACK, it enters ESTABLISHED, while the server is still in SYN_RCVD until it receives that ACK.

4. Verify the correct option

Confirm that option (C) is correct by explaining the timing: the client sends ACK and immediately enters ESTABLISHED, but the server only enters ESTABLISHED upon receiving the ACK, so there is a brief period where the client is ESTABLISHED and the server is SYN_RCVD.

Key Points to Mention

  • TCP three-way handshake: SYN, SYN-ACK, ACK
  • State transitions: client: SYN_SENT -> ESTABLISHED; server: LISTEN -> SYN_RCVD -> ESTABLISHED
  • 2MSL wait occurs in TIME_WAIT state, not SYN_SENT or after SYN
  • Server enters SYN_RCVD after receiving SYN, not after ACK
  • If server does not receive final ACK, it retransmits SYN-ACK and eventually times out, but does not wait 2MSL
  • Asymmetry: client can be ESTABLISHED while server is still SYN_RCVD

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

If the client's final ACK in the three-way handshake is lost, what does the server actually do? Walk through the retransmission behavior and what eventually happens to that half-open connection.

System DesignTechnical Trade-offs
Author's notes

Blanked for a second on the exact retry behavior.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying that the server considers the connection established after sending its SYN-ACK, so a lost final ACK leaves the server in a half-open state. Then walk through the server's retransmission of the SYN-ACK with exponential backoff, and explain that after a timeout (e.g., tcp_synack_retries), the server aborts the connection and frees resources.

Pro tip: Mention that the server's retransmission behavior is controlled by kernel parameters like tcp_synack_retries and tcp_syn_retries, and that this scenario is a common vector for SYN flood attacks, so many systems use SYN cookies to mitigate it.

1. Clarify connection state

Explain that after sending SYN-ACK, the server moves to SYN_RCVD state and considers the connection half-open until the final ACK arrives.

2. Describe retransmission behavior

Detail that the server retransmits the SYN-ACK packet with exponential backoff, typically starting with a 1-second timeout and doubling each retry.

3. Specify retry limits and timeout

Mention that the number of retries is governed by tcp_synack_retries (default 5 on Linux), leading to a total timeout of about 63 seconds before the connection is aborted.

4. Explain eventual outcome

State that after exhausting retries, the server sends a RST and removes the half-open connection from its backlog, freeing resources.

5. Discuss implications and mitigations

Note that this behavior can be exploited for SYN flood attacks, and mention defenses like SYN cookies, increased backlog, or reduced retry limits.

Key Points to Mention

  • Server enters SYN_RCVD state after sending SYN-ACK.
  • Retransmission of SYN-ACK with exponential backoff.
  • tcp_synack_retries parameter controls number of retries (default 5 on Linux).
  • Total timeout before aborting is approximately 63 seconds.
  • Server sends RST and frees resources after timeout.
  • Potential for SYN flood attacks and mitigation via SYN cookies.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Why does the active closer wait in TIME_WAIT for 2MSL, and what two specific problems does that timer prevent?

System DesignTechnical Trade-offs
Author's notes

This one I actually knew.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining TIME_WAIT and its role in TCP connection termination, then explain why the active closer must wait 2MSL. Clearly state the two problems it prevents: ensuring the final ACK is received and preventing old duplicate segments from corrupting new connections.

Pro tip: Mention that TIME_WAIT also allows the passive closer to close gracefully, and that modern systems may use SO_REUSEADDR to mitigate port exhaustion, showing awareness of practical trade-offs.

1. Define TIME_WAIT and 2MSL

Explain that TIME_WAIT is a state the active closer enters after sending the final ACK, and it lasts for twice the Maximum Segment Lifetime (2MSL).

2. Problem 1: Reliable termination

Describe how the wait ensures the final ACK reaches the passive closer; if lost, the passive closer retransmits its FIN, and the active closer can resend the ACK.

3. Problem 2: Preventing old duplicates

Explain that waiting 2MSL ensures all old segments from the connection expire, preventing them from being misinterpreted in a new connection with the same port numbers.

4. Summarize and contextualize

Conclude by reiterating the two problems and mention that this is a fundamental TCP design trade-off for reliability.

Key Points to Mention

  • TIME_WAIT is entered by the side that initiates the connection close (active closer).
  • 2MSL ensures that any lost ACK can be retransmitted and received.
  • It prevents old duplicate segments from a previous connection from being accepted in a new connection.
  • MSL is the maximum time a segment can exist in the network.
  • The wait also allows the passive closer to receive the final ACK and close properly.
  • Without TIME_WAIT, new connections could receive stale data, leading to data corruption.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How does a SYN flood attack exploit the SYN_RCVD state, and how do SYN cookies let a server defend against it without storing per-connection state?

System DesignRoot Cause Analysis
Author's notes

The setup is straightforward: attacker sends tons of SYNs with spoofed source IPs, server allocates a half-open connection entry for each one and fills up its backlog queue.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the TCP three-way handshake and how the SYN_RCVD state is used to track half-open connections. Then describe how a SYN flood exhausts the backlog by sending many SYNs without completing the handshake, and finally explain how SYN cookies encode connection state in the sequence number to avoid storing per-connection state.

Pro tip: Mention that SYN cookies trade off some TCP options (like window scaling) and that modern servers often use a hybrid approach with backlog limits and SYN cookies as a fallback. This shows you understand real-world deployment nuances.

1. Explain the TCP handshake and SYN_RCVD state

Describe the normal three-way handshake: client sends SYN, server responds with SYN-ACK and moves to SYN_RCVD, client sends ACK. The server allocates resources (e.g., a backlog entry) to track this half-open connection.

2. Describe how SYN flood exploits SYN_RCVD

An attacker sends many SYN packets, often with spoofed source IPs, causing the server to allocate many half-open connections in SYN_RCVD. This exhausts the backlog queue, preventing legitimate connections from being accepted.

3. Introduce SYN cookies as a defense

SYN cookies avoid storing state by encoding connection parameters (like MSS, timestamp) into the initial sequence number (ISN) sent in the SYN-ACK. The server does not allocate a backlog entry until the final ACK is received.

4. Explain how SYN cookies work

When a SYN arrives, the server computes a cryptographic hash of the connection tuple (source/dest IP/port, time, secret) to generate the ISN. It sends this as the SYN-ACK sequence number. When the client's ACK returns, the server validates the cookie and reconstructs the connection state.

5. Discuss trade-offs and limitations

SYN cookies prevent state exhaustion but may lose TCP options (e.g., window scaling) and add computational overhead. They are often used only when the backlog is full, as a fallback mechanism.

Key Points to Mention

  • TCP three-way handshake and the role of SYN_RCVD state
  • Resource exhaustion via backlog queue in SYN flood attacks
  • Spoofed source IPs making SYN floods hard to trace
  • SYN cookie mechanism: encoding state in the ISN
  • Cryptographic hash for cookie generation and validation
  • Trade-offs: loss of TCP options, computational cost, hybrid deployment

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

In a simultaneous open where both peers send SYN at the same time before either receives the other's SYN, what state path do the endpoints follow?

System DesignTechnical Trade-offs
Author's notes

Didn't know this one well at all.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the simultaneous open scenario and the TCP state machine, then walk through the state transitions for both endpoints step by step, emphasizing the symmetry and the role of the SYN flag. Conclude by highlighting how this resolves to a normal connection and mention any practical implications.

Pro tip: Mention that simultaneous open is rare in practice but understanding it demonstrates deep TCP knowledge; also note that both endpoints transition through SYN-SENT, SYN-RECEIVED, and ESTABLISHED, and that the sequence numbers are synchronized via the SYN exchange.

1. Define the scenario

Explain that simultaneous open occurs when both peers send SYN packets at the same time, before receiving the other's SYN. This is a rare but valid TCP state transition.

2. Initial state

Both endpoints start in CLOSED state and then send a SYN, transitioning to SYN-SENT.

3. Receiving SYN

Each endpoint receives the other's SYN while in SYN-SENT. They respond with a SYN-ACK and transition to SYN-RECEIVED.

4. Receiving SYN-ACK

Each endpoint receives the SYN-ACK while in SYN-RECEIVED. They send an ACK and transition to ESTABLISHED.

5. Final state

Both endpoints reach ESTABLISHED, and the connection is fully open. The sequence numbers are synchronized.

Key Points to Mention

  • TCP state machine states: CLOSED, SYN-SENT, SYN-RECEIVED, ESTABLISHED
  • The role of SYN and SYN-ACK flags in connection establishment
  • Simultaneous open is rare but specified in RFC 793
  • Both endpoints follow the same state path: CLOSED -> SYN-SENT -> SYN-RECEIVED -> ESTABLISHED
  • Sequence number synchronization occurs via the exchange of SYN and SYN-ACK
  • Practical implications: firewalls and NAT may interfere, but TCP handles it correctly

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.