DEV Community

Anusree Anilkumar
Anusree Anilkumar

Posted on Originally published at anusree6154s.github.io on

01. Linux Basics

Linux Basics

image

Now some linux basics first so that we understand the working of K8s in comparison to physical servers much easily.

Data Center Rack
|-- Server 1
| |-- CPU, RAM, SSD/HDD, Network Card
| |--Linux Kernel
| |--Processes running
| |--nginx PID 101
| |--postgers PID 220
| |--node app PID 450
|-- Server 2
|-- Server 3
.
.
.

Enter fullscreen mode Exit fullscreen mode

Visualisation

Physical server

|-------------------|
| CPU --------------|-----> executes instructions
| RAM --------------|-----> process memory
| SSD/HDD ----------|-----> stores files/dbs/logs
| NIC/Network Card -|-----> sends and receives network packets
| -------------- |
| |Linux Kernel| ---|-----> schedules CPU time (sits between application
| -------------- | and hardware)
| | * manages memory
| Processes running:| * manages file systems
| nginx PID 101 | * manages networking via NIC
| postgres PID 220 |
| node app PID 450 |
|-------------------|

Enter fullscreen mode Exit fullscreen mode
  • Process = Program code + memory + CPU execution + kernel-managed resources
  • Linux Kernel
    • Sits between application and hardware
    • When app needs something, it initiates kernel and kernel initates disk for data
    • Eg:
node app
    |
    v
Kernel sys call
    |
    v
disk read
    |
    v
SSD returns bytes

Enter fullscreen mode Exit fullscreen mode
  • App never touches hardware directly. Kernel controls everything

Visualising Process in RAM

RAM
|-----------------------|
| Process: nginx |
|-----------------------|
| Process: postgres |
|-----------------------|
| Process: node |
|-----------------------|
| Linux Kernel Reserved |
|-----------------------|

Enter fullscreen mode Exit fullscreen mode
  • Each process getsisolated memory
  • Kernel prevent process A from reading process B’s memory

Top comments (0)