Browse Source

Linux-process-management

master
zeus 3 years ago
parent
commit
ce2b8f615e
  1. BIN
      Linux-process-management.tmp/1-76.png
  2. BIN
      Linux-process-management.tmp/2-50.png
  3. 352
      Linux-process-management.tmp/Life_cycle_of_a_process.adoc
  4. 79
      Linux-process-management.tmp/Multithreaded_process.svg
  5. BIN
      Linux-process-management.tmp/Process_states.png
  6. 709
      Linux-process-management.tmp/Simplified_Structure_of_the_Linux_Kernel.svg
  7. BIN
      Linux-process-management.tmp/fork-exec-exit-wait.png
  8. 45
      Linux-process-management.tmp/index.js
  9. 112
      Linux-process-management.tmp/processes.adoc
  10. BIN
      Linux-process-management.tmp/program_in_memory2.png
  11. 2
      Linux-process-management/Life_cycle_of_a_process.adoc

BIN
Linux-process-management.tmp/1-76.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
Linux-process-management.tmp/2-50.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

352
Linux-process-management.tmp/Life_cycle_of_a_process.adoc

@ -1,352 +0,0 @@
= Linux process management !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Life cycle of a process
:keywords: ps aux
:data-uri:
:toc: right
:toc-title: Table of contents
:toclevels: 4
:source-highlighter: highlight
:no-header-footer:
:nofooter:
:last-update-label!:
:icons: font
:sectnums:
.Life cycle of a process
****
[.float-group]
--
.fork-exec footnote:[http://www.it.uu.se/education/course/homepage/os/vt18/images/module-2/fork-exec-exit-wait.png[^]]
image::./fork-exec-exit-wait.png[350,350,role="related thumb right"]
*fork()* is the the system call that the parent process uses to "divide" itself ("fork") into two identical processes.
* After calling fork(), the created child process is an exact copy of the parent except for the return value of the fork() call.
** This includes open files, register state, and all memory allocations, which includes the program's executable code. In some cases the two continue to run the same binary,
* the child switches to running another binary executable using the *exec()* system call.
--
****
== Life cycle of a process
* When a process forks, a complete copy of the executing program is made into the new process.
** This new process is a child of the parent process, and has a new process identifier (PID).
* The fork() function returns the child's PID to the parent process.
** The fork() function returns 0 to the child process.
** This enables the two identical processes to distinguish one another.
* The parent process can either continue execution or wait for the child process to complete.
* The child, after discovering that it is the child, replaces itself completely with another program, so that the code and address space of the original program are lost.
* If the parent chooses to wait for the child to die, then the parent will receive the exit code of the program that the child executed.
* To prevent the child becoming a zombie the parent should call wait on its children, either periodically or upon receiving the SIGCHLD signal, which indicates a child process has terminated.
* One can also asynchronously wait on their children to finish, by using a signal handler for SIGCHLD, if they need to ensure everything is cleaned up.
[NOTE]
====
* When the child process calls exec(), all data in the original program is lost, and it is replaced with a running copy of the new program.
** This is known as overlaying.
* Although all data are replaced, the file descriptors that were open in the parent are closed only if the program has explicitly marked them close-on-exec.
* This allows for the common practice of the parent creating a pipe prior to calling fork() and using it to communicate with the executed program.
====
=== copy-on-write
All processes are sharing the same set of pages and each one gets its own private copy when it wants to modify a page.
*In such cases, a technique called copy-on-write (COW) is used.*
With this technique, when a fork occurs, the parent process's pages are not copied for the child process.
Instead, the pages are shared between the child and the parent process.
Whenever a process (parent or child) modifies a page, a separate copy of that particular page alone is made for that process (parent or child) which performed the modification.
This process will then use the newly copied page rather than the shared one in all future references.
The other process (the one which did not modify the shared page) continues to use the original copy of the page (which is now no longer shared). This technique is called copy-on-write since the page is copied when some process writes to it.
[NOTE]
====
*copy-on-write* is lazy copying, child process copy the page when try to write it.
So basically, after a fork, almost child's memory is shared with parent.
Before any of the processes made, every child process still have some private memory, modified from parent's or new allocating.
That means even without any action the forked child process has some private memory.
We can verify it with
[source,bash]
----
cat /proc/PID/smaps
or
pmap PID
----
====
[TIP]
====
This operation avoids unnecessary overhead because copying an entire address space is a very slow and inefficient operation which uses a lot of processor time and resources.
====
=== Zombie processes
A child process always first becomes a zombie before being removed from the resource table.
When a process ends via exit, all of the memory and resources associated with it are deallocated so they can be used by other processes.
The process's entry in the process table remains.
The parent can read the child's exit status by executing the wait system call, whereupon the zombie is removed.
The wait call may be executed in sequential code, but it is commonly executed in a handler for the SIGCHLD signal, which the parent receives whenever a child has died.
[NOTE]
====
In most cases, under normal system operation zombies are immediately waited on by their parent and then reaped by the system – processes that stay zombies for a long time are generally an error and cause a resource leak, but the only resource they occupy is the process table entry – process ID.
[source,bash]
----
It is not possible to kill such a process with the kill command, because it is already considered dead.
You can kill the parent process and then the zombie disappears as well.
Zombies can be identified in the output from the Unix ps command by the presence of a "Z" in the "STAT" column
----
====
=== wait
The child process will not be completely removed until the parent process knows of the termination of its child process by the wait() system call.
A process (or task) may wait on another process to complete its execution.
The parent process issue a wait system call, which suspends the execution of the parent process while the child executes.
When the child process terminates, it returns an exit status to the operating system, which is then returned to the waiting parent process.
The parent process then resumes execution.
=== Orphan process
A child process whose parent process terminates before it does becomes an orphan process.
Such situations are typically handled with a special "root" (or "init") process, which is assigned as the new parent of a process when its parent process exits.
This special process detects when an orphan process terminates and then retrieves its exit status, allowing the system to deallocate the terminated child process.
=== Process States
[source,bash]
----
ps aux
----
In the *STAT* column, you'll see:
* R: running or runnable, it is just waiting for the CPU to process it
* S: Interruptible sleep, waiting for an event to complete, such as input from the terminal
* D: Uninterruptible sleep, processes that cannot be killed or interrupted with a signal, usually to make them go away you have to reboot or fix the issue
* Z: Zombie, we discussed in a previous lesson that zombies are terminated processes that are waiting to have their statuses collected
* T: Stopped, a process that has been suspended/stopped
== Thread
A thread is an execution unit that has its own program counter, a stack and a set of registers that reside in a process
Multiple threads can exist within one process, executing concurrently and sharing resources such as memory, while different processes do not share these resources.
The threads of a process share its executable code and the values of its dynamically allocated variables and non-thread-local global variables at any given time.
[.float-group]
--
.A process with two threads footnote:[https://commons.wikimedia.org/w/index.php?curid=2233446[^]]
image::./Multithreaded_process.svg[350,350,role="related thumb right"]
Threads in the same process share:
* Process instructions
* open files, data
* signals and signal handlers
* current working directory
* User and group id
--
NOTE: A thread is also called Light Weight Process (LWP).
=== Implementations
* LinuxThreads
** The default thread implementation since Linux kernel 2.0 (introduced in 1996)
* Native POSIX Thread Library (NPTL)
** NPTL has been part of Red Hat Enterprise Linux since version 3, and in the Linux kernel since version 2.6. It is now a fully integrated part of the GNU C Library.
* Next Generation POSIX Thread (NGPT)
** A IBM developed version of POSIX thread library. The NGPT team collaborated closely with the NPTL team and combined the best features of both implementations into NPTL.
=== Threads vs. processes pros and cons
* processes are typically independent, while threads exist as subsets of a process
* processes carry considerably more state information than threads, whereas multiple threads within a process share process state as well as memory and other resources
* processes have separate address spaces, whereas threads share their address space
* processes interact only through system-provided inter-process communication mechanisms
* context switching between threads in the same process typically occurs faster than context switching between processes
Advantages and disadvantages of threads vs processes include:
* *Lower resource consumption of threads*: using threads, an application can operate using fewer resources than it would need when using multiple processes.
* *Simplified sharing and communication of threads*: unlike processes, which require a message passing or shared memory mechanism to perform inter-process communication (IPC), threads can communicate through data, code and files they already share.
TIP: *Thread crashes a process*: due to threads sharing the same address space, an illegal operation performed by a thread can crash the entire process; therefore, one misbehaving thread can disrupt the processing of all the other threads in the application.
==== When should you prefer fork() over threading and vice-verse?
When you're doing a far more complex task than just instantiating a worker, or you want the implicit security sandboxing of separate processes.
==== If I want to call an external application as a child, then should I use fork() or threads to do it?
If the child will do an identical task to the parent, with identical code, use fork. For smaller subtasks use threads.
==== it is bad thing to call a fork() inside a thread?
it's computationally rather expensive to duplicate a process and a lot of subthreads.
== Process Memory
A process uses its own memory area to perform work.
[.float-group]
--
.Process Memory footnote:[https://gabrieletolomei.files.wordpress.com/2013/10/program_in_memory2.png?w=960[^]]
image::./program_in_memory2.png[350,350,role="related thumb right"]
* Text Segment.
** The Text segment (a.k.a the Instruction segment) contains the executable program code and constant data.
* Data Segment
** Heap
*** Heap is the segment from which the memory is provided. (e.g. malloc())
** BSS:
*** The area where zero-initialized data is stored. All the global variable which are not initialized in the program are stored in the BSS segment.
** Data:
*** The area where initialized data are stored.
* Stack Segment
** The stack segment is used by the process for the storage of automatic identifier, register variables, and function call information.
--
.what process is attached to a shared memory segment?
[source,bash]
----
You can use:
ipcs -mp to get the process ID
and
with the command grep [shared memory segment] /proc/*/maps
----
TIP: *ipcs* shows information on the inter-process communication facilities for which the calling process has read access.
By default it shows information about all three resources: shared memory segments, message queues, and semaphore arrays.
== Process priority (nice)
In Linux we can set guidelines for the CPU to follow when it is looking at all the tasks it has to do.
These guidelines are called niceness or nice value.
The "niceness" scale goes from
* -20 (highest priority value)
* 19 (lowest priority value)
* default is 0
The nice priority is actually used for user programs.
NOTE: Priority is all about managing processor time
[source,bash]
----
nice run a program with modified scheduling priority
chrt allows to set your scheduling policy as well as priority.
----
== Scheduler
[.float-group]
--
.Structure of the Linux kernel footnote:[By ScotXW - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=47075153[^]]
image::./Simplified_Structure_of_the_Linux_Kernel.svg[350,350,role="related thumb right"]
The scheduler is the Linux kernel part that decides which runnable process will be executed by the CPU next.
It handles CPU resource allocation for executing processes, and aims to maximize overall CPU utilization while also maximizing interactive performance.
--
[NOTE]
====
The scheduler makes it possible to execute multiple programs at the same time, thus sharing the CPU with users of varying needs.
* Minimizing response time
* Maximizing overall CPU utilization
====
TIP: Since Linux 2.6.23, the default scheduler is CFS, the "Completely Fair Scheduler". The
CFS scheduler replaced the earlier "O(1)" scheduler. footnote:[https://en.wikipedia.org/wiki/Completely_Fair_Scheduler[^]] footnote:[https://www.kernel.org/doc/html/latest/scheduler/index.html[^]]
== Context switching
*Context switch* is the process of storing the state of a process or thread, so that it can be restored and resume execution at a later point.
This allows multiple processes to share a single central processing unit (CPU), and is an essential feature of a multitasking operating system.
In the Linux kernel, context switching involves
* switching registers
* stack pointer
* program counter
* flushing the translation lookaside buffer (TLB)
* and loading the page table of the next process to run (unless the old process shares the memory with the new).
== Interrupts
An interrupt is an event that alters the normal execution flow of a program and can be generated by hardware devices or even by the CPU itself.
Interrupts can be grouped into two categories based on the source of the interrupt:
* synchronous, generated by executing an instruction
* asynchronous, generated by an external event
** For example a network card generates an interrupts to signal that a packet has arrived.
[source,bash]
----
Information related to hard interrupts at /proc/interrupts
----

79
Linux-process-management.tmp/Multithreaded_process.svg

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="450" height="425" id="svg2" sodipodi:version="0.32" inkscape:version="0.45.1" version="1.0" sodipodi:docbase="/home/cburnett/wikipedia/images/electronics" sodipodi:docname="Multithreaded process.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs id="defs4">
<marker inkscape:stockid="TriangleOutL" orient="auto" refY="0" refX="0" id="TriangleOutL" style="overflow:visible">
<path id="path3237" d="M 5.77,0 L -2.88,5 L -2.88,-5 L 5.77,0 z " style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none" transform="scale(0.8,0.8)"/>
</marker>
</defs>
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.49497475" inkscape:cx="379.55897" inkscape:cy="376.38393" inkscape:document-units="px" inkscape:current-layer="layer1" width="450px" height="425px" showgrid="true" inkscape:grid-points="true" inkscape:window-width="937" inkscape:window-height="965" inkscape:window-x="0" inkscape:window-y="31"/>
<metadata id="metadata7">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
</cc:Work>
</rdf:RDF>
</metadata>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path2160" sodipodi:cx="217.5" sodipodi:cy="182.5" sodipodi:rx="177.5" sodipodi:ry="177.5" d="M 395 182.5 A 177.5 177.5 0 1 1 40,182.5 A 177.5 177.5 0 1 1 395 182.5 z" transform="translate(-16.75,44.75)"/>
<g id="g3539">
<path style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 394,48 L 394,398 L 398,398 L 398,48 L 394,48 z " id="path3134"/>
<path style="fill-rule:evenodd;stroke:#000000;stroke-width:0.8pt;marker-start:none" d="M 396,416.464 L 380,388.784 L 412,388.784 L 396,416.464 z " id="path3545"/>
</g>
<switch style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="-235.112" y="438.11145" id="text3334-id" sodipodi:linespacing="125%" transform="matrix(0,-1,1,0,0,0)" systemLanguage="id"><tspan sodipodi:role="line" id="tspan3336-id" x="-235.112" y="438.11145" style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Waktu</tspan></text><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="-235.112" y="438.11145" id="text3334" sodipodi:linespacing="125%" transform="matrix(0,-1,1,0,0,0)"><tspan sodipodi:role="line" id="tspan3336" x="-235.112" y="438.11145" style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Time</tspan></text></switch>
<switch style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="198.40781" y="35.891998" id="text3338-id" sodipodi:linespacing="125%" systemLanguage="id"><tspan sodipodi:role="line" id="tspan3340-id" x="198.40781" y="35.891998" style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Proses</tspan></text><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="198.40781" y="35.891998" id="text3338" sodipodi:linespacing="125%"><tspan sodipodi:role="line" id="tspan3340" x="198.40781" y="35.891998" style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Process</tspan></text></switch>
<switch style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="118.40781" y="125.242" id="text3342-id" sodipodi:linespacing="125%" systemLanguage="id"><tspan sodipodi:role="line" id="tspan3344-id" x="118.40781" y="125.242" style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Utas #1</tspan></text><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="118.40781" y="125.242" id="text3342" sodipodi:linespacing="125%"><tspan sodipodi:role="line" id="tspan3344" x="118.40781" y="125.242" style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Thread #1</tspan></text></switch>
<switch style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="282.40781" y="125.892" id="text3346-id" sodipodi:linespacing="125%" systemLanguage="id"><tspan sodipodi:role="line" id="tspan3348-id" x="282.40781" y="125.892" style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Utas #2</tspan></text><text xml:space="preserve" style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" x="282.40781" y="125.892" id="text3346" sodipodi:linespacing="125%"><tspan sodipodi:role="line" id="tspan3348" x="282.40781" y="125.892" style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Century Schoolbook L">Thread #2</tspan></text></switch>
<g id="g3388" transform="translate(2.9914001,0)">
<g id="g3372">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3368" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3370" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
<g transform="translate(0,20)" id="g3376">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3378" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3380" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
</g>
<g id="g3410" transform="translate(169,40)">
<g id="g3412">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3414" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3416" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
<g transform="translate(0,20)" id="g3418">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3420" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3422" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
</g>
<g id="g3424" transform="translate(168,80)">
<g id="g3426">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3428" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3430" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
<g transform="translate(0,20)" id="g3432">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3434" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3436" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
</g>
<g id="g3466" transform="translate(2,120)">
<g id="g3468">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3470" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3472" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
<g transform="translate(0,20)" id="g3474">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3476" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3478" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
</g>
<g id="g3480" transform="translate(1,160)">
<g id="g3482">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3484" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3486" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
<g transform="translate(0,20)" id="g3488">
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3490" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true"/>
<path sodipodi:type="arc" style="opacity:1;fill:#ccccff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3492" sodipodi:cx="115" sodipodi:cy="140" sodipodi:rx="5" sodipodi:ry="5" d="M 115,145 A 5,5 0 1 1 115,135" sodipodi:start="1.5707963" sodipodi:end="4.712389" sodipodi:open="true" transform="matrix(-1,0,0,1,230,10)"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 19 KiB

BIN
Linux-process-management.tmp/Process_states.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

709
Linux-process-management.tmp/Simplified_Structure_of_the_Linux_Kernel.svg

@ -1,709 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="960"
height="540"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
viewBox="0 0 960 540"
sodipodi:docname="Simplified Structure of the Linux Kernel.svg">
<title
id="title4468">Simplified Structure of the Linux Kernel</title>
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.0466654"
inkscape:cx="565.33074"
inkscape:cy="257.20648"
inkscape:document-units="px"
inkscape:current-layer="boxes"
showgrid="false"
inkscape:snap-page="true"
inkscape:snap-grids="false"
inkscape:snap-to-guides="false"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-global="false"
inkscape:window-width="1920"
inkscape:window-height="991"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid4138" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Simplified Structure of the Linux Kernel</dc:title>
<dc:date>2016-02-20</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Shmuel Csaba Otto Traian Xerxes</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Shmuel Csaba Otto Traian Xerxes</dc:title>
</cc:Agent>
</dc:rights>
<dc:contributor>
<cc:Agent>
<dc:title>Andrew Stuart Tanenbaum</dc:title>
</cc:Agent>
</dc:contributor>
<dc:description>Illustrates three major components of the Linux kernel. Missing netfilter and nftables. Taken from &quot;Modern Operating Systems&quot; ISBN 0-13-359162-X</dc:description>
<dc:language>en-US</dc:language>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
<dc:publisher>
<cc:Agent>
<dc:title>https://commons.wikimedia.org/wiki/File:Simplified_Structure_of_the_Linux_Kernel.svg</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>https://commons.wikimedia.org/wiki/File:Simplified_Structure_of_the_Linux_Kernel.svg</dc:identifier>
<dc:source>https://commons.wikimedia.org/wiki/File:Simplified_Structure_of_the_Linux_Kernel.svg</dc:source>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="boxes"
inkscape:groupmode="layer"
id="boxes"
style="display:inline">
<rect
style="opacity:1;fill:#d3d7cf;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4136"
width="949"
height="519"
x="5.5"
y="15.499988"
rx="15"
ry="15" />
<rect
style="opacity:1;fill:#f2b2b2;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4153"
width="189"
height="389"
x="760.5"
y="105.5"
rx="14.999999"
ry="15" />
<rect
style="opacity:1;fill:#5fbcd3;fill-opacity:1;stroke:#000000;stroke-width:0.99999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4151"
width="194"
height="389"
x="555.5"
y="105.5"
rx="15.000001"
ry="15" />
<rect
style="opacity:1;fill:#99E399;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4149"
width="534"
height="389"
x="10.5"
y="105.5"
rx="15.000001"
ry="15" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="-1.1352539"
y="-7.6000977"
id="text4251"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4253"
x="-1.1352539"
y="-7.6000977">by Shmuel Csaba Otto Traian Xerxes; GFDL 1.3 &amp; CC-BY-SA 4.0; 2016-02-20</tspan></text>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="boxes 1">
<rect
style="opacity:1;fill:#FFD42A;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4140"
width="899"
height="29"
x="30.5"
y="5.5"
rx="15"
ry="15" />
<rect
style="opacity:1;fill:#0071C5;fill-opacity:1;stroke:#000000;stroke-width:0.99999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4155"
width="799"
height="29"
x="80.5"
y="499.535"
rx="15"
ry="14.999999" />
<rect
style="opacity:1;fill:#eeeeec;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4278"
width="379.5"
height="44.5"
x="87.75"
y="110.25" />
<rect
y="170.18628"
x="14.25"
height="39.5"
width="169.5"
id="rect4393"
style="opacity:1;fill:#93ac9d;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4402"
width="169.5"
height="39.5"
x="192.75"
y="170.18628" />
<rect
style="opacity:1;fill:#5fd3bc;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4404"
width="169.5"
height="39.5"
x="371.25"
y="170.18628" />
<rect
style="opacity:1;fill:#93AC9D;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4406"
width="169.5"
height="89.5"
x="14.25"
y="395.25" />
<rect
y="395.25"
x="192.75"
height="89.5"
width="169.5"
id="use4408"
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="395.25"
x="371.25"
height="89.5"
width="169.5"
id="use4410"
style="opacity:1;fill:#5fd3bc;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
y="381.88879"
x="567.75"
height="94.5"
width="169.5"
id="rect4418"
style="opacity:1;fill:#d7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="opacity:1;fill:#f7e2de;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4430"
width="169.5"
height="94.5"
x="770.25"
y="382.75" />
<rect
style="opacity:1;fill:#f7e2de;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4432"
width="169.5"
height="94.5"
x="770.25"
y="252.75" />
<rect
style="opacity:1;fill:#f7e2de;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4434"
width="169.5"
height="94.5"
x="770.25"
y="122.75001" />
<rect
style="opacity:1;fill:#d7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4436"
width="169.5"
height="94.5"
x="567.75"
y="122.75001" />
<rect
style="opacity:1;fill:#d7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="use4438"
width="169.5"
height="94.5"
x="567.75"
y="252.75" />
<rect
y="299.92123"
x="371.25"
height="89.5"
width="169.5"
id="rect4440"
style="opacity:1;fill:#5FD3BC;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="opacity:1;fill:#5FD3BC;fill-opacity:1;stroke:#000000;stroke-width:0.49999997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4442"
width="169.5"
height="69.5"
x="371.25"
y="222.15709" />
<rect
y="256.87418"
x="192.75"
height="86.251625"
width="169.5"
id="rect4444"
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:0.49999997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="opacity:1;fill:#93ac9d;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4456"
width="64.404327"
height="158.92691"
x="16.036583"
y="220.53654" />
<rect
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4245"
width="169.5"
height="29.5"
x="192.75"
y="222.15709" />
<rect
style="opacity:1;fill:#8dd35f;fill-opacity:1;stroke:#000000;stroke-width:0.49999994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4247"
width="169.5"
height="38.926716"
x="192.75"
y="350.49451" />
</g>
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="text">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="279.6991"
y="26.207275"
id="text4143"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4145"
x="279.6991"
y="26.207275"><tspan
style="font-size:15px"
id="tspan4446">Linux kernel</tspan> SCI (System Call Interface)</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4157"
y="520.93445"
x="253.58887"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="520.93445"
x="253.58887"
id="tspan4159"
sodipodi:role="line">IRQs</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="617.91077"
y="520.24231"
id="text4161"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4163"
x="617.91077"
y="520.24231">Dispatcher</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4165"
y="74.759521"
x="277.39746"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="74.759521"
x="277.39746"
id="tspan4167"
sodipodi:role="line">I/O subsystem</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="651.97876"
y="52.615356"
id="text4169"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="651.97876"
y="52.615356"
id="tspan4177">Memory</tspan><tspan
sodipodi:role="line"
x="651.97876"
y="74.490356"
id="tspan4179">management</tspan><tspan
sodipodi:role="line"
x="651.97876"
y="96.365356"
id="tspan4344">subsystem</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4173"
y="52.615356"
x="854.47876"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="52.615356"
x="854.47876"
sodipodi:role="line"
id="tspan4181">Process</tspan><tspan
y="74.490356"
x="854.47876"
sodipodi:role="line"
id="tspan4183">management</tspan><tspan
y="96.365356"
x="854.47876"
sodipodi:role="line"
id="tspan4342">subsystem</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="855"
y="162.14478"
id="text4185"
sodipodi:linespacing="125%"><tspan
id="tspan4191"
sodipodi:role="line"
x="855"
y="162.14478">Signal</tspan><tspan
sodipodi:role="line"
x="855"
y="190.26978"
id="tspan4232">handling</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4193"
y="280.26306"
x="855"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="280.26306"
x="855"
sodipodi:role="line"
id="tspan4199">process/thread</tspan><tspan
y="308.38806"
x="855"
sodipodi:role="line"
id="tspan4223">creation &amp;</tspan><tspan
y="336.51306"
x="855"
sodipodi:role="line"
id="tspan4225">termination</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="854.26941"
y="408.36362"
id="text4201"
sodipodi:linespacing="125%"><tspan
id="tspan4207"
sodipodi:role="line"
x="854.26941"
y="408.36362"
style="font-size:15px;text-align:center;text-anchor:middle">Linux kernel</tspan><tspan
sodipodi:role="line"
x="854.26941"
y="434.58923"
id="tspan4214"
style="text-align:center;text-anchor:middle">Process</tspan><tspan
sodipodi:role="line"
x="854.26941"
y="462.71423"
id="tspan4383"
style="text-align:center;text-anchor:middle">Scheduler</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4234"
y="162.14478"
x="651.81335"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
id="tspan4238"
y="162.14478"
x="651.81335"
sodipodi:role="line">Virtual</tspan><tspan
y="190.26978"
x="651.81335"
sodipodi:role="line"
id="tspan4242">memory</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="651.75293"
y="278.08228"
id="text4244"
sodipodi:linespacing="125%"><tspan
id="tspan4248"
sodipodi:role="line"
x="651.75293"
y="278.08228">Paging</tspan><tspan
sodipodi:role="line"
x="651.75293"
y="306.20728"
id="tspan4262">page</tspan><tspan
sodipodi:role="line"
x="651.75293"
y="334.33228"
id="tspan4264">replacement</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4250"
y="423.11829"
x="652.47803"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="423.11829"
x="652.47803"
sodipodi:role="line"
id="tspan4254">Page</tspan><tspan
y="451.24329"
x="652.47803"
sodipodi:role="line"
id="tspan4258">cache</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="455.45068"
y="196.14355"
id="text4288"
sodipodi:linespacing="125%"><tspan
id="tspan4292"
sodipodi:role="line"
x="455.45068"
y="196.14355">File systems</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4296"
y="249.05186"
x="454.98926"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="249.05186"
x="454.98926"
sodipodi:role="line"
id="tspan4298">Generic</tspan><tspan
y="277.17688"
x="454.98926"
sodipodi:role="line"
id="tspan4336">block layer</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="379.35938"
y="336.21295"
id="text4300"
sodipodi:linespacing="125%"><tspan
id="tspan4302"
sodipodi:role="line"
x="379.35938"
y="336.21295"
style="font-size:15px;text-align:start;text-anchor:start">Linux kernel</tspan><tspan
sodipodi:role="line"
x="379.35938"
y="362.43857"
id="tspan4304">I/O Scheduler</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4306"
y="420.26306"
x="455.93408"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
id="tspan4310"
y="420.26306"
x="455.93408"
sodipodi:role="line">Block</tspan><tspan
y="448.38806"
x="455.93408"
sodipodi:role="line"
id="tspan4334">device</tspan><tspan
y="476.51306"
x="455.93408"
sodipodi:role="line"
id="tspan4314">drivers</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4316"
y="198.32434"
x="277.31323"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="198.32434"
x="277.31323"
sodipodi:role="line"
id="tspan4318">Sockets</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="277.03308"
y="292.14478"
id="text4320"
sodipodi:linespacing="125%"><tspan
id="tspan4322"
sodipodi:role="line"
x="277.03308"
y="292.14478">Network</tspan><tspan
sodipodi:role="line"
x="277.03308"
y="320.26978"
id="tspan4324">protocols</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4326"
y="420.26306"
x="276.43982"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="420.26306"
x="276.43982"
sodipodi:role="line"
id="tspan4328">Network</tspan><tspan
id="tspan4330"
y="448.38806"
x="276.43982"
sodipodi:role="line">device</tspan><tspan
y="476.51306"
x="276.43982"
sodipodi:role="line"
id="tspan4332">drivers</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="99.587769"
y="198.32434"
id="text4349"
sodipodi:linespacing="125%"><tspan
id="tspan4351"
sodipodi:role="line"
x="99.587769"
y="198.32434">Terminals</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4353"
y="420.26306"
x="98.379272"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="420.26306"
x="98.379272"
sodipodi:role="line"
id="tspan4355">Character</tspan><tspan
y="448.38806"
x="98.379272"
sodipodi:role="line"
id="tspan4357">device</tspan><tspan
y="476.51306"
x="98.379272"
sodipodi:role="line"
id="tspan4359">drivers</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4361"
y="40.383522"
x="-300.02197"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
transform="matrix(0,-1,1,0,0,0)"><tspan
y="40.383522"
x="-300.02197"
sodipodi:role="line"
id="tspan4363">Line</tspan><tspan
y="68.508522"
x="-300.02197"
sodipodi:role="line"
id="tspan4365">discipline</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="173.62976"
y="122.74535"
id="text4280"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="173.62976"
y="122.74535"
id="tspan4373"><tspan
id="tspan4377"
style="font-size:15px;text-align:start;text-anchor:start">Linux kernel</tspan></tspan><tspan
sodipodi:role="line"
x="173.62976"
y="148.97096"
id="tspan4379">Virtual File System</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4232"
y="366.1749"
x="212.24487"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-size:15px;text-align:start;text-anchor:start"
y="366.1749"
x="212.24487"
sodipodi:role="line"
id="tspan4234">Linux kernel</tspan><tspan
y="384.9249"
x="212.24487"
sodipodi:role="line"
id="tspan4239"
style="font-size:15px">Packet Scheduler</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="277.13379"
y="241.90953"
id="text4241"
sodipodi:linespacing="125%"><tspan
id="tspan4243"
sodipodi:role="line"
x="277.13379"
y="241.90953"
style="font-size:15px">Netfilter / Nftables</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 32 KiB

BIN
Linux-process-management.tmp/fork-exec-exit-wait.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

45
Linux-process-management.tmp/index.js

@ -1,45 +0,0 @@
[
{
"chapter": 1,
"title": "Start a Lab",
"subtitle": "Absolute basics",
"type": "video",
"desc": "Simple Steps to Start Virtual Lab",
"service":"vimeo",
"file": "510376917"
},
{
"chapter": 2,
"title": "An Introduction to process management!",
"subtitle": "Life cycle of a process",
"type": "asciidoc",
"desc": "Process creation - fork() or clone() system calls",
"file": "processes.adoc"
},
{
"chapter": 2,
"title": "An Introduction to Linux !",
"subtitle": "Absolute basics",
"type": "asciinema",
"desc": "Absolute basics, File types, Access rights etc",
"file": "basics.cast"
},
{
"chapter": 3,
"title": "fork-exec",
"subtitle": "Life cycle of a process",
"type": "asciidoc",
"desc": "fork() is the the system call that the parent process uses to 'divide' itself ('fork') into two identical processes.",
"file": "Life_cycle_of_a_process.adoc"
},
{
"chapter": 3,
"title": "Linux file system layout",
"subtitle": "Absolute basics",
"type": "asciinema",
"desc": "Subdirectories of the root directory",
"file": "filesystem.cast"
}
]

112
Linux-process-management.tmp/processes.adoc

@ -1,112 +0,0 @@
= Linux process management !
Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Linux process management
:keywords: ps aux
:data-uri:
:toc: right
:toc-title: Table of contents
:toclevels: 4
:source-highlighter: highlight
:no-header-footer:
:nofooter:
:last-update-label!:
:icons: font
:sectnums:
== process
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.
In any modern operating system there can be more than one instance of a program loaded in memory at the same time.
== Linux process management
Operating systems need some ways to create processes.
* 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.
[NOTE]
====
*There are four principal events that cause a process to be created:*
* 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.
====
Process creation in UNIX and Linux are done through *fork()* or *clone()* system calls.
There are several steps involved in process creation.
* process scheduling,
* interrupt handling,
* signaling,
* process prioritization,
* 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/[^]]

BIN
Linux-process-management.tmp/program_in_memory2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

2
Linux-process-management/Life_cycle_of_a_process.adoc

@ -3,7 +3,9 @@ Apostolos rootApostolos@swarmlab.io
// Metadata:
:description: Life cycle of a process
:keywords: ps aux
ifndef::env-browser[]
:data-uri:
endif::[]
:toc: right
:toc-title: Table of contents
:toclevels: 4

Loading…
Cancel
Save