Advertisement

HexaGuard: Mastering the Art of Digital Shadows

🔍 OS Architecture

 

🔍 OS Architecture Breakdown

The OS architecture consists of three main layers:

  • Kernel 🖥️: The heart of the OS, managing hardware resources, processes, and system services.
  • Shell ⌨️: The interface for users to interact with the kernel through commands.
  • User Space 🌍: Where all user-level applications and utilities run, communicating with the kernel through system calls.
  • System Calls 🔄: The bridge for user programs to interact with the kernel, like file manipulation, process control, and more!

1. Kernel (The Brain of the OS) 🧠

The kernel is the core component of the OS and works in privileged mode to handle:

  • Hardware management ⚙️ (CPU, memory, devices)
  • Process scheduling 🕒
  • Memory management 💻

It ensures that applications can run without directly accessing the hardware.


2. Shell (Your Command Center) 🎮

The shell allows users to interact with the OS by typing commands. It translates your input into actions taken by the kernel.

  • Windows CMD 🪟: The traditional command-line interface for basic tasks.
  • PowerShell ⚡: A more powerful scripting shell that allows advanced tasks and automation.
  • Bash 💥: The go-to shell in Unix/Linux for interacting with the system via commands.

3. User Space (Where the Magic Happens) ✨

The user space holds all the user applications and programs running on the system. These apps communicate with the kernel through system calls to request system services, like reading files or creating processes.


4. System Calls (The OS Middleman) 🔄

System calls are like the "middlemen" between user programs and the kernel. They allow programs to request specific actions from the kernel, such as:

  • File manipulation 📂
  • Memory management 🧑‍💻
  • Process control ⚙️

Hands-On Command Examples 🛠️

CMD (Windows) 💻

cmd

# Check Kernel version systeminfo | findstr /B /C:"OS" # List running processes tasklist # Get system architecture wmic os get osarchitecture

PowerShell (Windows)

powershell

# Get Kernel version [System.Environment]::OSVersion # List processes Get-Process # Check system architecture [System.Environment]::Is64BitOperatingSystem

Bash (Linux/macOS) 🐧

bash

# Get Kernel version uname -r # List running processes ps aux # Check system architecture uname -m

System Call Examples 🔄

Windows (CMD/PowerShell) 🔧

  • File Operations 📝:

    powershell

    # Read a file Get-Content C:\path\to\file.txt
  • Process Creation 🚀:

    cmd

    # Launch a new process start notepad.exe

Linux (Bash) 🐚

  • File System Calls 📁:

    bash

    # Create a new file and write to it echo "Hello, World!" > hello.txt
  • Process Creation 🏃‍♂️:

    bash

    # Run a script in the background ./script.sh &

Recap ✨

  • Kernel 🧠: Manages system resources and handles processes.
  • Shell 🎮: Interface between you and the kernel through commands.
  • User Space 🌍: Where your applications live.
  • System Calls 🔄: Interactions between user programs and kernel for actions like file handling, process creation, etc.

Post a Comment

0 Comments