Home > Articles > Certification > Other IT

This chapter is from the book

Summary

This chapter described Solaris processes and the various Solaris utilities available to monitor them. Using commands such as ps, prstat, pargs, sdtprocess, and the SMC Process Tool, you can view all the attributes associated with a process. In addition, we described foreground and background jobs.

The concept of sending signals to a process was described. A signal is a message sent to a process to interrupt it and cause a response or action. You also learned how to send signals to processes to cause a response such as terminating a process.

Setting process priorities was described. We also described the concept of projects and tasks along with administrative commands used to administer them. The various commands, such as nice and priocntl, that are used to set and change process priorities were described. In addition, you learned how to use the crontab and at facilities. You can use these facilities to submit batch jobs and schedule processes to run when the system is less busy, to reduce the demand on resources such as the CPU and disks.

The system administrator needs to be aware of the processes that belong to each application. As users report problems, the system administrator can quickly locate the processes being used and look for irregularities. By keeping a close watch on system messages and processes, you'll become familiar with what is normal and what is abnormal. Don't wait for problems to happen—watch system messages and processes daily. Create shell scripts to watch processes for you and to look for irregularities in the system log files. By taking a proactive approach to system administration, you'll find problems before they affect the users.

In Chapter 6, "Managing the LP Print Service," we'll explore another topic that you'll need to become acquainted with—the LP Print Service, the facility responsible for printing within the Solaris environment.

Key Terms

  • at command
  • Process Manager GUI
  • Child process
  • cron
  • crontab
  • crontab file
  • mpstat
  • ptree
  • nice command
  • Parent process
  • pgrep command
  • preap command
  • priocntl command
  • Process
  • Project (as it relates to process management)
  • prstat command
  • ps command
  • Signals
  • SMC Job Scheduler
  • SMC Process Tool
  • time
  • Zombie process

Exercises

5.1 Displaying Process Information

In this exercise, you'll use the various utilities described in this chapter to display information about active processes.

Estimated time: 10 minutes

  1. Log in as root into the Java Desktop Environment or CDE.
  2. Open a new window and display the active processes using the ps command:

    # ps -ef
  3. Open another new window and display the active processes using the prstat command:

    # prstat

    Notice how the ps command took a snapshot of the active processes, but the prstat command continues to update its display.

  4. Type q to exit prstat.
  5. Display the dtlogin process and all of its child processes. First obtain the PID of the dtlogin process with the pgrep command:

    # pgrep dtlogin

    Now use the ptree command with the PID of the dtlogin process to display the ancestry tree:

    # ptree <PID from dtlogin>
  6. Now start the Process Manager.

    # sdtprocess &

    Notice how the window updates periodically.

  7. In the sample field at the top of the window, change the sample period from 30 to 5 seconds.
  8. Sort the processes by ID by clicking on the ID button in the header.

5.2 Using the Batch Process

In this exercise, you'll use crontab to configure a process to execute everyday at a specified time.

Estimated time: 10 minutes

  1. Log in as root into a Java Desktop or CDE session.
  2. Make sure your default shell editor is set to vi (EDITOR=vi;export EDITOR) before beginning this exercise.
  3. Open a new window and edit the crontab entry.

    # crontab -e
  4. Enter the following after the last line at the end of the file:

    0 11 * * * echo Hand in Timesheet > /dev/console
  5. Save and close the file.

    Open a console window and at 11:00 a.m., you'll see the message Hand in Timesheet displayed.

Exam Questions

  1. Which of the following commands finds all processes that have dt in the process argument string? Choose all that apply.

    circle.gif

    A.

    pgrep -l -f dt

    circle.gif

    B.

    ps -ef dt

    circle.gif

    C.

    ps -el dt

    circle.gif

    D.

    ps -ef|grep dt

  2. Which one of the following commands kills a process named test?

    circle.gif

    A.

    pkill test

    circle.gif

    B.

    kill test

    circle.gif

    C.

    ps -ef||grep kill| kill -9

    circle.gif

    D.

    kill -test

  3. Which commands display active system processes and update at a specified interval? Choose all that apply.

    circle.gif

    A.

    ps

    circle.gif

    B.

    prstat

    circle.gif

    C.

    sdtprocess

    circle.gif

    D.

    ptree

  4. In output from the ps command, what does an R stand for in the S field?

    circle.gif

    A.

    The process is on the run queue.

    circle.gif

    B.

    The process is receiving input.

    circle.gif

    C.

    It is a regular process.

    circle.gif

    D.

    The process is sleeping, so it must be restarted.

  5. In output from the ps command, which of the following does the UID field display?

    circle.gif

    A.

    The parent process

    circle.gif

    B.

    The process id

    circle.gif

    C.

    The process owner

    circle.gif

    D.

    The priority of the process

  6. Which one of the following options to the ps command lists only processes for a particular user?

    circle.gif

    A.

    -P

    circle.gif

    B.

    -f

    circle.gif

    C.

    -l

    circle.gif

    D.

    -u

  7. Which one of the following commands lists all processes running on the local system?

    circle.gif

    A.

    ps -e

    circle.gif

    B.

    ps -a

    circle.gif

    C.

    ps -f

    circle.gif

    D.

    ps -t

  8. Which one of the following sends a terminate signal (signal 15) to a process with a PID of 2930?

    circle.gif

    A.

    kill 2930

    circle.gif

    B.

    stop 2930

    circle.gif

    C.

    Ctrl+C

    circle.gif

    D.

    cancel 2930

  9. Which one of the following signals kills a process unconditionally?

    circle.gif

    A.

    9

    circle.gif

    B.

    0

    circle.gif

    C.

    15

    circle.gif

    D.

    1

  10. Which of the following commands is used to change the priority on a process? Choose all that apply.

    circle.gif

    A.

    renice

    circle.gif

    B.

    priocntl

    circle.gif

    C.

    ps

    circle.gif

    D.

    hup

  11. Which one of the following commands is issued to increase the priority of PID 8200?

    circle.gif

    A.

    renice -n -4 -p 8200

    circle.gif

    B.

    nice -n -4 -p 8200

    circle.gif

    C.

    nice -i 8200

    circle.gif

    D.

    renice -I -p 8200

  12. Which utilities can be used to show the process ancestry tree? Choose all that apply.

    circle.gif

    A.

    ps

    circle.gif

    B.

    ptree

    circle.gif

    C.

    sdtprocess

    circle.gif

    D.

    prstat

  13. Which of the following commands schedules a command to run once at a given time?

    circle.gif

    A.

    crontab

    circle.gif

    B.

    priocntl

    circle.gif

    C.

    at

    circle.gif

    D.

    cron

  14. Which of the following commands show(s) the jobs queued up by the at command? Choose all that apply.

    circle.gif

    A.

    atq

    circle.gif

    B.

    at -l

    circle.gif

    C.

    ps

    circle.gif

    D.

    crontab

  15. Which one of the following crontab entries instructs the system to run logchecker at 3:10 on Sunday and Thursday nights?

    circle.gif

    A.

    0 4 * * 10,3 /etc/cron.d/logchecker

    circle.gif

    B.

    10 3 * * 0,4 /etc/cron.d/logchecker

    circle.gif

    C.

    * 10 3 0,4 /etc/cron.d/logchecker

    circle.gif

    D.

    10 3 * * 0-4 /etc/cron.d/logchecker

  16. Which one of the following logs keeps a record of all cron activity?

    circle.gif

    A.

    /var/cron/log

    circle.gif

    B.

    /var/spool/cron/log

    circle.gif

    C.

    /var/adm/cron

    circle.gif

    D.

    /var/adm/messages

  17. A user wants to execute a command later today, after leaving work. Which one of the following commands will allow him to do this?

    circle.gif

    A.

    runat

    circle.gif

    B.

    at

    circle.gif

    C.

    submit

    circle.gif

    D.

    None of the above

  18. You've added the user name bcalkins to the /etc/cron.d/cron.allow file. You've removed the name bcalkins from the /etc/cron.d/cron.deny file. Which statement is true regarding crontab?

    circle.gif

    A.

    bcalkins cannot create crontab entries.

    circle.gif

    B.

    bcalkins can create crontab entries.

    circle.gif

    C.

    Only root can create crontab entries.

    circle.gif

    D.

    No one can create crontab entries.

Answers to Exam Questions

  1. A, D. Use the pgrep and ps commands to view processes running on your system. The commands pgrep -l -f dt and ps -ef|grep dt find all the processes that have dt in the process argument string and display them.
  2. A. The command pkill test kills a process named test.
  3. B, C. The prstat and sdtprocess commands display active system processes and can be configured to update at a specified interval.
  4. A. In output from the ps command, the R in the S field means that the process is on the run queue.
  5. C. In output from the ps command, the UID field displays the process owner.
  6. D. The -u option to the ps command lists only processes for a particular user.
  7. A. The -e option to the ps command lists all processes currently running on the system. The other options only list processes for the local user.
  8. A. The command kill 2930 sends a terminate signal (signal 15) to a process with a PID of 2930.
  9. A. Signal 9 stops a process unconditionally.
  10. A, B. The commands renice and priocntl are used to change the priority on a process.
  11. A. The renice -n -4 -p 8200 command is issued to increase the priority of a process with a PID of 8200.
  12. B, C. The utilities ptree and sdtprocess are used to show the process ancestry tree.
  13. C. The at command schedules a command to run once at a given time.
  14. A, B. The atq and at -1 commands show the jobs queued up by the at command.
  15. B. The crontab entry 10 3 * * 0,4 /etc/cron.d/logchecker instructs the system to run logchecker at 3:10 on Sunday and Thursday nights.
  16. A. The log file named /var/cron/log keeps a record of all cron activity.
  17. B. Use the at command to execute a command or script at a later time.
  18. B. Users can manage jobs if their name appears in the /etc/cron.d/cron.allow file and does not appear in the /etc/cron.d/cron.deny file.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020