Both seem to mean "capital punishment" or "execution" or "death penalty". Is one a more specific word, maybe only used in legal contexts?
- 死刑 is "death penalty" or "capital punishment". It's a kind of punishment, and is something sentenced in court. 極刑 (literally "ultimate punishment") is an euphemistic synonym for this.
- 処刑 is "execution". It refers to the actual action of killing a criminal/prisoner using a gun, sword, drug, etc. It also works as a suru-verb, "to execute (a person)." 処刑 sounds a bit cruel, and (死刑の)執行 is preferred in legal contexts.