Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 13 Study Guide 427

19.While using the top command, an administrator notices that an unidentified process is using up all CPU and memory. The administrator suspects that this is a programmer’s process that has run away. What should be done to fix the problem?

A.Nothing, the process will eventually terminate

B.The process should be killed before the system crashes

C.The user should be notified

D.Add more memory to the server

20.What command can an administrator use to track real-time information on processes and the resources that they are using?

A.top

B.ps -ef

C.ps -aux | grep root

D.fg

Scenarios

1.A user has requested that the Apache Web server be restarted so that its configuration can be changed and enabled. What steps should be taken to ensure that all httpd services are restarted properly?

2.A programmer with username jsmith has told you that one of her processes seems to be locked up and can’t be killed. The programmer is worried that a bug in the code may quickly use up all CPU and RAM resources on the server. What steps should be taken to track down the process and terminate it?

Lab Exercises

Lab 13-1 Process Management

The objective for this hands-on lab is to gain experience in using the ps and kill commands to manage processes. You should be able to use any default Linux installation for this exercise.

1.Logged in as a normal user, check your current running processes using just the ps command with no arguments.

2.Now, check all processes by using the ps -e command.

428 Chapter 13 Study Guide

3.Get a full list of information, such as the PPID, by using the ps -ef command.

4.Switch to the root user by using the su command, and check your running processes by using the ps command. As you can see, the root user owns most of the processes.

5.Look for the entry for the crond process, and take note of its PID.

6. At your command prompt, type kill -9 [PID of crond].

7.If you list all the processes again by using ps -e, you should see that crond is now no longer running.

8.To restart the crond process, at the command prompt, type /etc/rc.d/ init.d/crond start.

9.To verify that it is running again, at the command prompt type ps -ef | grep crond.

Lab 13-2 Stopping and restarting jobs

The objective for this lab is to take a simple job process and practice stopping, starting, and sending the process between the foreground and background.

1.Logged in as a normal user, at the command prompt, type yes. This command runs the yes program, which simply displays the letter “y” repeatedly. This is useful for programs in which you want to answer “yes” to all questions that you are prompted for.

2.Press [ctrl-c] to stop the job.

3.Type yes > /dev/null.

This runs the process, but points the output to a null device so that it won’t appear on the monitor display.

4.At this point, you won’t be able to get to your shell because the yes command is running in the foreground. Hit [ctrl-c] to stop the process.

5.Start the same program in the background by typing the command yes >

/dev/null &.

6.After the program starts up again, it is running in the background so you can still use your shell prompt.

7.Return the program to the foreground by using the fg command.

8.Again, you have lost the shell, so return the program to the background by using [ctrl-z] to suspend the program, and then type bg to start the process again in the background.

Соседние файлы в предмете Операционные системы