Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Solaris 11 Advanced Administration Cookbook.docx
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
3 Мб
Скачать
☆

2014 May 4 19:25:10, load average: 0.38, 0.30, 0.28 syscalls: 12648

PROCESS COUNT

isapython2.6 20

sendmail 20

dhcpd 24

httpd.worker 30

updatemanagernot 40

nautilus 42

xscreensaver 50

tput 59

gnome-settings-d metacity

62

75

Chapter 8

VBoxService

81

ksh93

118

clear

163

poold

201

pkg.depotd

615

VBoxClient

781

java

1249

gnome-terminal

2224

dtrace

2712

Xorg

3965

An overview of the recipe

You learned how to monitor processes using several tools such as prstat, ps, and dtrace. Furthermore, you saw several commands that explain how to control and analyze a process.

Managing processes' priority on Solaris 11

Oracle Solaris 11 allows us to change the priority of processes using the priocntl command

either during the start of the process or after the process is run.

Getting ready

This recipe requires a virtual machine (VirtualBox or VMware) running Oracle Solaris 11 with 2 GB RAM at least. It is recommended that the system have more than one processor or core.

How to do it…

In the Introduction section, we talked about scheduling classes and this time, we will see more information on this subject. To begin, list the existing and active classes by executing the following command:

root@solaris11-1:~# priocntl -l

CONFIGURED CLASSES

==================

SYS (System Class)

Administering and Monitoring Processes

TS (Time Sharing)

Configured TS User Priority Range: -60 through 60 SDC (System Duty-Cycle Class)

FSS (Fair Share)

Configured FSS User Priority Range: -60 through 60

FX (Fixed priority)

Configured FX User Priority Range: 0 through 60

IA (Interactive)

Configured IA User Priority Range: -60 through 60

RT (Real Time)

Configured RT User Priority Range: 0 through 59

When handling priorities, which we learned in this chapter, only the positive part is important and we need to take care because the values shown in the previous output have their own class as the reference. Thus, they are not absolute values.

To show a simple example, start a process with a determined class (FX) and priority (55) by executing the following commands:

root@solaris11-1:~# priocntl -e -c FX -m 60 -p 55 gcalctool

root@solaris11-1:~# ps -efcl | grep gcalctool

0 S

pts/1

root 2660 2646 FX

0:01 gcalctool

55

?

33241

? 04:48:52

0 S pts/2

root 2664 2661 FSS

0:00 grep gcalctool

22

?

2149

? 04:50:09

As can be seen previously, the process is using exactly the class and priority that we have chosen. Moreover, it is appropriate to explain some options such as -e (to execute a specified command), -c (to set the class), -p (the chosen priority inside the class), and -m (the maximum limit that the priority of a process can be raised to).

Chapter 8

The next exercise is to change the process priority after it starts. For example, by executing the following command, the top tool will be executed in the FX class with an assigned priority equal to 40, as shown in the following command:

root@solaris11-1:~# priocntl -e -c FX -m 60 -p 40 top

root@solaris11-1:~# ps -efcl | grep top

0 S

pts/3

root 2662 2649

0:00 top

FX

40

?

1112

?

05:16:21

0 S pts/2

root 2664 2606

0:00 grep top

IA

33

?

2149

?

05:16:28

Then, to change the priority that is running, execute the following command:

root@solaris11-1:~# priocntl -s -p 50 2662

root@solaris11-1:~# ps -efcl | grep top

0 S pts/3

root 2662 2649

0:00 top

FX

50

?

1112

?

05:16:21

0 S pts/2

root 2667 2606

0:00 grep top

IA

55

?

2149

?

05:17:00

This is perfect! The -s option is used to change the priorities' parameters, and the –p option

assigns the new priority to the process.

If we tried to use the TS class, the results would not have been the same because this test system does not have a serious load (it's almost idle) and in this case, the priority would be raised automatically to around 59.

An overview of the recipe

You learned how to configure a process class as well as change the process priority at the start and during its execution using the priocntl command.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]