<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yassir El bakkari</title>
    <description>The latest articles on DEV Community by Yassir El bakkari (@yel-bakk).</description>
    <link>https://dev.to/yel-bakk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3876988%2Fcf77e555-05b4-48cb-a974-75e9e95e8aa6.jpg</url>
      <title>DEV Community: Yassir El bakkari</title>
      <link>https://dev.to/yel-bakk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yel-bakk"/>
    <language>en</language>
    <item>
      <title>Born2beRoot</title>
      <dc:creator>Yassir El bakkari</dc:creator>
      <pubDate>Tue, 14 Apr 2026 07:20:55 +0000</pubDate>
      <link>https://dev.to/yel-bakk/born2beroot-4lc1</link>
      <guid>https://dev.to/yel-bakk/born2beroot-4lc1</guid>
      <description>&lt;h2&gt;
  
  
  introduction
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Born2beRoot is a system administration project. In this project, we learn how to create and manage a virtual machine. We use tool VirtualBox to install an operating system.&lt;/p&gt;

&lt;p&gt;The goal of this project is to understand how a server works. We learn how to secure the system, manage users, and control services. We also learn how to use the terminal instead of a graphical interface.&lt;/p&gt;

&lt;p&gt;This project helps us understand the basics of Linux systems. It teaches us how to work step by step, follow rules, and solve problems by ourselves.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Virtual Machine (VM)
&lt;/h2&gt;

&lt;p&gt;A Virtual Machine (VM) is like a computer inside your computer.&lt;br&gt;
Now let's see Virtual Machine (VM)&lt;br&gt;
First, your real computer has hardware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU (processor)&lt;/li&gt;
&lt;li&gt;RAM (memory)&lt;/li&gt;
&lt;li&gt;Disk (storage)
On top of this hardware, you install a program like VirtualBox. This program is called a hypervisor.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;what is hypervisor ?&lt;br&gt;
A hypervisor (or Virtual Machine Monitor, VMM) is software that lets multiple operating systems run on a single physical machine. It manages hardware resources (CPU, memory, storage) and allocates them to virtual machines (VMs) without interference. This improves hardware utilization, reduces costs, and provides flexibility in cloud and server environments.&lt;/p&gt;

&lt;p&gt;How It Works ?&lt;br&gt;
A hypervisor runs on hardware or a host OS to create and manage virtual machines (VMs), each with its own virtual CPU, memory, storage, and network. It intercepts guest OS requests and translates them to physical hardware, ensuring isolation, security, and stability.&lt;br&gt;
&lt;a href="https://www.geeksforgeeks.org/system-design/hypervisor/" rel="noopener noreferrer"&gt;&lt;em&gt;The source👈🏻&lt;/em&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9t4synafqpfmhy3cjhtv.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9t4synafqpfmhy3cjhtv.webp" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Types of Hypervisor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type 1 Hypervisor:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dkd7dkk7k09f1myhf5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dkd7dkk7k09f1myhf5v.png" alt=" " width="750" height="443"&gt;&lt;/a&gt;&lt;br&gt;
A Type 1 hypervisor runs directly on the host's hardware. It doesn't rely on a host operating system. This architecture offers better performance and security because there is no intermediary OS. It's the standard for enterprise-level data centers and cloud providers like Amazon Web Services (AWS) and Microsoft Azure.&lt;/p&gt;

&lt;p&gt;Examples: VMware ESXi, Microsoft Hyper-V, KVM (Kernel-based Virtual Machine), and Xen.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High performance (direct hardware access).&lt;/li&gt;
&lt;li&gt;Strong security (no intermediate OS layer).&lt;/li&gt;
&lt;li&gt;Suitable for mission-critical workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires dedicated hardware.&lt;/li&gt;
&lt;li&gt;Setup and management are complex compared to Type-2.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;2. Type 2 Hypervisor&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7azg6l1979x5bbupmdif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7azg6l1979x5bbupmdif.png" alt=" " width="750" height="426"&gt;&lt;/a&gt;&lt;br&gt;
A Type 2 hypervisor runs on top of a conventional operating system (like Windows, macOS, or Linux). It's essentially an application within the host OS. This type is generally used for desktop virtualization, development, and testing environments where a user needs to run multiple OSs on their personal computer. Performance is slightly lower than Type 1 due to the overhead of the host OS.&lt;/p&gt;

&lt;p&gt;Examples: Oracle VM VirtualBox, VMware Workstation, and Parallels Desktop.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to install and use.&lt;/li&gt;
&lt;li&gt;Useful for development, testing, and malware analysis.&lt;/li&gt;
&lt;li&gt;Provides good host–guest integration features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slower performance (no direct hardware access).&lt;/li&gt;
&lt;li&gt;Security depends on the host OS; compromise of host may affect guests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mtmp7ne5jq4su39n1tb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mtmp7ne5jq4su39n1tb.webp" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hypervisor acts like a manager.&lt;/p&gt;

&lt;p&gt;When you create a virtual machine:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;It takes a part of your real CPU&lt;/li&gt;
&lt;li&gt;It takes a part of your RAM&lt;/li&gt;
&lt;li&gt;It creates a virtual disk (a file on your real disk)
Now, inside this virtual machine, you install an operating system like Debian.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;The virtual machine thinks it is a real computer.&lt;br&gt;
But in reality:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The CPU is not real → it is shared from your real CPU&lt;/li&gt;
&lt;li&gt;The RAM is not real → it is just a reserved part of your RAM&lt;/li&gt;
&lt;li&gt;The disk is just a file&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;When the VM runs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The OS inside the VM sends instructions (like open file, run program)&lt;/li&gt;
&lt;li&gt;These instructions go to the hypervisor&lt;/li&gt;
&lt;li&gt;The hypervisor translates them&lt;/li&gt;
&lt;li&gt;Then it sends them to the real hardware&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;So the flow is like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Program → OS (inside VM) → Hypervisor → Real Hardware&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is why virtualization is powerful:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You can run many systems on one computer&lt;/li&gt;
&lt;li&gt;You can test without breaking your real system&lt;/li&gt;
&lt;li&gt;You can create servers easily&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Creating the Virtual Machine
&lt;/h2&gt;

&lt;p&gt;To start the Born2beRoot project, we need to create a Virtual Machine using &lt;a href="https://www.virtualbox.org/" rel="noopener noreferrer"&gt;VirtualBox&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, we create a new virtual machine and give it a name that ends with 42 (example: login42). This is required.&lt;/p&gt;

&lt;p&gt;Then, we choose the operating system. We must use the latest stable version of &lt;a href="https://www.debian.org/download.en.html" rel="noopener noreferrer"&gt;Debian&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After that, we configure the machine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;choose RAM (enough for the system to work)&lt;/li&gt;
&lt;li&gt;create a virtual disk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The disk must be used later with LVM and encryption. This is very important in the project.&lt;/p&gt;

&lt;p&gt;We must also follow these rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no graphical interface (no desktop, no GUI)&lt;/li&gt;
&lt;li&gt;only a minimal installation&lt;/li&gt;
&lt;li&gt;the machine is used as a server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqv9ivupch5tuca9mgyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqv9ivupch5tuca9mgyi.png" alt=" " width="800" height="528"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7c4itqlwftxmghgdpa1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7c4itqlwftxmghgdpa1.png" alt=" " width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating the machine, we start it using a Debian ISO file and install the system.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Step 1: Attach the ISO file&lt;/p&gt;

&lt;p&gt;You go to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings → Storage&lt;/li&gt;
&lt;li&gt;Click “Empty”&lt;/li&gt;
&lt;li&gt;Choose your ISO file (example: debian-13.4.0-amd64-netinst.iso)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 What happens inside:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The ISO file acts like a virtual CD/DVD&lt;/li&gt;
&lt;li&gt;The VM will read it when it starts&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxyonkkz8bsv6xgp9twj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxyonkkz8bsv6xgp9twj.png" alt=" " width="800" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Step 2: Start the machine&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You click Start&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;👉 Inside the system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VirtualBox starts the VM&lt;/li&gt;
&lt;li&gt;VM checks boot device&lt;/li&gt;
&lt;li&gt;It finds the ISO (virtual CD)&lt;/li&gt;
&lt;li&gt;It loads the Debian installer into RAM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3: Debian Installer starts&lt;/p&gt;

&lt;p&gt;You will see menu:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install&lt;/li&gt;
&lt;li&gt;Graphical Install (DO NOT use for project ❌)
👉 Choose: Install&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx04mw3twrw4xn7ptfoje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx04mw3twrw4xn7ptfoje.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Step 4: Installation process&lt;/p&gt;

&lt;p&gt;Now step by step:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose language&lt;/li&gt;
&lt;li&gt;Choose country&lt;/li&gt;
&lt;li&gt;Configure keyboard&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdngcnd24tfkpo2j1j7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdngcnd24tfkpo2j1j7t.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8nd6thjw5josjy3eyd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8nd6thjw5josjy3eyd7.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;👉 Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;4. Network config (automatic usually)&lt;/li&gt;
&lt;li&gt;5. Set hostname (example: login42)&lt;/li&gt;
&lt;li&gt;6. Create root password&lt;/li&gt;
&lt;li&gt;7. Create user&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetrt1d9d6w4qws8vdwqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetrt1d9d6w4qws8vdwqp.png" alt=" " width="800" height="557"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdj6pt4x47txnffm6o0up.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdj6pt4x47txnffm6o0up.png" alt=" " width="800" height="557"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ccphx5zun1gvuqpve06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ccphx5zun1gvuqpve06.png" alt=" " width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Step 5: Disk partitioning (IMPORTANT)&lt;/p&gt;

&lt;p&gt;👉 Choose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Guided - use entire disk and set up encrypted LVM
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsh2ud8pc58u2hb04ihy3.png" alt=" " width="800" height="557"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We choose the disk which we wish to create the partition (it only have to show one disk).&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ua9iu9lsrtffp4xiz3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ua9iu9lsrtffp4xiz3p.png" alt=" " width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we choosed the disk we must make the partition as is in the subject. To do it properly we select the second option Separate /home partition.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsse1o6ylc6851icxk2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsse1o6ylc6851icxk2l.png" alt=" " width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We choose option Yes so the changes will be writen in the disk and so we can set the logical volume manager (LVM).&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flsxsn9erc27y1ogyxmyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flsxsn9erc27y1ogyxmyd.png" alt=" " width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We click on Cancel; the erasing of the data is not required.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0kj401y2qvlsrboa278u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0kj401y2qvlsrboa278u.png" alt=" " width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, we must choose desired password for the LVM encrypt. As is mention before we must repite the process and I advice you to write it down.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdck4cv7t6fnx7kjdskr5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdck4cv7t6fnx7kjdskr5.png" alt=" " width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;n this step we must input the required amount of volume group to use during the guided partitioning. We can write down max or the total avalaible memory, in this case being 30.8 GB.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Codexion</title>
      <dc:creator>Yassir El bakkari</dc:creator>
      <pubDate>Mon, 13 Apr 2026 15:50:23 +0000</pubDate>
      <link>https://dev.to/yel-bakk/codexion-4fk8</link>
      <guid>https://dev.to/yel-bakk/codexion-4fk8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Codexion is a concurrent system simulation written in C where multiple threads represent coders competing for limited shared resources called dongles, Each coder runs independently in parallel, and all coders must coordinate access to these resources without direct communication.&lt;/p&gt;

&lt;p&gt;At the system level, this project models how an operating system manages multiple processes competing for shared hardware, Each coder is implemented as a POSIX thread (pthread), and each dongle is protected using using synchronization primitives such as mutexes and condition variables to ensure safe access, Since multiple threads attempt to access the same resources at the same time, the program must prevent race conditions, deadlocks, starvation, and inconsistent shared state.&lt;/p&gt;

&lt;p&gt;Each coder repeatedly performs a cycle of actions: acquiring two dongles, compiling code, releasing resources, debugging, and refactoring. However, each coder has a strict time constraint: if they fail to compile within a given deadline, they are considered to have burned out, and the simulation stops. A separate monitor thread continuously checks the state of all coders and enforces this rule with high precision timing.&lt;/p&gt;

&lt;p&gt;The system also introduces a scheduling mechanism that controls how dongles are assigned when multiple coders request them at the same time. Depending on the selected policy (FIFO or EDF), the order of access changes dynamically based on request time or urgency. Additionally, a cooldown mechanism delays reuse of dongles after they are released, adding another layer of resource contention.&lt;/p&gt;

&lt;p&gt;Overall, Codexion is a low-level concurrency problem that requires careful coordination between threads, precise timing control, and efficient synchronization to ensure fairness, liveness, and correctness under strict constraints.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9isrrnm8su4bn265b9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9isrrnm8su4bn265b9v.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  System Overview
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;This project simulates a group of coders running in parallel using threads. Each coder is an independent execution flow controlled by the operating system. All coders share limited resources called dongles, which are protected to prevent conflicts when multiple coders try to use them at the same time.&lt;/p&gt;

&lt;p&gt;The system runs continuously in cycles. Each coder repeatedly tries to acquire two dongles, performs compiling, then releases the resources and moves to debugging and refactoring. Since resources are limited, coders may need to wait until dongles become available.&lt;/p&gt;

&lt;p&gt;At the same time, a monitoring system observes all coders and tracks their last compiling time. If a coder does not compile within the allowed time limit, the system stops and that coder is considered burned out.&lt;/p&gt;

&lt;p&gt;To manage fairness, the system uses a scheduling strategy (FIFO or EDF) that decides which coder gets access to a dongle when many coders request it at the same time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Core Concepts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Threads (POSIX Threads)&lt;/strong&gt;&lt;br&gt;
   A thread is a single flow of execution inside a process. In this project, each coder is represented by a thread created using POSIX threads.&lt;/p&gt;

&lt;p&gt;Inside the operating system, the CPU does not run all threads at the same time. Instead, it switches very fast between them using context switching. One thread runs for a short time, then it is paused, and another thread continues.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3qnf0tb93rwymetyqm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3qnf0tb93rwymetyqm7.png" alt=" " width="697" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All threads share the same memory space. This means they can access the same data, such as shared counters and shared dongles. Because of this shared memory, synchronization is required to avoid conflicts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Shared Resources (Dongles)&lt;/strong&gt;&lt;br&gt;
   Dongles are shared resources used by coders to compile. Each coder needs two dongles at the same time to perform the compiling step.&lt;/p&gt;

&lt;p&gt;Since all coders share a limited number of dongles, multiple threads may try to access the same resource simultaneously. Without control, this would lead to conflicts where two coders use the same dongle at the same time, which is not allowed.&lt;/p&gt;

&lt;p&gt;This is why dongles must be protected using synchronization tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Mutex (Mutual Exclusion)&lt;/strong&gt;&lt;br&gt;
   A mutex is a locking mechanism used to protect shared resources. Only one thread can lock a mutex at a time.&lt;/p&gt;

&lt;p&gt;When a coder locks a dongle, other coders trying to access it will be blocked by the operating system and placed in a waiting state.&lt;/p&gt;

&lt;p&gt;The OS manages this waiting internally using kernel queues. The blocked thread does not consume CPU time until it is allowed to continue.&lt;/p&gt;

&lt;p&gt;Mutexes ensure that shared resources are used safely without data corruption or simultaneous access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Synchronization and Critical Sections&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A critical section is a part of the program where shared resources are accessed or modified.&lt;/p&gt;

&lt;p&gt;In this project, critical sections include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Taking dongles&lt;/li&gt;
&lt;li&gt;Updating last compilation time&lt;/li&gt;
&lt;li&gt;Incrementing compile counters&lt;/li&gt;
&lt;li&gt;Printing logs
Only one thread can execute a critical section protected by a mutex at a time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only one thread can execute a critical section protected by a mutex at a time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Scheduling (FIFO and EDF)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When multiple coders try to take the same dongle at the same time, a scheduling policy decides who gets it first.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;FIFO (First In First Out):&lt;/em&gt;&lt;br&gt;
The coder who requests the resource first is served first. Requests are handled in arrival order.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;EDF (Earliest Deadline First):&lt;/em&gt;&lt;br&gt;
Each coder has a deadline based on:&lt;br&gt;
last compile time + time to burnout.&lt;br&gt;
The coder with the closest deadline gets priority.&lt;/p&gt;

&lt;p&gt;This scheduling is implemented using a priority system that organizes waiting threads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Monitor System (Burnout Detection)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A separate monitor thread continuously checks the state of all coders.&lt;/p&gt;

&lt;p&gt;It compares the current time with each coder’s last compilation time. If a coder exceeds the allowed time without compiling, the monitor triggers a burnout event and stops the simulation.&lt;/p&gt;

&lt;p&gt;This monitor acts like a watchdog system inside the program, ensuring that no coder stays inactive for too long.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Lifecycle of a Coder&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each coder repeats the same cycle during execution:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, the coder tries to acquire two dongles. If successful, it enters the compiling phase.&lt;/li&gt;
&lt;li&gt;After compiling, the coder releases the dongles and moves to debugging, where it waits for a fixed amount of time.&lt;/li&gt;
&lt;li&gt;Then the coder enters refactoring, another waiting phase.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After completing these steps, the coder returns again to try compiling.&lt;/p&gt;

&lt;p&gt;This cycle continues until the system stops due to burnout or completion condition.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Concurrency Problems
&lt;/h2&gt;

&lt;p&gt;In a multi-thread system like this project, running threads at the same time creates several hidden problems. These problems do not appear in normal single-thread programs, but they become critical when many coders share the same resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Race Conditions&lt;/strong&gt;&lt;br&gt;
A race condition happens when multiple threads try to read and write the same shared data at the same time.&lt;br&gt;
&lt;a href="https://youtu.be/MqnpIwN7dz0?si=N0S1021gJmiCc2Cu" rel="noopener noreferrer"&gt;1- video (YouTube)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://youtu.be/FY9livorrJI?si=7Yw2fd6_TD0iHb9G" rel="noopener noreferrer"&gt;2- video (YouTube)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In this project, shared data includes:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;last compilation time&lt;/li&gt;
&lt;li&gt;compile counters&lt;/li&gt;
&lt;li&gt;dongle state&lt;/li&gt;
&lt;li&gt;log output&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If two threads update the same variable without protection, the final value becomes unpredictable. It depends on which thread executes first, which is decided by the OS scheduler.&lt;/p&gt;

&lt;p&gt;To prevent this, mutexes are used to ensure that only one thread modifies shared memory at a time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Deadlock&lt;/strong&gt;&lt;br&gt;
   A deadlock happens when threads block each other in a circular way, and none of them can continue execution.&lt;br&gt;
&lt;a href="https://youtu.be/LjWug2tvSBU?si=aeHpfnwBIeQOnLD-" rel="noopener noreferrer"&gt;video (YouTube)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this project, each coder needs two dongles. If every coder locks one dongle and waits for the second one, all threads can become stuck forever.&lt;/p&gt;

&lt;p&gt;The system prevents this by changing the order of resource acquisition depending on the coder ID (even or odd). This breaks the circular waiting condition and avoids deadlock.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Starvation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Starvation happens when a thread never gets access to a required resource because other threads are always prioritized before it.&lt;/p&gt;

&lt;p&gt;In scheduling systems like FIFO or EDF, a poorly designed priority system could continuously favor some coders and block others indefinitely.&lt;/p&gt;

&lt;p&gt;To avoid starvation, the scheduling logic ensures fairness by controlling the order of access to dongles and respecting either arrival time (FIFO) or urgency (EDF).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Livelock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A livelock happens when threads are not blocked, but they keep changing state without making progress.&lt;/p&gt;

&lt;p&gt;For example, coders may repeatedly try to acquire dongles but always fail because others take them first. They stay active but never reach the compiling phase.&lt;/p&gt;

&lt;p&gt;Careful scheduling and controlled locking reduce this behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Resource Contention&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since the system depends on precise timing (burnout detection), small delays can affect correctness.&lt;/p&gt;

&lt;p&gt;If thread scheduling or locking delays are too slow, a coder may exceed the allowed time before being checked by the monitor.&lt;/p&gt;

&lt;p&gt;This is why the monitor must run frequently and efficiently, and shared state updates must be protected and fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Threads (Deep System Explanation)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. What a thread really is (system level)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A thread is the smallest unit of execution the operating system can schedule on the CPU.&lt;br&gt;
&lt;a href="https://youtu.be/hN2Yrf4tqTY?si=lNDttdaT2Ae79-av" rel="noopener noreferrer"&gt;1. video (YouTube)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://youtu.be/4rLW7zg21gI?si=29ToJ3iyHH2hzaUW" rel="noopener noreferrer"&gt;2. video (YouTube)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://youtu.be/M9HHWFp84f0?si=BuBSjcHBxJjbBbhw" rel="noopener noreferrer"&gt;3. video (YouTube)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside the OS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A process is a container of memory (code, heap, globals).&lt;/li&gt;
&lt;li&gt;A thread is a running path inside that memory.
So when you create threads with POSIX:&lt;/li&gt;
&lt;li&gt;you are not creating “new programs”&lt;/li&gt;
&lt;li&gt;you are creating multiple CPU execution paths inside the same process&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each thread has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;its own register state (CPU state)&lt;/li&gt;
&lt;li&gt;its own stack (function calls, local variables)&lt;/li&gt;
&lt;li&gt;shared access to heap and global memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The OS scheduler sees each thread as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a runnable entity that competes for CPU time
So it continuously switches between threads using context switching.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tp5vb1rb7tpp3wx4n01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tp5vb1rb7tpp3wx4n01.png" alt=" " width="697" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Thread creation: pthread_create&lt;/strong&gt;&lt;br&gt;
When you call:&lt;br&gt;
&lt;code&gt;pthread_create(&amp;amp;thread, NULL, routine, arg);&lt;/code&gt;&lt;br&gt;
nternally the OS does:&lt;/p&gt;

&lt;p&gt;Allocate a thread control block (TCB)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new stack for the thread&lt;/li&gt;
&lt;li&gt;Store the starting function pointer (routine)&lt;/li&gt;
&lt;li&gt;Put the thread in the ready queue&lt;/li&gt;
&lt;li&gt;Mark it as runnable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At this point:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the thread exists&lt;/li&gt;
&lt;li&gt;but it may not run immediately&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The scheduler decides when it gets CPU time.&lt;/p&gt;

</description>
      <category>codexion</category>
      <category>1337</category>
      <category>42</category>
    </item>
  </channel>
</rss>
