Go program running multiple processes

Hello,

I am running a Go program on Ubuntu server. But, when I run it runs multiple copies of same program spawning multiple processes (PIDs). I just compiled it and running using Ubuntu command line.

Please provide your guidance. I am not sure what I am doing wrong as the project is a simple http based web project.

Thanks

Are you sure these are multiple processes? The coloring (only one line is black, the other ones are green) indicate that these are different threads of the same process. If your screenshot shows output from htop, try hitting shift-H to show or hide user-space threads, or shift-K to show/hide kernel-space threads.

If these are indeed different processes, can you replicate this with any Go program? Or is it just a particular one that exposes the behavior?

In the latter case, is the source code short enough to post it here?

2 Likes

They are absolutely just different threads. Linux treats threads just like different processes, and that’s visible in top.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.