Chapter 21 Flashcards

Optimizing Performance

1
Q

Explain how to view the status of applications running on the Linux system.

A

The ps and top commands display the status of applications running on the system. Both commands display the status of each application, whether it’s running, sleeping, or waiting for resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain how you would find what applications are using the most resources on your system.

A

The top command allows you to monitor the applications running on the Linux system in real time. It displays the amount of CPU and memory each application is consuming and allows you to sort the display on any of the displayed data fields. This allows you to easily monitor which applications are using the most CPU time or the most memory at any given moment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three types of option styles available for the ps command? (Choose three.)

BSD style
Linux style
Unix style
GNU style
Numeric style
A

A, C, D. The GNU ps command in Linux supports parameters that were supported by the legacy BSD and Unix ps command, along with new options created by GNU, so options A, C, and D are correct. There are no Linux style options used by the ps command, so option B is incorrect. The ps command doesn’t support numeric options, so option E is also incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe how you can stop an application that’s causing problems on the Linux system.

A

Linux applications are programmed to respond to Linux signals. The kill command allows you to send Linux signals to running applications. If you send a KILL signal to an application, it will stop running on the system. Alternatively, you can send an INT signal to interrupt the application, allowing you to close it down gracefully if the application responds. The pkill application allows you to send Linux signals to applications based on their process name and lets you specify the process name using wildcard characters. This combination can come in handy if you need to stop multiple applications spawned from a single parent application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you identify the legacy Unix style options for the ps command?

Use a double dash in front of the option.
Use a single dash in front of the option.
Do not place a dash in front of the option.
Unix-style options are numerical.
Unix-style options use hexadecimal numbers.
A

B. The Unix style command-line options for the GNU ps command are identified by placing a single dash in front of the option, so option B is correct. The newer GNU options are identified by using a double dash, so option A is incorrect. The legacy BSD style options are identified by not placing anything in front of the option letter, so option C is incorrect. Unix style options still use letters, not decimal or hexadecimal numbers, so options D and E are both incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

By default, if you specify no command-line options, what does the ps command display?

All processes running on the terminal
All active processes
All sleeping processes
All processes run by the current shell
All processes run by the current user
A

D. With no command-line options, the GNU ps command displays only processes run by the current shell, so option D is correct. To display all processes running on a specific terminal, you need to add the -t option, so option A is incorrect. To display all active processes, you must add the -A option, so option B is incorrect. To display the sleeping processes, you need to use the -ef option, so option C is incorrect. To display all processes run by the current user account, you need to add the -x option, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Charles noticed that his Linux system is running slow and needs to find out what application is causing the problem. What tool should he use to show the current CPU utilization of all the processes running on his system?

top
ps
lsof
pkill
kill
A

A. The top command displays the currently running processes on the system and updates every 3 seconds, so option A is correct. The ps command displays currently running processes but doesn’t update in real time, so option B is incorrect. The lsof command displays files currently opened by processes but not the processes themselves, so option C is incorrect. The pkill and kill commands are used to stop running processes, not display them, so options D and E are both incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What top command displays cumulative CPU time instead of relative CPU time?

l
F
r
y
S
A

E. The S command displays the processes based on the cumulative CPU time for each process, so option E is correct. The l command displays the processes based on the load average, so option A is incorrect. The F command allows you to select the field used to sort the display, so option B is incorrect. The r command reverses the sort order of the display, so option C is incorrect. The y command highlights running tasks, so option D is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Shelly thinks that one of the applications on her Linux system is taking up too much physical memory and may have a problem. What column of data from the top display should she focus on?

VIRT
RES
SHR
S
%MEM
A

B. The RES column in the top output displays the amount of physical memory used by the applications, so option B is correct. The VIRT column displays the amount of virtual memory, not physical memory, so option A is incorrect. The SHR column displays the amount of shared memory used, so option C is incorrect. The S column displays the status of the application process, so option D is incorrect. The %MEM column displays the percentage of physical memory the application is using but not the amount of physical memory, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Jessica has an application that crunches lots of numbers and uses a lot of system resources. She wants to run the application with a lower priority so that it doesn’t interfere with other applications on the system. What tool should she use to start the application program?

renice
pkill
nice
kill
pgrep
A

C. The nice command allows you to specify the priority level for an application, so option C is correct. The renice command allows you to change the priority level of an application that’s already running, but not one that hasn’t started yet, so option A is incorrect. The pkill and kill commands are used to stop running processes, not change their priority levels, so options B and D are incorrect. The pgrep command displays the application processes matching a search term; it doesn’t change the priority level of the processes, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Jimmy noticed his Linux system was running slow. He ran the top command and found out that a data-intensive application was consuming most of the CPU time. He doesn’t want to kill the application but wants to give it a lower priority so that it doesn’t take up too much CPU time. What tool should he use to change the priority of the running application?

renice
pkill
nice
kill
pgrep
A

A. The renice command allows you to change the priority level assigned to an application that’s already running on the system, so option A is correct. The pkill and kill commands allow you to stop an application but not change the priority level, so options B and D are both incorrect. The nice command allows you to start an application with a specified priority level but not change the priority level of an application that’s already running, so option C is incorrect. The pgrep command allows you to search for a running application based on a search term but not change the priority level of it, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Hank needs to stop an application from running on his Linux system. He knows the name of the application file but not the process ID assigned to it. What tool can he use to stop the application?

renice
pkill
nice
kill
pgrep
A

B. The pkill command allows you to send a HUP signal to a running process based on a search term for the process name, so option B is correct. The renice command allows you to change the priority level of an application that’s already running but not stop it, so option A is incorrect. The nice command allows you to start an application at a specified priority level but not stop an application that’s already running, so option C is incorrect. The kill command allows you to stop an application that’s running, but you need to use the process ID number and not the name, so option D is incorrect. The pgrep command allows you to search for running applications based on their name but not stop them, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Frankie used the ps command to find the process ID of an application that he needs to stop. What command-line tool should he use to stop the application based on its process ID?

renice
pkill
nice
kill
pgrep
A

D. The kill command allows you to stop an application that’s already running by specifying its process ID, so option D is correct. The renice command allows you to change the priority level of an application but not stop it, so option A is incorrect. The pkill command allows you to stop an application, but by specifying its process name and not its process ID, so option B is incorrect. The nice command allows you to start an application using a specified priority level but not stop an application, so option C is incorrect. The pgrep command allows you to display running applications based on a search term for the application name but not stop them, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly