On May 28, 2018, at 3:35 AM, Rowan Worth <row...@dug.com> wrote: > > On 28 May 2018 at 17:29, x <tam118...@hotmail.com> wrote: > >> I’ve just discovered the thread in the original app decreases the >> available memory by around 4 GB. Are they really that expensive? > > A thread itself is not expensive in terms of memory.
If you keep to ~1 thread per CPU core, then yes, threads are cheap. However, some people advocate strategies like 1 thread per TCP connection in a networked server, so that if each thread takes 2 MiB for a stack and assorted other small bits of RAM for thread-local storage and such, you’ve limited yourself to under 2000 TCP connections on a 32-bit OS because you run out of addressable VM beyond that with a typical 2/2 GiB OS/userland split. This is why you see so many languages and application frameworks moving to post-thread models, generically under the “green threads” umbrella: Erlang’s processes, Go’s goroutines, F#’s async mechanism, etc. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users