Open a terminal window and login to Student user profile. 1. Here, we shift to e
ID: 3733893 • Letter: O
Question
Open a terminal window and login to Student user profile.
1. Here, we shift to examining running processes in our terminal window.
Open a second terminal window by typing gnome-terminal. Notice that both
windows are equally accessible. To close a terminal, type exit or control+d, or click on the X in the upper right hand corner or select Close TerminalfromtheFilemenu. Closethesecondwindow(leavethefirst window open). Another type of window is called an xterm. Type xterm. [If xterm doesn’t exist in your bash, you need to install it first. Check the xterm installprocessgivenbelow]Returntoyouroriginalterminalwindow. What happens when you attempt to use that terminal window? Close the xterm window (exit or control-d). Can you access your original terminal window?
Follow the process of installing xterm:
su
password:
yum install xterm
[If you get the message that “another app is currently holding the yum lock”, then you need to run 2 extra commands before yum install command:
systemctl stop packagekit
systemctl disable packagekit
yum install xterm
Then exit root.
Again, open an xterm window. In your original window, type control+z. This suspends the current running process (xterm). What message do you receive in your original window? Attempt to use the xterm window. What happens?
In your original terminal window, type jobs which shows you the running or stopped processes launched from that window. Type man jobs. While the man page is listed, type control+z to suspend this as well. Type top and once it starts to run, type control+z to suspend it (we will examine top later in this lab). Type jobs. What is displayed? To resume any of these jobs, type fg # where # is the job number as shown in the jobs listing(This is not the PID). The command fg without a number will resume the job that has a + next to it (the most recently run job). Resume the man job. How did you do this? Type q to exit man. Type jobs. What is displayed now? Type fg 1 to resume xterm. Type control+z to suspend it again. Type jobs. Which job now has the +? The – indicates the second most active job. Type fg. Which job resumed? Type control+c, which will exit this job. What happened? Type fg. What job resumed? Type q to quit this program. Type jobs, you should see nothing.
We can launch it into the background by adding & after the instruction which will free your terminal window. Type xterm &. How does this differ from entering xterm without &? Inthextermwindowtypemanxtermandreadaboutxterms(ifdesired). Returntoyour original terminal window and type find ~ -empty &. The find process ends, but you do not receive a prompt. Hit <enter>. What is displayed?
With one xterm still running, in your original terminal window type xterm to start a second xterm and control+z to suspend it. Type jobs. How do the two listings of the xterm jobs differ from each other? Type fg to resume the stopped xterm job and exit out of xterm. Type jobs again. What do the words “Running” and “Stopped” mean in the jobs output? Exit any remaining xterm windows. In your original window, type jobs again. What is output?
From the Applications menu, start a couple of GUI processes (for instance, Text Editor, Calculator). In your terminal window, type jobs. What is displayed? Why do you not see information on the two GUI processes? Close your GUI processes.
In your terminal window, type xterm, man jobs and top control+z to suspend each (do not use &). Type jobs, all three should be listed as stopped. Type bg xterm. What happens? Type jobs. Has xterm’s status changed? If so, how? The bg command moves a process into the background to continue running. Notice xterm’s status is listed as xterm &, we can access it at the same time as our terminal window. Exit xterm, resume and exit each of man and top.
2. Monitoring processes
Type top. Notice that the display stays in the window but changes every few seconds.
What is the %CPU usage of top? Leave top running, and in a second terminal window launch the command find / -empty (ignore any messages that you receive while it is running). While find executes, look for find in top’s display. It moves around. Why is it moving? As it moves, what happens to its %CPU and %MEM values? After perhaps 30 seconds or a minute, find will end. Examine top. What happens to the find entry?
Another process listed in top is init with a PID of 1. Why does init have a PID of 1?
Start the GUI System Monitor program by selecting Applications -> System Tools->SystemMonitor. ClickontheProcessestab. Comparethistowhat you see in top. Compare the fields available in the System Monitor to those available in top. What fields differ (if any)? Close this preferences window. Click on the Resources tab. Compare the information about CPU usage, memory and swap history as shown in the GUI to what top tells you. You can close the system monitor now (leave top running).
You interact with top by entering letters which are commands. Type u to change users and when prompted, enter Student. What are the top processes listed for Student?[Attach a screenshot] What is the smallest PID and the largest PID that you see in the top window? Type u and <enter> to reset top to showing all users. Type d to change the refresh duration from the default (3 seconds) and type 0.5 <enter>. Notice how quickly top changes. You should see the top process change quickly. Type d 3 <enter> to reset
it. Type q to exit top.
Priorities
a. In one terminal window, type top. In the other window, su to root and then type nice
–n -20 find / -empty. Watch find’s progress in top. What are its priority and NI
(nice) values? Exit as root.
b. Make a note of top’s PID. In the other window, type renice –n 10 –p PID where
PID is top’s PID. What response did you get?
Killing processes
Open an xterm in the background (xterm &). Type ps u to obtain the PID of xterm.
Enter the command kill –s 9 PID where PID is the PID of xterm. What happens? (look at your other terminal window, does your prompt appear? If so, where is it?)? Restart xterm, obtain its PID and kill it using –s 1. What happens? Increase the signal until the xterm ends. What signal is needed to kill it? Why did –s 9 kill it but not 1?
The killall command can be used to kill multiple processes. Launch two xterm & processes. Enter the command killall xterm. What happens? Open two more xterm &processes. Typekillall–ixterm. Whatisthedifference?
Explanation / Answer
1] As Per Given in Question When I Open the gnome-terminal and By that terminal I open New gnome- terminal. I observed that when we open New gnome-terminal from old gnome-terminal , we can use new terminal as well as old terminal simutaniously.
when we open Xterm from gnome-terminal , we can use Xterm but we can't use gnome due to Xterm's running process but gnome-terminal keep the queue of job We given To gnome-terminal when we using xterm. after exiting the xterm gnome-terminal executes jobs which are in queue.
when we Run Xterm and press ctrl-z it will create Zombie Process (a Zombie process is a process which has completed execution (by system call) but still has an entry in the process table . it is a process in the "Terminated state".) Of Xterm program. and It show the Response in original window as
[1]+ Stopped xterm
[1] Stopped xterm
[2]- Stopped man jobs
[3]+ Stopped top
letest job have []+ in Jobs Response we can get back defunct process by fg jobs_number as "fg 1" or fg which get back letest process in LIFO(last in first out) shown by +.
find ~ -empty & finds all empty file. inspite of pressing ctrl-c ctrl-z it does not stops till all empty file list completes.
In the jobs response Running means perticular instance of program is running.
and Stopped means perticular instance of program is stopped/suspended for a while.
when no process is defunct or running then jobs prints nothing .
when we open gui application from GUI (other than) terminal then it doesnot lists under jobs .there is another process in background which runs the GUI.
when We type bg Xterm after Ctrl-Z for xterm It starts the xterm process in background and we can use gnome-terminal now it also changes the status of xterm as running.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.