Browse Source

Linux-process-management

master
zeus 4 years ago
parent
commit
15b0b093fc
  1. 17
      Linux-process-management/1
  2. 139
      Linux-process-management/basics.adoc

17
Linux-process-management/1

@ -0,0 +1,17 @@
= An Introduction to Linux !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Intro and Install
:keywords: Linux, apt
:data-uri:
:toc: right
:toc-title: Table of contents
:toclevels: 4
:source-highlighter: highlight
:no-header-footer:
:nofooter:
:last-update-label!:
:icons: font
:sectnums:

139
Linux-process-management/basics.adoc

@ -15,130 +15,41 @@ Apostolos rootApostolos@swarmlab.io
:sectnums:
== Absolute basics
.Absolute basics
[options="header,footer"]
|=======================
|Command| Meaning
|ls| Displays a list of files in the current working directory.
|cd directory| change directories
|passwd |change the password for the current user
|file filename| display file type of file with name filename
|cat textfile| throws content of textfile on the screen
|pwd| display present working directory
|exit or logout| leave this session
|man command| read man pages on command
|=======================
== process
=== Key combinations
.Key combinations
[options="header,footer"]
|=======================
|Key or key combination| Function
|Ctrl+C| End a running program and return the prompt
|Ctrl+Z| Suspend a program
|ArrowUp and ArrowDown| Browse history. Go to the line that you want to repeat, edit details if necessary, and press Enter to save time.
|Tab| Command or filename completion; when multiple choices are possible, the system will either signal with an audio or visual bell, or, if too many choices are possible, ask you if you want to see them all.
|Tab Tab| Shows file or command completion possibilities.
|Shift+PageUp and Shift+PageDown| Browse terminal buffer (to see text that has "scrolled off" the screen).
|=======================
An instance of a running program is called a process.
Every time you run a shell command, a program is run and a process is created for it.
=== ls -l
[source,bash]
----
# ls -al
drwxrwxr-x 4 zeus zeus 4096 Οκτ 23 21:55 .
drwxrwxr-x 9 zeus zeus 4096 Οκτ 15 14:28 ..
drwxrwxr-x 8 zeus zeus 4096 Οκτ 23 21:55 .git
drwxrwxr-x 4 zeus zeus 4096 Οκτ 14 20:24 install
crw------- 1 root root 5, 1 Οκτ 23 21:22 console
lrwxrwxrwx 1 root root 11 Οκτ 23 21:21 core -> /proc/kcore
drwxr-xr-x 4 root root 100 Οκτ 23 21:22 cpu
crw------- 1 root root 10, 59 Οκτ 23 21:21 cpu_dma_latency
crw------- 1 root root 10, 203 Οκτ 23 21:21 cuse
-rw-rw-r-- 1 zeus zeus 1517 Οκτ 23 21:55 INSTALL.md
-rw-rw-r-- 1 zeus zeus 33883 Οκτ 15 14:28 LICENSE
-rw-rw-r-- 1 zeus zeus 691 Οκτ 17 11:13 README.md
----
In any modern operating system there can be more than one instance of a program loaded in memory at the same time.
==== File types
== Linux process management
This table gives an overview of the characters determining the file type:
Operating systems need some ways to create processes.
NOTE: **d**rwxrwxr-x 4 zeus zeus 4096 Οκτ 14 20:24 install
* In a very simple system designed for running only a single application (e.g., the controller in a microwave oven), it may be possible to have all the processes that will ever be needed be present when the system comes up.
* In general-purpose systems, however, some way is needed to create and terminate processes as needed during operation.
.File types in a long list
[options="header,footer"]
|=======================
|Symbol| Meaning
|-| Regular file
|d| Directory
|l| Link
|c| Special file
|s| Socket
|p| Named pipe
|b| Block device
|=======================
[NOTE]
====
NOTE: -**rw-**rw-r-- 1 zeus zeus 1517 Οκτ 23 21:55 INSTALL.md
*There are four principal events that cause a process to be created:*
==== Access rights
* System initialization.
* Execution of process creation system call by a running process.
* A user request to create a new process.
* Initiation of a batch job.
====
.Access rights
[options="header,footer"]
|=======================
|Code| Meaning
|0 or -|The access right that is supposed to be on this place is not granted.
|4 or r|read access is granted to the user category defined in this place
|2 or w|write permission is granted to the user category defined in this place
|1 or x|execute permission is granted to the user category defined in this place
|=======================
Process creation in UNIX and Linux are done through *fork()* or *clone()* system calls.
There are several steps involved in process creation.
==== User group codes
.User group codes
[options="header,footer"]
|=======================
|Code| Meaning|
|u| user permissions|-**rw-**rw-r--
|g| group permissions|-rw-**rw-**r--
|o| permissions for others|-rw-rw-**rw-**
|=======================
==== Exercises
[source,bash]
----
touch example
chmod 400 example
ls -l example
chmod 500 example
ls -l example
chmod 600 example
ls -l example
chmod 644 example
ls -l example
chmod 660 example
ls -l example
chmod 700 example
ls -l example
chmod 755 example
ls -l example
chmod 775 example
ls -l example
ls -l example
chmod 777 example
ls -l example
----
:hardbreaks:
{empty} +
{empty} +
{empty}
:!hardbreaks:
* process scheduling,
* interrupt handling,
* signaling,
* process prioritization,
* process switching,
* process state,
* process memory

Loading…
Cancel
Save