Forum Topic: Threading
Talk by Ivan Godard – December 5, 2017, at Facebook
This is the thirteenth topic publicly presented on the Mill general-purpose CPU architecture. It covers the methods used to manage threads on the Mill Architecture. The talk assumes some general familiarity with software threads.
Threading on the Mill CPU
The Mill is a new general-purpose CPU architectural family, with novel resource allocation and control facilities that are orders of magnitude more efficient than the equivalents on other CPUs. The Mill’s direct hardware support for threading is an important example.
Thread and process creation, preemption, and dispatch are heavyweight operations on conventional operating systems on conventional hardware. As a result, software systems and languages such as Go have been devised with lightweight cooperative threading. Unfortunately, all lightweight systems to date require mutual trust among the participants, and can suffer uncontrolled stalling when encountering kernel-level events such as page traps.
Spawning a thread, dispatching one for execution, idling it, killing it, and even such apparently unrelated facilities as setjmp/longjmp are all user-mode hardware operations on a Mill CPU, with performance comparable to a normal function call. The talk will describe in detail how this works, with examples from micro-kernel operating systems and concurrent languages like Go.