Your SlideShare is downloading. ×
0
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
intro unix/linux 10
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

intro unix/linux 10

3,516

Published on

controlling user processes

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,516
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
291
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Lesson 10-Controlling User Processes
  • 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. 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. 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. 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. <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. 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. 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. Identifying Processes Connected to a Terminal Output of ps Utility
  • 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. 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. Obtaining Detailed Data about User Processes Output of ps –l Command
  • 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. 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. 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. 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. 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. 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. Ending Background Processes Listing of All Signals
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. <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

×