Browse Source

Linux-process-management

master
zeus 3 years ago
parent
commit
51624cbf62
  1. 63
      Linux-process-management/processes.adoc

63
Linux-process-management/processes.adoc

@ -1,8 +1,8 @@
= An Introduction to Linux !
= Linux process management !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Intro and Install
:keywords: Linux, apt
:description: Linux process management
:keywords: ps aux
:data-uri:
:toc: right
:toc-title: Table of contents
@ -53,3 +53,60 @@ There are several steps involved in process creation.
* process switching,
* process state,
* process memory
=== Life cycle of a process
NOTE: *1->* creation *2->* execution *3->* termination *4->* removal
=== process state
An operating system kernel that allows multitasking needs processes to have certain states. Names for these states are not standardised, but they have similar functionality.
[.float-group]
--
[.right]
image:./Process_states.png[350,350,role="related thumb right"]
* the process is *"created"*.
* After that the process scheduler assigns it the *"waiting"* state.
* While the process is *"waiting"*, it waits for the scheduler to do a so-called context switch.
* The context switch loads the process into the processor and changes the state to *"running"* while the previously *"running"* process is stored in a *"waiting"* state.
* If a process in the *"running"* state needs to wait for a resource, it is assigned the *"blocked"* state.
* The process state is changed back to *"waiting"* when the process no longer needs to wait (in a blocked state).
* Once the process *finishes execution*, or is *terminated* by the operating system, it is no longer needed.
* The process is *removed instantly* or is moved to the *"terminated"* state.
* When removed, it just waits to be *removed from main memory*.
--
=== Inter-process communication
When processes need to communicate with each other they must share parts of their address spaces or use other forms of inter-process communication (IPC).
* For instance in a shell pipeline, the output of the first process need to pass to the second one.
* another example is a task that can be decomposed into cooperating but partially independent processes which can run at once
** (i.e., using concurrency, or true parallelism - the latter model is a particular case of concurrent execution and is feasible whenever enough CPU cores are available for all the processes that are ready to run).
NOTE: It is even possible for two or more processes to be running on different machines that may run different operating system (OS), therefore some mechanisms for communication and synchronization (called communications protocols for distributed computing) are needed (e.g., the *Message Passing Interface, often simply called MPI*).
==== communication between processes
Processes can communicate with each other through:
* Shared Memory
* Message passing
[.float-group]
--
[.right]
image:./1-76.png[350,350,role="related thumb right"]
[.left]
image:./2-50.png[350,350,role="related thumb left"]
--
footnote:[https://www.geeksforgeeks.org/inter-process-communication-ipc/[^]]

Loading…
Cancel
Save