It just happens that in threads, there is this magical place called stack that you can SUPER fast allocate memory for new function frame. If you have a complex program that uses many deep very deep calls to functions withing functions within functions, you dont need to deal with register allocation or even "local stack frame" for local variables allocations. You just zip in and zip out of the "thread" stack all the time, millions times per second.
The disadvantage is that if for whatever reason a deeply nested thing needs to do _something_, typically I/O, then there is no easy way to yield and allow someone else to use ALU. One option is to change stack register to some other stack and continue other stream of compute. This done by OS is called a context switch.
However, for certain problems, there is an alternative - async. In async the "stack" for local variables is more explicit, very often on the heap, and is managed differently. Every time you are calling a nested function it also needs to store the local variables somewhere, so either you emulate stack somehow (in which case this is not much differnet than normal thread) or allocate the nested function local variables space using memory allocator on heap or special memory.
This is great beause it allows you to reduce the cost of a context switch - now you don't need to change the stack pointer and save context, becasue context is by definition saved in the async block. Asnc also allows you to NOT overcommit on stack size for some future deep deep nested fucntion calls that might never happen. In async you know exactly where you can yield and can plan for it.
However it's not like these two models are fundamentally different. It's the same problem of "where the local variables live" and "how to allocate this memory". We have far bigger problem - due to historical reasons "blocking" is a thing, but this is is only because we made mistakes designing operating systems (I'm looking at you fsync, open, close, or even bpf() syscalls).
1. The decision of when to switch routines is more consequential than the cost of stack or context switching. Letting the OS decide results in behavior that is consistently fair for all programs, caveat scheduler bugs. Letting user code decide results in behavior that is only as fair as a given program. Writing code in the latter environment entails wrestling with the reality that it may not run to completion unless other code in the environment lets it. That applies in async programming to a much wider range of situations than kill signals/aborts, which are the only even slightly analogous things in threaded programming.
2. Async is a subset of threaded programming (it has a hardware stack, and can call typical context-switchful code if it wants to block).
On the other side, it's similar: blocking + preemptive multitasking (or no multitasking) are nearly always paired. Unless you wanna split hairs and say e.g. "because Golang and BEAM sometimes use singleton IO multiplexers under the hood, that makes them 'async'", which is not a useful or typically-understood description of the term. This is true in multi-process, multi-thread, and (I'd argue) many multi-actor systems as well.
I think the useful distinction around async-or-not is whether the language semantics distinguish yield/resume points or not. Like, I don't have to care if syscalls/time slices/whatever are the preemption points, but if I'm writing async code, the async boundaries are very important because they're potentially task switching boundaries.
Or are we using incompatible definitions of these terms?
You also have the Golang model, where they use threads but they took care to make the threads very lightweight.
Exactly. Even "super fast stack allocation" Vs explicit stack frame is not such a defining characteristic. There are languages that look sequential but where each "stack[1]" frame is dynamically allocated and you can get async behaviour for "free". But the allocator is a stack and you get performance comparable to a more classical language.
At the end of the day, the main difference between the two paradigms is whether continuations are visible at the surface syntax level or not: they painfully are when writing CPS code by hand, they are partially hidden in languages with explicit async syntax and completely hidden in languages that look sequential.
[1] in quotes because function invocation does not need to respect a strict LIFO stack discipline.
On modern CPUs, which have many hardware threads, the operating system and the user programs must handle at least the number of hardware threads, e.g. 32 threads on an AMD 9950X.
Implementing more threads than the hardware threads is optional, but the hardware threads must have their own states and stacks and if they exchange messages the inter-thread messages must pass through message queues located in shared memory and using algorithms that enable concurrent accesses.
Naive implementations of message queues can use locks for mutual exclusion, but better implementations exploit the fact that message queues, like also arrays, can be dynamically partitioned using atomic fetch-and-add instructions, so that many threads can access concurrently a message queue, without using either mutual exclusion or optimistic accesses (which may need retries).
It is possible to have an operating system where there exists no shared state between threads, with the exception of the shared message queues.
Because message queues can be implemented without the need for mutual exclusion, it is possible to have an operating system where mutual exclusion (i.e. locks) is not used anywhere.
Whether an operating system without shared state between threads can have a performance comparable with e.g. Linux or Windows, is an open problem.
The lack of shared state does not mean that superfluous copies are needed. The messages may contain pointers to buffers in shared memory through which the bulk of the data is transferred between threads, but those buffers always have a current owner, i.e. the receiver of the message, and no other thread attempts to access them, including the sender of the message, which has written the buffer before sending the message.