Note - Week 1


 x86_64 => architecture of Intel's 64-bit CPU

AArch64 => 64-bit Execution sate of the ARM architecture family (e.g. Mac M1)


There are two ways of binary representation of numbers

 1. Ones' Complement

 2. Twos' Complement


There are two ways of representing fractional numbers

 1. Fixed Point

 2. Floating Point


Sound(music), Image(picture), video(sound + image) they are all represented in binary numbers. Everything on computer is represented as binary numbers.


How a computer works 

The answer is generated by ChatGPT-4o


1. Power-On

When you press the power button, electricity flows from the power supply to the various components of the computer. The key components involved at this stage are:

  • Power Supply Unit (PSU): It provides the necessary voltage and current to the motherboard, CPU, memory, and other devices.
  • Power Good Signal: Once the PSU stabilizes, it sends a "power good" signal to the motherboard, indicating that it's safe for the components to start operating.

2. The CPU Starts

  • As soon as the motherboard receives the "power good" signal, it activates the clock signal that drives the CPU.
  • The CPU starts executing code, but it doesn’t jump directly to the operating system yet. Instead, it begins executing a special program stored in read-only memory (ROM), called the BIOS or UEFI (modern version of BIOS).

3. BIOS/UEFI Initialization

  • BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) is firmware embedded in the motherboard that is the first code the CPU runs after being powered on. It is stored in non-volatile memory (like flash memory) so that it persists even when the computer is off.
  • The BIOS/UEFI performs a series of tasks, including:
    • POST (Power-On Self Test): It checks that the critical hardware components like the CPU, memory, and essential peripherals are working correctly.
    • Initialization of hardware components: The BIOS/UEFI initializes various hardware components such as disk controllers, USB ports, and the video card.

4. Boot Loader and Boot Sequence

  • After the BIOS/UEFI has finished initializing the hardware and running POST, it looks for a bootable device, such as a hard drive, SSD, or USB drive, that contains the bootloader.
  • The bootloader is a small program that is responsible for loading the operating system into the computer's main memory (RAM).
    • Common bootloaders include GRUB (for Linux) or Windows Boot Manager.

5. Loading the Operating System

  • Once the bootloader is located, it is loaded into memory and executed by the CPU.
  • The bootloader’s job is to load the kernel of the operating system (the core part of the OS) from the storage device into RAM.
  • The kernel manages all fundamental tasks, including:
    • Managing memory and CPU resources.
    • Communicating with hardware.
    • Launching the rest of the OS.

6. Operating System Initialization

  • After the kernel is loaded into memory, it takes control of the system. The kernel starts initializing the rest of the OS, including the system services, device drivers, and any necessary user interfaces.
  • At this point, the operating system is fully loaded into RAM and ready for you to use. The OS can now start running applications and interacting with input devices like the keyboard and mouse.

Simplified Flow:

  1. Power-on: Electricity flows from the power supply, and the motherboard receives a power signal.
  2. CPU starts: The CPU executes the BIOS/UEFI code stored in ROM.
  3. POST: The system runs hardware checks and initializes components.
  4. Boot device found: The BIOS/UEFI locates the bootloader on a storage device.
  5. Load OS: The bootloader loads the operating system kernel into RAM.
  6. OS takes over: The OS initializes and provides the user interface.

Key Points:

  • The BIOS/UEFI is the first thing the CPU runs. It exists to initialize hardware and find the bootloader.
  • The bootloader is the next step, and it’s responsible for loading the OS from storage to memory.
  • Finally, the operating system is loaded into RAM, and the computer is ready to use.



Comments

popular posts in this blog

Project Stage 2 - part 2 : Clone-Pruning Analysis Pass

Project Stage 2 part 4 - Testing clone-test-core.c file with Modified GCC file and making further modification

Project Stage 2 part 3 - Compile a program with revised GCC