Agentic Research

Process

Also: 處理程序 · 行程 · pid · process id

A program while it runs: it owns its memory, has its own number (PID), and lives until it exits or is killed.

When you will meet it

"The tool hung", "the port is taken", "I closed the window but the API is still billing" — one answer covers all three mysteries: a process you believed dead is still alive. Knowing that a running program is a process with a PID lets you find it and end it, instead of rebooting. Running agents in the background assumes the same skill: is it still running, and how do I stop it?

An analogy

The recipe is the program; each cooking is a process. One recipe can have several pots going at once (processes of the same program), each with its own burner number (PID). If one pot burns, you take that burner off — you do not demolish the kitchen.

Minimal example

sleep 300 &        # 在背景啟動一個會跑五分鐘的處理程序(& 表示背景)
pgrep -l sleep     # 找出名叫 sleep 的處理程序和它的 PID
kill 12345         # 把 12345 換成上一行印出的 PID
pgrep -l sleep     # 沒有輸出=它已經結束

Next time a tool "freezes", ask first: which process is still alive? Activity Monitor (macOS) and Task Manager (Windows) are the graphical pgrep and kill; PowerShell offers Get-Process and Stop-Process.

What people get wrong

  • Assuming closing the terminal window kills everything inside it. Not guaranteed: background processes and self-detaching services keep running — along with their memory, their ports and their API bills.
  • Killing the wrong PID. Confirm with pgrep or ps what that number actually is; kill -9 is a forced termination that gives the program no chance to save or clean up — a last resort, not a first move.

Related terms

Next