1 / 44

Managing system processes

Managing system processes. Unit objectives Categorize the various types of processes, view processes using utilities, and illustrate the differences between various kill signals Describe how binary programs and shell scripts are executed, create and manipulate background processes

sumana
Download Presentation

Managing system processes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Managing system processes Unit objectives • Categorize the various types of processes, view processes using utilities, and illustrate the differences between various kill signals • Describe how binary programs and shell scripts are executed, create and manipulate background processes • Use utilities to modify the priority of a process, schedule commands using the at daemon, and schedule repetitive commands using the cron daemon.

  2. Topic A • Topic A: Starting, viewing and killing processes • Topic B: Foreground and background processes • Topic C: Process priorities and scheduling

  3. Programs and processes • Program • Executable file • May be executed to create a process • Process • Instance of an executing program

  4. User and daemon processes • User process • Process begun by a user that runs on a terminal • Daemon process • System process that isn’t associated with a terminal

  5. Processes • Process ID (PID) • Unique identifier assigned to every process • Child process • Process that was started by another process (parent process) • Parent process • Process that has started other processes (child processes) • Parent Process ID (PPID) • PID of the parent process that created the current process

  6. Parent and child processes

  7. Process genealogy

  8. Exercise A-1 Discussing processes

  9. The ps command • Most versatile and common utility that can view processes • Without arguments, displays processes running in the current shell

  10. Process states

  11. Zombie process • Process that has finished executing, but whose parent hasn’t yet released its PID • Also known as a defunct process

  12. Process priority and nice value • Process priority (PRI) • Number assigned to a process, used to determine how many time slices on the processor it receives • Nice value (NI) • Value that indirectly represents the priority of a process • The higher the value, the lower the priority

  13. Options of the ps command

  14. top command • Most common command used to display processes aside from ps • Display organized by processor time • Processes that use the most processor time are listed at the top of the screen continued

  15. Rogue process • Process that has become faulty and consumes more system resources than it should • Can be used to change the priority of processes or kill them

  16. Activity A-2 Using the ps command to view processes

  17. Sending signals to processes • Kill signal • Type of signal sent to a process by the kill command • Various kill signals affect processes in various ways • kill command • Command that kills all instances of a process by command name

  18. Common administrative kill signals

  19. Trapping and killall • Trapping • Process of ignoring a kill signal • killall command • Command that kills all instances of a process by command name

  20. Activity A-3 Using the kill command to terminate processes

  21. Topic B • Topic A: Starting, viewing and killing processes • Topic B: Foreground and background processes • Topic C: Process priorities and scheduling

  22. Process execution • The three main types of Linux commands that you may execute: • Binary programs • Shell functions • Shell scripts

  23. Forking • Act of creating a new BASH shell child process from a parent • Carried out by the fork function in the Linux kernel

  24. Process forking

  25. Background and foreground processes • Foreground process • Process for which the BASH shell that executed it must wait for its termination • Background process • Process that doesn’t require the BASH shell to wait for its termination • Upon execution, the user receives the BASH shell prompt immediately

  26. Background processes • jobs command • Command used to see the list of background processes running in the current shell • foreground (fg) command • Command used to run a background process in the foreground • background (bg) command • Command used to run a foreground process in the background

  27. Activity B-1 Running a process in the background

  28. Topic C • Topic A: Starting, viewing and killing processes • Topic B: Foreground and background processes • Topic C: Process priorities and scheduling

  29. Process priorities • Time slice • Amount of time a process is given on a CPU in a multiprocessing operating system • The more time slices a process has, the more time it has to execute on the CPU and the faster it executes • Time slices are usually measured in milliseconds

  30. The nice value scale

  31. The nice value and command • Processes are started with a nice value of 0 by default • On some systems, background processes are given a nice value of 4 by default to lower the chance they receive time slices • nice command • Command used to change the priority of a process as it’s started

  32. The renice command • renice command • Used to alter the nice value of a process currently running • As with the nice command, only the root user may change the nice value to a negative value using renice

  33. Activity C-1 Experimenting with scheduling priority

  34. Scheduling commands • at daemon (atd) • System daemon that executes tasks at a future time • Configured with the at command • cron daemon (crond) • System daemon that executes tasks repetitively in the future • Configured using cron tables

  35. Common at commands

  36. Scheduling commands with atd • /etc/at.allow • A file listing all users who can use the at command • /etc/at.deny • A file listing all the users who can’t access the at command

  37. crond scheduling commands • Cron table • File specifying tasks to be run by the cron daemon • User cron tables and system cron tables • Six fields separated by space or tab characters

  38. User cron table format

  39. User cron table entry

  40. Location of cron tables • /var/spool/cron • Stores user cron tables • /etc/cron.d • Contains additional system cron tables • /etc/crontab • Default system cron table

  41. User cron tables • /etc/cron.allow • File listing all users who can use the cron command • /etc/cron.deny • File listing all users who can’t access the cron command • crontab command • Command used to view and edit user cron tables

  42. The system cron table • Systems are scheduled to run commands during non-business hours • Commands may perform system maintenance, back up data, or run CPU-intensive programs • Most commands are scheduled by the cron daemon from entries in the system cron table /etc/crontable

  43. Activity C-2 Using at and crontab utilities to schedule processes

  44. Chapter summary • Categorized different types of processes, viewed processes by using utilities, and learned the difference between kill signals • Described how binary programs and shell scripts are executed, created and manipulated as background processes • Used utilities to modify the priority of a process and schedule commands

More Related