Suppose that you accidentally executed an infinite-loop program, but no longer have access to the command line / terminal from which you ran the program. Upon opening another terminal, you type command 'ps a' and see this: PID TTY STAT TIME COMMAND 9551 pts/1 Ss 0:00 -tcsh 9575 pts/0 S+ 0:00 ./a.out 9577 pts/1 R+ 0:00 ps a What exact command should you type to stop execution of the infinite-loop program?

Respuesta :

Answer:

1. Press "Ctrl+c" at the same time

2. Add a & to the command line

3. Press "Ctrl + z"

Explanation:

When your program enters an infinite loop, one way to stop it is to press the control key, at the same time you also press the alphabet C.

"Ctrl + C" where C represents Cancel.

Another way is by adding an ampersand sign (&) at the end of the command line.

Lastly, instead of killing the process, you can put it in a stopped state by pressing Ctrl + Z and then type letters b and g together (bg) to make the program continue running in background.