Kacam.net

Observe the world

Interview drills: one stock question, five layers down

The prompt is the exact sentence an interviewer opens with — "what's the difference between a process and a thread", "TCP versus UDP". The textbook definition isn't the finish line, it's the start: it records the version you already have memorised, drags you down five layers, then makes you say it again in sixty seconds.

These prompts only exist in 简体中文 for now.

How to use this

This set interrogates rather than teaches. It is a mock interview: running out of answers is a normal outcome, and it will not cover for you or finish your sentence when you trail off. If you want to understand a topic rather than rehearse for an interview, go to Computer systems, Databases or Algorithms — those guide you instead.

How one stock question fills forty minutes: the five-layer ladder

  • L1 · Definition — what each term means, list the differences. Can't answer: you never learned it.
  • L2 · Mechanism — which structure, which step actually produces that difference. Can't answer: you memorised the conclusion only.
  • L3 · Numbers — by how much? How many microseconds, how many times, how many I/Os. Can't answer: you've never done it hands-on.
  • L4 · Choice — given a concrete scenario, which one, at what cost, and when is that choice wrong. Can't answer: you can't apply it.
  • L5 · Limits — under what conditions does everything you just said stop holding. Can't answer: you know it all, but you don't really understand it.

The bar: L4 is what passes an interview, L5 is what counts as really understanding it, and anything that stops at L1 is recorded as memorised.

Six scenes — the first and last are unique to this set

  • In scene one it does not interrupt, comment or hint. You deliver the version you already have, start to finish, and it records that as your baseline. The silence is deliberate — it is listening, it just isn't correcting you yet.
  • The middle four scenes work down the ladder; scene three, mechanism and numbers, is the main battleground.
  • The last scene puts sixty seconds on the clock and makes you deliver it again, side by side with your opening version — because what an interview asks you to hand over isn't "I understand it", it's a sentence you can actually say out loud.

How to start

  1. Pick one, open it, copy the prompt.
  2. Paste it into a brand-new conversation, say nothing, and wait for its first question.
  3. Then answer like you would in an interview: deliver your memorised version in one go. It's fine if it's rough — that's the baseline it compares against at the end.
  4. After that it starts pressing. Running out of answers is a normal outcome: this isn't study material, it's a mock interview.

Five commands you can call out at any time

  • 跳过 move to the next scene now
  • 提示 give me a hint, not the answer
  • 直说吧 spell the full answer out
  • 重讲 jump straight to the last scene, re-record the sixty-second version and compare it with the opening one
  • 复盘 jump to the wrap-up and print the review card

Three traps

  • The prompt you copy has the answer key at the end — don't read it first. One of its columns is the "recital fingerprints": the exact sentences you're most likely to blurt out. Read them and there's nothing left to drill.
  • Don't hand over adjectives where a number belongs. "Much faster", "barely any overhead" — it stops you and asks for the figure. A conclusion you can't put an order of magnitude on is recorded as memorised.
  • The last two groups are language-bound: do the Java group if you write Java, the Go group if you write Go. They are not translations of each other — each picks its own questions — so there's no need to do both.

Interviewing for a backend role next week? Take process versus thread, TCP versus UDP, why B+ trees, isolation levels, the three cache failure modes, and idempotency — the six most frequent, with almost no overlap. Been hammered in interviews and want to find the gaps? Start with "from URL to rendered page": it exposes every weak spot horizontally, and you can pick your next ones from what it turns up.

Operating systems and concurrency

进程和线程的区别
「进程是资源分配的最小单位,线程是 CPU 调度的最小单位」—— 然后呢?
★★★☆☆ · about 45 min
同步、异步、阻塞、非阻塞
「同步就是要等,异步就是不用等」—— 这句说完,问题才刚开始。
★★★★☆ · about 40 min
select、poll、epoll 的区别
「select 有 1024 限制、epoll 是 O(1)」—— 两句都对,但都不是答案。
★★★★☆ · about 40 min
死锁:怎么产生、怎么破、怎么查
四个条件背得滚瓜烂熟 —— 那你们代码里真的破了哪一条?
★★★☆☆ · about 40 min
乐观锁和悲观锁
「乐观锁假设不会冲突」—— 那你说得出你们那张表的冲突率吗?
★★★☆☆ · about 35 min
线程池的参数怎么定、满了会怎样
参数表说得出来的人很多,说得出这几个参数谁先谁后的很少。
★★★☆☆ · about 40 min

Networking

TCP 和 UDP 的区别
「TCP 可靠、UDP 不可靠」—— 那「可靠」到底承诺了什么?
★★★☆☆ · about 40 min
三次握手为什么不是两次、TIME_WAIT 为什么是 2MSL
「三次是为了确认双方收发能力正常」—— 举一个两次会出事的例子。
★★★★☆ · about 40 min
HTTPS 凭什么安全(TLS 握手)
「HTTP + SSL,用非对称加密」—— 那你的数据是非对称加密的吗?
★★★★☆ · about 45 min
从输入 URL 到页面出来
全系列最长的一道。它会在你讲到一半时打断你 —— 这才是真实的面试。
★★★★☆ · about 50 min
HTTP/1.1、2、3 的区别
「HTTP/2 有多路复用所以更快」—— 那它把队头阻塞解决干净了吗?
★★★★☆ · about 40 min
Cookie、Session、Token、JWT
「token 存客户端所以更好扩展」—— 那你怎么让一个 token 立刻失效?
★★★☆☆ · about 40 min
四层和七层负载均衡
「四层快、七层功能多」—— 差别其实只有一条,你说得出是哪条吗?
★★★☆☆ · about 35 min

Databases

为什么索引用 B+ 树,不用哈希、B 树、跳表
「B+ 树效率高、适合范围查询」—— 那为什么不是哈希、B 树、跳表?
★★★★☆ · about 40 min
四种隔离级别、幻读到底是什么
「可重复读解决了幻读」—— 真的解决干净了吗?给个反例。
★★★★☆ · about 40 min
MVCC 是怎么实现的
「多版本,读不加锁」—— 那「多版本」具体存在哪儿?
★★★★☆ · about 40 min
redo log、undo log、binlog 和两阶段提交
全系列最难的几道之一:崩溃恰好发生在那一瞬间,数据还对得上吗?
★★★★★ · about 45 min
分库分表之后,你失去了什么
「数据量大了就分库分表」—— 分完之后,你失去了什么?
★★★★☆ · about 40 min

Caching and messaging

Redis 为什么快、「单线程」指的是哪一部分
「基于内存、单线程、多路复用,所以快」—— 那「单线程」指的是哪一部分?
★★★☆☆ · about 40 min
缓存穿透、击穿、雪崩
穿透、击穿、雪崩 —— 先别说方案,说清你指的是哪一种。
★★★☆☆ · about 35 min
缓存和数据库怎么保持一致
「先更新数据库再删缓存」—— 那这套做法的反例长什么样?
★★★★☆ · about 40 min
RDB、AOF 和主从复制
「有持久化也有主从,所以不会丢」—— 那主库挂掉那一刻呢?
★★★★☆ · about 40 min
分布式锁怎么做才对
「setnx 加个过期时间就行」—— 然后它会一个一个坑问过来。
★★★★☆ · about 40 min
消息怎么做到不丢不重
「生产确认 + 持久化 + 手动 ACK,就不丢不重了」—— 真的吗?
★★★★☆ · about 40 min

Distributed systems

CAP 和 BASE
「三个里只能选两个」—— 那你真的有得选吗?
★★★★☆ · about 35 min
分布式事务几种方案怎么选
全系列最难的几道之一。先证明你真的需要它。
★★★★★ · about 45 min
分布式 ID 怎么生成
「雪花算法:时间戳 + 机器号 + 序列号」—— 那机器号谁给你分?
★★★☆☆ · about 35 min
限流:三种算法和真实部署
三种算法都说得出来 —— 那你那个阈值是怎么定的?
★★★★☆ · about 40 min
幂等怎么设计
「加张去重表判断一下」—— 先说清:谁在重复,多久内算重复?
★★★★☆ · about 35 min
熔断、降级、隔离
「熔断降级保证稳定」—— 熔断打开那一刻,用户看到的是什么?
★★★☆☆ · about 35 min

Java and the JVM

Java 是值传递还是引用传递
「基本类型值传递、对象引用传递」—— 这是一个错误答案。
★★★☆☆ · about 35 min
JVM 内存区域,一个对象的一生
区域图谁都会画 —— 那跟着一个对象走一遍呢?
★★★★☆ · about 40 min
GC 怎么判断垃圾、一次 Full GC 意味着什么
全系列最难的几道之一:你线上一次 Full GC 停多久、上次是什么触发的?
★★★★★ · about 45 min
HashMap 的原理、它的线程不安全表现在哪
「数组 + 链表 + 红黑树,负载因子 0.75」—— 那容量为什么必须是 2 的幂?
★★★★☆ · about 40 min
synchronized 和 Lock、锁升级四个状态
锁升级四个状态背得出来 —— 那每一级到底省了哪一笔开销?
★★★★☆ · about 40 min
OOM 和内存泄漏怎么定位
「dump 下来用工具看一下」—— 先说清,它报的是哪一种 OOM?
★★★★☆ · about 40 min

Go and its runtime

GMP 调度模型
「G 是协程、M 是线程、P 是处理器」—— 那为什么非要有 P?
★★★★☆ · about 40 min
channel 的底层和 select
「无缓冲 channel 会阻塞」—— 它是一个长度为 0 的队列吗?
★★★★☆ · about 40 min
slice 和 map 的那些坑
「slice 是动态数组」—— 那把它传进函数改一下,外面看得见吗?
★★★★☆ · about 40 min
defer、panic、recover
「defer 延迟执行、后进先出」—— 那它的参数是什么时候求值的?
★★★★☆ · about 35 min
逃逸分析:这个变量在栈上还是堆上
「返回局部变量的指针就会逃逸」—— 那判据到底是什么?
★★★☆☆ · about 35 min
Go 的 GC 和 STW 到底停多久
全系列最难的几道之一:「STW 很短」—— 短到多少,停在哪两处?
★★★★★ · about 40 min
These prompts are open source They live in the public kacam-net/hero-prompts repo. If one of them doesn't press hard enough, or its answer key is missing a line, go and change it — whether it ships here is a separate call, made by the catalogue on this side.