Difference between revisions of "Introduction to Linux in HPC/Processes"

From HPC Wiki
Introduction to Linux in HPC/Processes
Jump to navigation Jump to search
(Update Video Link)
m (Tweak page sorting)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Tutorials]]
+
[[Category:Tutorials|Processes (Linux)]]<nowiki />
{{DISPLAYTITLE:<span style="position:absolute; top:-9999px;">Introduction to Linux in HPC/</span>Users and permissions}}
+
{{DISPLAYTITLE:Processes}}<nowiki />
{{Infobox_linux_introduction}}
+
{{Syllabus Introduction to Linux}}<nowiki />
 
 
 
__TOC__
 
__TOC__
  
 +
This tutorial covers the basic principles and treatments of processes in the multi-user operating system Linux. It will explain the viewing (and killing) of processes with a text-based process manager and the execution of processes in background/foreground.
  
 
=== Video === <!--T:5-->
 
=== Video === <!--T:5-->
  
<youtube width="600" height="400" right>UjrZUfynUaY</youtube>
+
<youtube width="600" height="340" right>UjrZUfynUaY</youtube>
 +
 
 +
([[Media:HPC.NRW_Introduction_to_Linux_in_HPC_07_Processes.pdf | Slides as pdf]])
 +
 
  
<!-- === Quiz ===   -->
+
=== Quiz === <!--T:5-->
  
=== Exercises in Terminal (slide 89) === <!--T:5--> 
 
  
1. Start a process (e.g. sleep 10m)
+
{{hidden begin
  {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
+
|title = What does PID stand for?
    | <strong>Answer:</strong>
+
}}
    |-
+
<quiz display=simple>
    |  
+
{
      Use a second console to look at it in top.
+
|type="()"}
      Kill it.
+
- Packet Identifier
      Hint:
+
|| Explanation: Wrong
        To kill the started process (e.g. sleep 10m):
+
+ Process Identifier
        1. Go to the terminal that started the process.
+
|| Explanation: Correct
        2. Press Ctrl-C to kill it.
+
- Protocol Identifocation
    |}
+
|| Explanation: Wrong
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = How are the permissions of a process set?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+ By inheritance of owner's permissions.
 +
|| Explanation: Correct. Process can/can’t do what owner can/can’t do!
 +
- Manually by user
 +
|| Explanation: Wrong.
 +
- Explicitly at startup by parameters.
 +
|| Explanation: Wrong.
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = Assign the commands their correct meaning
 +
}}
 +
<quiz display="simple">
 +
{
 +
| typ="()" }
 +
| pstree | top | fg/bg
 +
+-- ... overview of running processes and sub-processes
 +
--+ ... sending processes to foreground/background
 +
-+- ... text-based task manager
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
=== Exercises in Terminal === <!--T:5--> 
  
  2. Start a process, bring it into background/foreground.
+
  1. Start a process, bring it into background/foreground.
 
   {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 
   {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 
     | <strong>Hint:</strong>
 
     | <strong>Hint:</strong>
Line 36: Line 70:
 
         Type bg (bring it to background).
 
         Type bg (bring it to background).
 
       To bring a process to foreground:
 
       To bring a process to foreground:
         Type fg (bring it to foreground).
+
        Display running "jobs" and identify the job ID: jobs
 +
         Type fg <job-ID> (bring it to foreground).
 +
    |}
 +
 
 +
2. Start the task manager and identify the process with the largest memory usage.
 +
  {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 +
    | <strong>Hint:</strong>
 +
    |-
 +
    |
 +
      Start the process manager: top
 +
      Activate highlighting for current sort column: press 'x'
 +
      Select column to sort for: press '>' or '<' until column '%MEM' is acitve
 +
      (optional) Reverse sorting: press 'R'
 +
    |}
 +
 
 +
3. Start the task manager and filter processes of your user account.
 +
  {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 +
    | <strong>Hint:</strong>
 +
    |-
 +
    |
 +
      Start the process manager: top
 +
      Select username to filter: press 'u' and type in username
 
     |}
 
     |}
  
 +
4. Start a process (e.g. sleep 10m) and kill it from a second console.
 +
  {| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 +
    | <strong>Answer:</strong>
 +
    |-
 +
    |
 +
      Start the process: sleep 10m
 +
      Go to a second console.
 +
      Start the process manager: top
 +
      Filter process from your user account: press 'u' and type in your account name.
 +
      Identify the job ('sleep') and note the associated PID.
 +
      Kill it: press 'k' and type in the PID from previous step.
 +
    |}
  
<div style='text-align: left;float:left;width:33%;'>{{Clickable button|[[Introduction_to_Linux_in_HPC/Text_display_search | Previous Page]]|color=white}}</div>
+
{{Tutorial Navigation
<div style='text-align: center;float:left;width:33%;'>{{Clickable button|[[Introduction_to_Linux_in_HPC | Main Menu Page]]|color=white}}</div>
+
| previous = [[Introduction_to_Linux_in_HPC/Users_and_permissions | Users and Permissions ]]
<div style='text-align: right;float:left;width:33%;'>{{Clickable button|[[Introduction_to_Linux_in_HPC/Processes | Next Page]]|color=white}}</div>
+
| main = [[Introduction_to_Linux_in_HPC | Overview ]]
 +
| next = [[Introduction_to_Linux_in_HPC/The_vim_text_editor | The vim Text Editor ]]
 +
}}

Latest revision as of 17:23, 4 December 2020

Tutorial
Title: Introduction to Linux in HPC
Provider: HPC.NRW

Contact: tutorials@hpc.nrw
Type: Multi-part video
Topic Area: HPC Platforms
License: CC-BY-SA
Syllabus

1. Background and History
2. The Command Line
3. Linux Directory Structure
4. Files
5. Text display and search
6. Users and permissions
7. Processes
8. The vim text editor
9. Shell scripting
10. Environment variables
11. System configuration
12. SSH Connections
13. SSH: Graphics and File Transfer
14. Various tips

This tutorial covers the basic principles and treatments of processes in the multi-user operating system Linux. It will explain the viewing (and killing) of processes with a text-based process manager and the execution of processes in background/foreground.

Video

( Slides as pdf)


Quiz

What does PID stand for?

Packet Identifier
Process Identifier
Protocol Identifocation

How are the permissions of a process set?

By inheritance of owner's permissions.
Manually by user
Explicitly at startup by parameters.

Assign the commands their correct meaning

pstree top fg/bg
... overview of running processes and sub-processes
... sending processes to foreground/background
... text-based task manager

Exercises in Terminal

1. Start a process, bring it into background/foreground.
2. Start the task manager and identify the process with the largest memory usage.
3. Start the task manager and filter processes of your user account.
4. Start a process (e.g. sleep 10m) and kill it from a second console.


<< Users and Permissions

Overview

The vim Text Editor >>