func main() {
for {
}
}➜ go build everRunningProgram.go➜ ./everRunningProgram &[1] 13745➜ top -b -n 1 -H -p 13745 top - 15:07:38 up 4:03, 1 user, load average: 0.63, 0.80, 0.72Threads: 5 total, 1 running, 4 sleeping, 0 stopped, 0 zombie%Cpu(s): 4.9 us, 1.1 sy, 0.3 ni, 93.2 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 stKiB Mem : 16301396 total, 4780820 free, 5033472 used, 6487104 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 10270784 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND13745 mani-86+ 25 5 101856 764 584 R 99.9 0.0 0:10.38 everRunningProg13746 mani-86+ 25 5 101856 764 584 S 0.0 0.0 0:00.00 everRunningProg13747 mani-86+ 25 5 101856 764 584 S 0.0 0.0 0:00.00 everRunningProg13748 mani-86+ 25 5 101856 764 584 S 0.0 0.0 0:00.00 everRunningProg13749 mani-86+ 25 5 101856 764 584 S 0.0 0.0 0:00.00 everRunningProgfn main() { loop {}}
➜ rustc everRunningProgram.rs➜ ./everRunningProgram &[2] 14265➜ top -b -n 1 -H -p 14265top - 15:11:36 up 4:07, 1 user, load average: 1.59, 1.29, 0.95Threads: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie%Cpu(s): 4.9 us, 1.1 sy, 0.5 ni, 93.0 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 stKiB Mem : 16301396 total, 4584980 free, 5132508 used, 6583908 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 10111372 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND14265 mani-86+ 25 5 13156 980 868 R 99.9 0.0 0:10.22 everRunningProg
C:
int main() { while(1);}
➜ cc everRunningProgram.c ➜ ./a.out & [3] 14413➜ top -b -n 1 -H -p 14413top - 15:14:34 up 4:10, 1 user, load average: 2.43, 1.81, 1.22Threads: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie%Cpu(s): 4.8 us, 1.1 sy, 0.8 ni, 92.7 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 stKiB Mem : 16301396 total, 4603696 free, 5098020 used, 6599680 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 10134048 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND14413 mani-86+ 25 5 4380 712 648 R 99.9 0.0 0:06.07 a.out
Python:
while True:
pass
➜ scripts python3 everRunningProgram.py &[4] 14587➜ scripts top -b -n 1 -H -p 14587 top - 15:16:35 up 4:12, 1 user, load average: 4.08, 2.62, 1.59Threads: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie%Cpu(s): 4.8 us, 1.1 sy, 1.1 ni, 92.5 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 stKiB Mem : 16301396 total, 4551664 free, 5146576 used, 6603156 buff/cacheKiB Swap: 0 total, 0 free, 0 used. 10082516 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND14587 mani-86+ 25 5 33056 8736 5472 R 99.9 0.1 0:06.63 python3
Is there any explanation for this behaviour on Go?
What's really happening behind the scenes?
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a15cf939-02cb-4c51-af20-f0109ffe63df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.