Lesson 10-Controlling User  Processes
Overview  <ul><li>Managing and processing processes. </li></ul><ul><li>Managing jobs. </li></ul><ul><li>Exiting/quitting w...
Managing and Processing Processes  <ul><li>Every running program is a separate entity, called a process. </li></ul><ul><li...
Managing and Processing Processes  <ul><li>Each process involves reading instructions, accessing computer memory, reading ...
Managing and Processing Processes  <ul><li>Obtaining detailed information on system processes. </li></ul><ul><li>Identifyi...
<ul><li>Genealogy of processes. </li></ul><ul><li>Ending foreground processes. </li></ul><ul><li>Ending background process...
Obtaining Detailed Information on System Processes  <ul><li>The “ps –aux” and the “ps –ef” commands can be used to get a l...
Identifying Processes Connected to a Terminal  <ul><li>User processes must be informed of the port to which they are attac...
Identifying Processes Connected to a Terminal  Output of ps Utility
Identifying Processes Connected to a Terminal  <ul><li>PID – The PID, called the Process IDentification number, is a uniqu...
Starting a New Shell Process  <ul><li>The “sh” command is used to start a child shell. </li></ul><ul><li>The “echo $$” com...
Obtaining Detailed Data about User Processes  Output of ps –l Command
Obtaining Detailed Data about User Processes  <ul><li>Flags (F) – This field contains a number indicating the Flags or opt...
Genealogy of Processes  <ul><li>Processes inherit data from their parent process. </li></ul><ul><li>Every utility or execu...
Ending Foreground Processes  <ul><li>The “stty –a” command can be used to display the settings for a system. </li></ul><ul...
Ending Foreground Processes  <ul><li>The “echo $status” command is used by the older csh family of shells. </li></ul><ul><...
Ending Foreground Processes  <ul><li>The keyboard signal “quit” can be used to stop a foreground process. </li></ul><ul><l...
Ending Background Processes  <ul><li>The “kill” command can be used to terminate a process running in the background. </li...
Ending Background Processes  Listing of All Signals
Terminating a Process that is not Responding  <ul><li>The following tasks should be carried out to terminate a process: </...
Managing Jobs  <ul><li>A command-line that instructs the shell to start several processes with the output from the first c...
Managing Jobs  <ul><li>Suspending a job. </li></ul><ul><li>Identifying the most recent job. </li></ul><ul><li>Killing a pa...
Suspending a Job  <ul><li>The “stty –a” command is used to describe a list of CTRL key settings used by the terminal and t...
Suspending a Job  <ul><li>The “jobs” program lists all background and suspended jobs and their status. </li></ul><ul><li>T...
Identifying the Most Recent Job  <ul><li>The “fg %+” is used to bring the most recently suspended job to the foreground. <...
Identifying the Most Recent Job  <ul><li>The job number can also be used to get a job to the foreground. </li></ul><ul><li...
Killing a Job  <ul><li>The “kill %+” command is used to kill the most recent job in the job list. </li></ul><ul><li>The jo...
Exiting/Quitting When Jobs Have Been Stopped  <ul><li>Job control is a very useful method of managing processes. </li></ul...
Summary  <ul><li>Programs running in a system are executed by a process that reads the appropriate code and accomplishes t...
<ul><li>A command-line that consists of one process or a series of processes connected by pipes is called a job. </li></ul...
Upcoming SlideShare
Loading in...5
×

intro unix/linux 10

3,530

Published on

controlling user processes

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,530
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
291
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

intro unix/linux 10

  1. 1. Lesson 10-Controlling User Processes
  2. 2. Overview <ul><li>Managing and processing processes. </li></ul><ul><li>Managing jobs. </li></ul><ul><li>Exiting/quitting when jobs have been stopped. </li></ul>
  3. 3. Managing and Processing Processes <ul><li>Every running program is a separate entity, called a process. </li></ul><ul><li>A process consists of several components working together, including the code, data, CPU activity, memory, input, output, and error handling. </li></ul>
  4. 4. Managing and Processing Processes <ul><li>Each process involves reading instructions, accessing computer memory, reading from input, evaluating arguments, performing calculations, and writing to output. </li></ul><ul><li>Every process on the system has its own unique process ID number. </li></ul>
  5. 5. Managing and Processing Processes <ul><li>Obtaining detailed information on system processes. </li></ul><ul><li>Identifying processes connected to a terminal. </li></ul><ul><li>Starting a new shell process. </li></ul><ul><li>Obtaining detailed data about user processes. </li></ul>
  6. 6. <ul><li>Genealogy of processes. </li></ul><ul><li>Ending foreground processes. </li></ul><ul><li>Ending background processes. </li></ul><ul><li>Terminating a process that is not responding. </li></ul>Managing and Processing Processes
  7. 7. Obtaining Detailed Information on System Processes <ul><li>The “ps –aux” and the “ps –ef” commands can be used to get a list of all processes currently running on the system. </li></ul><ul><li>The “ps –u $USER” command can be used to list only the processes owned by a particular user. </li></ul><ul><li>The “ps –u root” command can be used to list the processes that are started when the system is booted up, and that are owned by the root user. </li></ul>
  8. 8. Identifying Processes Connected to a Terminal <ul><li>User processes must be informed of the port to which they are attached. </li></ul><ul><li>The “tty” command can be used to determine the terminal port used by a user. </li></ul><ul><li>The “ps –t port” command can be used to display the running processes, the shell, a process running sleep, and the process running the ps utility. </li></ul>
  9. 9. Identifying Processes Connected to a Terminal Output of ps Utility
  10. 10. Identifying Processes Connected to a Terminal <ul><li>PID – The PID, called the Process IDentification number, is a unique number assigned to each process when it gets created. </li></ul><ul><li>CPU – It refers to the CPU time consumed by a process. </li></ul><ul><li>CMD – The command mode contains the names of the utilities associated with each running process. </li></ul>
  11. 11. Starting a New Shell Process <ul><li>The “sh” command is used to start a child shell. </li></ul><ul><li>The “echo $$” command can be used to obtain the PID of the current shell. </li></ul><ul><li>The “exit” command or the CTRL-D keys can be used to exit the child shell. </li></ul>
  12. 12. Obtaining Detailed Data about User Processes Output of ps –l Command
  13. 13. Obtaining Detailed Data about User Processes <ul><li>Flags (F) – This field contains a number indicating the Flags or options set for a process. </li></ul><ul><li>State (S) – It indicates the state of the process, which includes sleeping (S), running (R), idle (I), and traced (T). </li></ul><ul><li>Size (SZ) – It contains a number indicating the size of the process in memory. </li></ul><ul><li>Command (CMD) – It refers to the actual command being run by the process. </li></ul>
  14. 14. Genealogy of Processes <ul><li>Processes inherit data from their parent process. </li></ul><ul><li>Every utility or executable file name that is typed is executed by a process that is a child of the shell process. </li></ul><ul><li>The child process inherits data such as tty, user ID, and the current directory from the parent process. </li></ul>
  15. 15. Ending Foreground Processes <ul><li>The “stty –a” command can be used to display the settings for a system. </li></ul><ul><li>The “echo $?” and the “echo $status” commands can be used to ask for the exit status sent by the process running sleep to the shell. </li></ul><ul><li>The “echo $?” command is used by the sh and the recent csh family shells. </li></ul>
  16. 16. Ending Foreground Processes <ul><li>The “echo $status” command is used by the older csh family of shells. </li></ul><ul><li>The CTRL-D key is used to mark the end-of-file character, while the CTRL-C key is used to interrupt a process. </li></ul><ul><li>The CTRL-D key displays an output, but the CTRL-C does not generate any output. </li></ul>
  17. 17. Ending Foreground Processes <ul><li>The keyboard signal “quit” can be used to stop a foreground process. </li></ul><ul><li>The “CTRL-” keys can also be used to quit a process. </li></ul><ul><li>The quit signal destroys the process and sometimes makes a copy of the CPU memory associated with the process at the time of exit. The copy is called a core file. </li></ul>
  18. 18. Ending Background Processes <ul><li>The “kill” command can be used to terminate a process running in the background. </li></ul><ul><li>The command requires the PID of the process as the second argument. </li></ul><ul><li>The “kill –l” command can be used to list all the kill signals available for the current system. </li></ul>
  19. 19. Ending Background Processes Listing of All Signals
  20. 20. Terminating a Process that is not Responding <ul><li>The following tasks should be carried out to terminate a process: </li></ul><ul><ul><ul><li>A new terminal should be started. </li></ul></ul></ul><ul><ul><ul><li>The current terminal port should be identified at the new login or terminal. </li></ul></ul></ul><ul><ul><ul><li>All the processes should be listed. </li></ul></ul></ul><ul><ul><ul><li>The PID of the particular process should be identified and the ‘kill’ command should be used to terminate it. </li></ul></ul></ul>
  21. 21. Managing Jobs <ul><li>A command-line that instructs the shell to start several processes with the output from the first connecting to the second and so on, is called a job. </li></ul><ul><li>All modern shells allow users to start, suspend, make active, and kill the processes associated with a job. </li></ul>
  22. 22. Managing Jobs <ul><li>Suspending a job. </li></ul><ul><li>Identifying the most recent job. </li></ul><ul><li>Killing a particular job. </li></ul>
  23. 23. Suspending a Job <ul><li>The “stty –a” command is used to describe a list of CTRL key settings used by the terminal and the shell for communication. </li></ul><ul><li>The CTRL-Z key is used to suspend a job. </li></ul><ul><li>The suspended job does not use the system memory. </li></ul><ul><li>The “fg” command is used to bring the last suspended job into the foreground. </li></ul>
  24. 24. Suspending a Job <ul><li>The “jobs” program lists all background and suspended jobs and their status. </li></ul><ul><li>The “jobs” command is a shell built-in command. </li></ul><ul><li>A job’s output is divided into four columns – the job number, the order, the status, and the command being executed. </li></ul>
  25. 25. Identifying the Most Recent Job <ul><li>The “fg %+” is used to bring the most recently suspended job to the foreground. </li></ul><ul><li>The “fg %-” is used to bring the second most recently suspended job to the foreground. </li></ul>
  26. 26. Identifying the Most Recent Job <ul><li>The job number can also be used to get a job to the foreground. </li></ul><ul><li>For example, “fg %2”, where %2 specifies the job with the job number 2. </li></ul><ul><li>The job name can also be used to get a job to the foreground. </li></ul>
  27. 27. Killing a Job <ul><li>The “kill %+” command is used to kill the most recent job in the job list. </li></ul><ul><li>The job number can also be passed as an argument to kill that particular job. </li></ul><ul><li>The job name can also be passed as an argument to kill a job. </li></ul><ul><li>Care should be taken while killing a job. We must not kill wrong jobs. </li></ul>
  28. 28. Exiting/Quitting When Jobs Have Been Stopped <ul><li>Job control is a very useful method of managing processes. </li></ul><ul><li>UNIX job control provides a method of warning the users of stopped or running background jobs when an attempt is made to log out or exit a process. </li></ul><ul><li>It logs out without warning when we issue the same command again, resulting in loss of unsaved data. </li></ul>
  29. 29. Summary <ul><li>Programs running in a system are executed by a process that reads the appropriate code and accomplishes the tasks. </li></ul><ul><li>All the processes have their own unique PID, the PID of their parent, an owner, group, memory, code, input, output, error, and their tty port. </li></ul>
  30. 30. <ul><li>A command-line that consists of one process or a series of processes connected by pipes is called a job. </li></ul><ul><li>The kill command terminates processes identified by either their process ID or job number/job name. </li></ul>Summary
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×