Java’s Daemon Threads and Their Roots in Ancient Greece

From Sokrates’ whispering spirit to a Victorian physics prank and into your Java code. Daemon threads have been working quietly in the background for over two millennia.

Why is it called daemon threads?

In Java, daemon threads are background workers that vanish when the main program ends. It’s a concept inherited from Unix. In Unix, daemon processes are detached background tasks that keep the system ticking, much like background services in Windows.

The word daemon is often confused with demon. Both share Greek origins, but a daimon in ancient Greece was a neutral or even benevolent divine spirit. Sokrates spoke of his personal daimonion that guided him away from mistakes. In monotheistic traditions, divine beings outside God often became recast as evil, giving us today’s demon.

Unix borrowed the term from MIT’s Multics project, which in turn was inspired by Maxwell’s famous thought experiment about a tiny being controlling heat flow. Lord Kelvin, yes, the Kelvin of temperature fame, dubbed this being a demon, drawing on the Greek meaning, and probably aware of Sokrates’ use of the word. Kelvin almost certainly wasn’t suggesting anything evil about Maxwell’s thought experiment.

From Greek spirit to Java thread — a daemon’s job has always been to work unseen.


All #ai #art #clojure #csharp #data-structures #database #datomic #emacs #fortran #fsharp #functional #gpt #haskell #history #immutability #java #jit #jmm #lambdas #lisp #pioneers #poetry #programming #programming-philosophy #randomness #rant #reducers #repl #smalltalk #sql #threads #unix #women