Last Sync: 2022-09-07 19:30:05
This commit is contained in:
parent
c63c288e76
commit
fd875b926c
4 changed files with 72 additions and 42 deletions
|
@ -4,14 +4,26 @@ categories:
|
|||
tags: [physics, electricity]
|
||||
---
|
||||
|
||||
# Coulombs Laws
|
||||
# Coulombs Laws
|
||||
|
||||
Coulomb's Laws express the fundamental relationship between charge, force and attraction. They are also known as the **Electrostatic Laws**.
|
||||
Coulomb's Laws express the fundamental relationship between electric charge, force and attraction. They are also known as the **Electrostatic Laws** and define **the electic force**.
|
||||
|
||||
## First Law
|
||||
## First Law
|
||||
|
||||
> Like charges of electricity repel each other. Unlike charges attract each other.
|
||||
> Like charges of electricity repel each other. Unlike charges attract each other.
|
||||
|
||||
Within the atom we see this at work in the way that negatively charged electrons are attracted to the positively charged nucleus. This attractive force is balanced by the centrifugal force caused by the electron's rotation around the nucleus. This keeps the electrons in orbit. Without it, they would spiral into the nucleus.
|
||||
Within the atom we see this at work in the way that negatively charged electrons are attracted to the positively charged nucleus. This attractive force is balanced by the centrifugal force caused by the electron's rotation around the nucleus. This keeps the electrons in orbit. Without it, they would spiral into the nucleus.
|
||||
|
||||
Within circuits, the first law dictates the movement of charge from negatively charged atoms to positively charged atoms through the conductor.
|
||||
Within circuits, the first law dictates the movement of charge from negatively charged atoms to positively charged atoms through the conductor.
|
||||
|
||||
## Second Law
|
||||
|
||||
The attraction or repulsion between charges acts along the line between the two charges.
|
||||
|
||||
## Third Law
|
||||
|
||||
The size of the electric force varies inversely as the square of the distance between the two charges. Thus if the distance between the two charges is doubled, the attraction or repulsion becomes weaker, decreasing to a quarter of the original value.
|
||||
|
||||
## Fourth Law
|
||||
|
||||
The size of the electric force is proportional to the value of each charge measured in coulombs.
|
||||
|
|
|
@ -6,32 +6,41 @@ tags: [motherboard]
|
|||
---
|
||||
|
||||
#
|
||||
# Bus
|
||||
A bus is a communication system that transfers data between components inside a computer, or between computers.
|
||||
|
||||
## Main buses
|
||||
# Bus
|
||||
|
||||
A bus is a communication system that transfers data between components inside a computer, or between computers.
|
||||
|
||||
## Main buses
|
||||
|
||||
### System bus
|
||||
The primary pathway between the CPU and [memory](Memory/Basics.md). It comprises the **data bus** that transfers data from the memory to the CPU and the **address bus** which transmits requests from the CPU to memory.
|
||||
|
||||
The primary pathway between the CPU and [memory](Memory/Basics.md). It comprises the **data bus** that transfers data from the memory to the CPU and the **address bus** which transmits requests from the CPU to memory.
|
||||
|
||||
### Internal bus
|
||||
|
||||
Connects local devices for example the harddisk to the CPU.
|
||||
|
||||
### External bus
|
||||
Connects peripheral devices such as disks and printers to the [motherboard](Motherboard.md)
|
||||
|
||||
Connects peripheral devices such as disks and printers to the [motherboard](/Hardware/Motherboard.md)
|
||||
|
||||
### Expansion bus
|
||||
Allows expansion boards to access the CPU and memory.
|
||||
|
||||
Allows expansion boards to access the CPU and memory.
|
||||
|
||||
### Frontside bus
|
||||
|
||||
Main computer bus that determines data transfer rate speed and is the primary data transfer path between the CPU, RAM and other [motherboard](Motherboard.md) devices.
|
||||
|
||||
### Backside bus
|
||||
|
||||
Transfers secondary cache (L2 cache) data at faster speeds, allowing more efficient CPU operations
|
||||
|
||||
## Bus standards
|
||||
|
||||
### Parallel and serial transmission types
|
||||
|
||||
There is a distinction between buses that use serial and buses that use parallel transmission. They are distinguished by the way in which data in the form of bits is transferred from one point to another, along the bus.
|
||||
|
||||
Serial Transmission is the type of transmission in which a single communication link is used to transfer the data from an end to another. On other hand Parallel Transmission is the transmission in which multiple parallel links are used that transmit each bit of data simultaneously.
|
||||
|
@ -39,18 +48,21 @@ Serial Transmission is the type of transmission in which a single communication
|
|||
<img src="../img/serial-transmission.jpg" width="800px"/>
|
||||
<img src="../img/parallel-transmission.jpg" width="800px"/>
|
||||
|
||||
* Serial buses are cheaper to implement than parallel buses
|
||||
* Serial buses operate at greater [latency](/Hardware/Bus.md#latency) than parallel buses
|
||||
## Latency
|
||||
- Serial buses are cheaper to implement than parallel buses
|
||||
- Serial buses operate at greater [latency](/Hardware/Bus.md#latency) than parallel buses
|
||||
|
||||
## Latency
|
||||
|
||||
Latency means _delay_: the delay from the time the data is requested until the time it arrives. In the context of a microprocesser and buses a key locus of latency would be between the time a request takes to travel accross the system bus from the CPU to the memory.
|
||||
|
||||
### Bandwidth
|
||||
In general, bandwidth is a measure of the capacity for a communications channel to transmit data. A bus is a channel between two components thus we can talk about the bandwidth of buses. The speed and efficiency of a bus is a function of its bandwidth, although other factors such as its length and proximity to the source and receiver are also important.
|
||||
### Bandwidth
|
||||
|
||||
In general, bandwidth is a measure of the capacity for a communications channel to transmit data. A bus is a channel between two components thus we can talk about the bandwidth of buses. The speed and efficiency of a bus is a function of its bandwidth, although other factors such as its length and proximity to the source and receiver are also important.
|
||||
|
||||
Bandwidth can be calculated in terms of how many bits can be transferred per second. The wider the bus, the more bits that can be transferred. If we have a bus that can run at 66MHz and transfer 64 bits, 64 bits is 8Mb thus the bandwidth is 8 x 66 = 528Mb.
|
||||
|
||||
## Standards
|
||||
|
||||
The mode of transmission is used to distinguish the different bus standards.
|
||||
|
||||
SCSI (Small Computer System Interface) and ATA (Advanced Technology Attachment) are used for hard drive devices (i.e. internal buses). USB (Univeral Serial Bus) and SATA (Serial Advanced Technology Attachment) are used for peripheral devices, keyboards and modem devices (i.e external buses).
|
||||
|
|
|
@ -36,4 +36,8 @@ Cache controllers use complex algorithms to determine what should go into the ca
|
|||
|
||||
## Relation between cache and buffers
|
||||
|
||||
The terms _cache_ and _buffer_ are often used interchangeably but there is a significant difference. Buffer 'size' refers to the amount of physical memory in RAM that is dedicated to a process where this size is measured in terms of the amount of disk blocks it would take up in the harddrive. Cache is also a measure of memory but it is expressed in terms of [virtual memory](/Operating_Systems/Virtual_memory_and_the_MMU.md): the page size of the memory.
|
||||
The terms _cache_ and _buffer_ are often used interchangeably but there is a significant difference. Buffer 'size' refers to the amount of physical memory in RAM that is dedicated to a process where this size is measured in terms of the amount of disk blocks it would take up in the harddrive. Cache is also a measure of memory but it is expressed in terms of [virtual memory](/Operating_Systems/Virtual_memory_and_the_MMU.md): the page size of the memory.
|
||||
|
||||
Buffers and caches are both mechanisms for avoiding writing data to a storage device in the midst of active computation. Every time data is saved, the OS doesn't immediately write it to disk. It keeps it in the most short term memory in case it is edited again or until the processor is free. In this state it is kept in buffers. When written to disk it becomes blocks. This is why you shouldn't immediately remove a disk device without first saving / syncing int.
|
||||
|
||||
Similarly with transferring memory to and from the RAM. The OS keeps occurent memory in the processor caches to enable reuse and not to overburden the CPU, this page data is then moved to RAM when convenient.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
categories:
|
||||
categories:
|
||||
- Linux
|
||||
- Operating_Systems
|
||||
tags:
|
||||
|
@ -7,29 +7,29 @@ tags:
|
|||
- bootloader
|
||||
---
|
||||
|
||||
|
||||
# The boot process
|
||||
|
||||
The primary or boot [partition](Disks.md#primary-extended-and-logical-partitions) of a harddisk contains a bootloader. It is the job of the bootloader to locate the [kernel](The_Kernel.md) on the harddrive and inject it into memory so that they operating system can start. This is the boot process.
|
||||
The primary or boot [partition](Disks.md#primary-extended-and-logical-partitions) of a harddisk contains a bootloader. It is the job of the bootloader to locate the [kernel](/Operating_Systems/The_Kernel.md) on the harddrive and inject it into memory so that they operating system can start. This is the boot process.
|
||||
|
||||
## Boot loaders
|
||||
|
||||
The boot loader loads the kernel into memory from the disk and then starts the kernel with a set of kernel parameters.
|
||||
The boot loader loads the kernel into memory from the disk and then starts the kernel with a set of kernel parameters.
|
||||
|
||||
Like the kernel itself, the boot loader requires a driver in order to access the disk but it can't use the same one as the kernel since at this point, the kernel is not yet loaded into memory. So it has its own special driver: this is either the BIOS or the UEFI firmware.
|
||||
Like the kernel itself, the boot loader requires a driver in order to access the disk but it can't use the same one as the kernel since at this point, the kernel is not yet loaded into memory. So it has its own special driver: this is either the BIOS or the UEFI firmware.
|
||||
|
||||
A boot loader's core functionality includes the ability to do the following:
|
||||
* select from multiple kernels
|
||||
* switch between sets of kernel parameters
|
||||
* provide support for booting other operating systems
|
||||
|
||||
### BIOS and UEFI
|
||||
- select from multiple kernels
|
||||
- switch between sets of kernel parameters
|
||||
- provide support for booting other operating systems
|
||||
|
||||
### BIOS and UEFI
|
||||
|
||||
BIOS and UEFI are both firmware that is installed directly on the motherboard of the computer. They are firmware because they are software that is permanent and programmed into read-only memory.
|
||||
|
||||
In the context of disks, their most crucial role is locating the operating system on the harddisk and loading it into memory so that the bootstrapping process can begin. However they are also responsible for the computer clock and the management of peripherals.
|
||||
In the context of disks, their most crucial role is locating the operating system on the harddisk and loading it into memory so that the bootstrapping process can begin. However they are also responsible for the computer clock and the management of peripherals.
|
||||
|
||||
As we can see from the `fdisk` readout, the boot partition uses EFI, the storage partition associated with UEFI.
|
||||
As we can see from the `fdisk` readout, the boot partition uses EFI, the storage partition associated with UEFI.
|
||||
|
||||
```bash
|
||||
Device Start End Sectors Size Type
|
||||
|
@ -38,22 +38,22 @@ Device Start End Sectors Size Type
|
|||
/dev/nvme0n1p3 59594752 1000214527 940619776 448.5G Linux filesystem
|
||||
```
|
||||
|
||||
|
||||
Whilst UEFI is installed on the hardware, most of its configuration is stored in the EFI partition on the disk, whereas with BIOS, everything is on the chip. This make booting faster with UEFI.
|
||||
|
||||
Even though most modern computers use UEFI, it may still be referred to as BIOS for user-continuity. This is like on Windows. With Linux you have to explicitly create your boot process so the two are clearly distinguishable.
|
||||
Even though most modern computers use UEFI, it may still be referred to as BIOS for user-continuity. This is like on Windows. With Linux you have to explicitly create your boot process so the two are clearly distinguishable.
|
||||
|
||||
### GRUB
|
||||
|
||||
The de facto standard boot loader for Linux is GRUB: Grand Unified Boot Loader.
|
||||
The de facto standard boot loader for Linux is GRUB: Grand Unified Boot Loader.
|
||||
|
||||

|
||||
|
||||
You see the GRUB default menu when you first start a Linux machine. It will offer you various options for loading your installed OS or other OSs. GRUB is a filesystem like the main disk. If you press `e` in this screen you can view and edit specific boot parameters. Pressing `c` gives you access to the GRUB command line interface. This allows you to interact with GRUB in the same way as you would with any other filesystem, allowing for advanced configuration.
|
||||
You see the GRUB default menu when you first start a Linux machine. It will offer you various options for loading your installed OS or other OSs. GRUB is a filesystem like the main disk. If you press `e` in this screen you can view and edit specific boot parameters. Pressing `c` gives you access to the GRUB command line interface. This allows you to interact with GRUB in the same way as you would with any other filesystem, allowing for advanced configuration.
|
||||
|
||||
## The boot sequence
|
||||
1. The machine's BIOS or boot firmware (in the case of UEFI) loads and runs a boot loader. It finds the bootloader by looking for the part of the disk that contains either the MBR or GPT sector.
|
||||
2. The boot loader finds the kernel image on disk, loads it into memory and starts it.
|
||||
## The boot sequence
|
||||
|
||||
1. The machine's BIOS or boot firmware (in the case of UEFI) loads and runs a boot loader. It finds the bootloader by looking for the part of the disk that contains either the MBR or GPT sector.
|
||||
2. The boot loader finds the kernel image on disk, loads it into memory and starts it.
|
||||
3. The kernel initializes the devices and its drivers.
|
||||
4. The kernel mounts the root filesystem.
|
||||
5. The kernel starts a program called **init**. It has a [process id](/Programming_Languages/Shell_Scripting/Processes.md#processes-ps) of 1. This is the point at which [user space](User_Space.md) starts.
|
||||
|
@ -61,6 +61,7 @@ You see the GRUB default menu when you first start a Linux machine. It will offe
|
|||
7. At the end of the boot process, init starts a process allowing you to log in.
|
||||
|
||||
## Boot diagnostics
|
||||
|
||||
Linux keeps a log of the boot process as part of the [journal]() log of everything that happens on disk. We can use the command `journalct -k` to view the diagnostics generated during the boot. Here is a selection:
|
||||
|
||||
```
|
||||
|
@ -88,7 +89,7 @@ Jul 07 07:12:58 archbish kernel: BIOS-e820: [mem 0x0000000094b2f000-0x0000000094
|
|||
Jul 07 07:12:58 archbish kernel: BIOS-e820: [mem 0x0000000094bff000-0x0000000094bfffff] usable
|
||||
Jul 07 07:12:58 archbish kernel: NX (Execute Disable) protection: active
|
||||
Jul 07 07:12:58 archbish kernel: efi: EFI v2.70 by Lenovo
|
||||
Jul 07 07:12:58 archbish kernel: efi: ACPI=0x94bfe000 ACPI 2.0=0x94bfe014 SMBIOS=0x90cbd000 SMBIOS 3.0=0x90cb0000 TPMFinalLog=0x9498f000 MEMATTR=0x8aa30018 ESRT=0x8ab9c000
|
||||
Jul 07 07:12:58 archbish kernel: efi: ACPI=0x94bfe000 ACPI 2.0=0x94bfe014 SMBIOS=0x90cbd000 SMBIOS 3.0=0x90cb0000 TPMFinalLog=0x9498f000 MEMATTR=0x8aa30018 ESRT=0x8ab9c000
|
||||
Jul 07 07:12:58 archbish kernel: SMBIOS 3.2.0 present.
|
||||
Jul 07 07:12:58 archbish kernel: DMI: LENOVO 20W4000NUK/20W4000NUK, BIOS N34ET40W (1.40 ) 06/25/2021
|
||||
Jul 07 07:12:58 archbish kernel: tsc: Detected 2400.000 MHz processor
|
||||
|
@ -96,21 +97,22 @@ Jul 07 07:12:58 archbish kernel: tsc: Detected 2419.200 MHz TSC
|
|||
Jul 07 07:12:58 archbish kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
|
||||
Jul 07 07:12:58 archbish kernel: e820: remove [mem 0x000a0000-0x000fffff] usable
|
||||
Jul 07 07:12:58 archbish kernel: last_pfn = 0x45f800 max_arch_pfn = 0x400000000
|
||||
Jul 07 07:12:58 archbish kernel: x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
|
||||
Jul 07 07:12:58 archbish kernel: x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
|
||||
Jul 07 07:12:58 archbish kernel: last_pfn = 0x94c00 max_arch_pfn = 0x400000000
|
||||
Jul 07 07:12:58 archbish kernel: esrt: Reserving ESRT space from 0x000000008ab9c000 to 0x000000008ab9c150.
|
||||
Jul 07 07:12:58 archbish kernel: e820: update [mem 0x8ab9c000-0x8ab9cfff] usable ==> reserved
|
||||
```
|
||||
|
||||
We can see that the first thing that is registered is the OS image that contains the kernel. From this point on, the kernel is active and doing its work.
|
||||
We can see that the first thing that is registered is the OS image that contains the kernel. From this point on, the kernel is active and doing its work.
|
||||
|
||||
## Initial kernel actions
|
||||
|
||||
The diagnostics above are a running commentary provided by the kernel itself about its actions. The details will be specific to the machine in question but the general sequence is as follows for all operating systems:
|
||||
|
||||
1. CPU inspection
|
||||
2. Memory inspection
|
||||
3. Device bus discovery
|
||||
2. Memory inspection
|
||||
3. Device bus discovery
|
||||
4. Device discovery
|
||||
5. Auxiliary kernel subsystem setup (networks etc)
|
||||
6. Mounting of the root filesystem
|
||||
6. Mounting of the root filesystem
|
||||
7. Starting of user space
|
||||
|
|
Loading…
Add table
Reference in a new issue