If you compile it to WebAssembly, it will works under the single thread model. However, there are still multi *goroutine *be created, it was designed to.
在2024年9月10日星期二 UTC+8 21:54:56<Karolina GORNA> 写道: > Hello, > > Maybe the question has already been asked, but I would be glad to have > your feedback. > > *Can a golang program be compiled to run with only one goroutine, or at > least one "OS thread" ?* > > I am aware of using GOMAXPROCS(1) to have only one "OS thread" or to use > taskset > -c 1 go build . to force having one "OS thread". These commands don't > really work in practice, since with trace execution tools, I can see that > many threads are used during the execution at the end. > > Thank you for your help, > Karolina > ------------------------------ > Les informations contenues dans ce message électronique ainsi que celles > contenues dans les documents attachés sont strictement confidentielles et > sont destinées à l'usage exclusif du (des) destinataire(s) nommé(s). > Toute divulgation, distribution ou reproduction, même partielle, en est > strictement interdite sauf autorisation écrite et expresse de l’émetteur. > Si vous recevez ce message par erreur, veuillez le notifier immédiatement > à son émetteur par retour, et le détruire ainsi que tous les documents qui > y sont attachés. > > The information contained in this email and in any document enclosed is > strictly confidential and is intended solely for the use of the individual > or entity to which it is addressed. > Partial or total disclosure, distribution or reproduction of its contents > is strictly prohibited unless expressly approved in writing by the sender. > If you have received this communication in error, please notify us > immediately by responding to this email, and then delete the message and > its attached files from your system. > ------------------------------ > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4a673bea-dd59-4f20-acb0-507b4d60059en%40googlegroups.com.