From 2b2d1156a94b824b0461c7ed837a9d23fba152cd Mon Sep 17 00:00:00 2001 From: tactonbishop Date: Mon, 23 May 2022 17:42:11 +0100 Subject: [PATCH] Last Sync: 2022-05-23 17:42:11 --- Hardware/Binary/The_binary_number_system.md | 2 +- Hardware/Logic_Gates/Logic_gates.md | 50 +++++++------------ Hardware/Memory/Basics.md | 11 ++++ Linux/User_management.md | 2 + Logic/Truth-tables.md | 2 + Operating Systems/Basic Model.md | 36 +++++++++++++ .../The Kernel.md | 0 7 files changed, 69 insertions(+), 34 deletions(-) create mode 100644 Hardware/Memory/Basics.md create mode 100644 Operating Systems/Basic Model.md rename Linux/test.md => Operating Systems/The Kernel.md (100%) diff --git a/Hardware/Binary/The_binary_number_system.md b/Hardware/Binary/The_binary_number_system.md index 7f66208..3732a40 100644 --- a/Hardware/Binary/The_binary_number_system.md +++ b/Hardware/Binary/The_binary_number_system.md @@ -58,7 +58,7 @@ Counting in binary: ## Relation to Turing Machines -It's obvious that there is a clear relation between the binary number system and Turing Machines, since in their most basic instance, Turing Machines work with ones and zeros. In order for us to get Turing Machines to compute digital numbers we only need to convert from decimal to binary. +It's obvious that there is a clear relation between the binary number system and Turing Machinees, since in their most basic instance, Turing Machines work with ones and zeros. In order for us to get Turing Machines to compute digital numbers we only need to convert from decimal to binary. ### Example decimal to binary conversion diff --git a/Hardware/Logic_Gates/Logic_gates.md b/Hardware/Logic_Gates/Logic_gates.md index e38fb55..1c7ad1b 100644 --- a/Hardware/Logic_Gates/Logic_gates.md +++ b/Hardware/Logic_Gates/Logic_gates.md @@ -8,11 +8,11 @@ tags: ## Logic gates -Logic gates are the basic building blocks of digital computing. **A logic gate is an electrical circuit that has one or more than one input and only one output.** The input controls the output and is isomorphic with logical conditions that can be expressed in the form of truth-tables. +Logic gates are the basic building blocks of digital computing. **A logic gate is an electrical circuit that has one or more than one input and only one output.** The input controls the output and is isomorphic with [Boolean connectives](../../Logic/Truth-functional_connectives.md) defined in terms of [truth-tables](../../Logic/Truth-tables.md). ### Truth tables -I know from my study of logic that truth tables enable us to present the conditions under which logical propositions are true or false. To take the `AND` operator: `AND` evaluates to `true` if both of its constituent expressions are `true` and `false` in any other circumstances (e.g. if one proposition is `true` and the other `false` (or vice versa) and if both propositions are `false` ). +Truth-tables present the conditions under which logical propositions are true or false. To take the `AND` operator: `AND` evaluates to `true` if both of its constituent expressions are `true` and `false` in any other circumstances (e.g. if one proposition is `true` and the other `false` (or vice versa) and if both propositions are `false` ). This is most clearly expressed in the following truth table: @@ -27,7 +27,7 @@ f t f f f f ```` -Another example is the negation (`NOT`) operator in logic which is highly trivial. The negation operator (`¬` or `~` ) switches the value of a proposition from true to false. When we put `~` before `true` it becomes false and when we put `~` before `false` it becomes `true`. We will see shortly that this corresponds to a basic on/off switch. + The negation operator (`¬` or `~` ) switches the value of a proposition from true to false. When we put `~` before `true` it becomes false and when we put `~` before `false` it becomes `true`. We will see shortly that this corresponds to a basic on/off switch. **Truth table fo `NOT`** @@ -40,56 +40,37 @@ f t ## NAND gates -A NAND gate is a logic gate that combines the truth conditions for `AND` and `NOT` . I +A NAND gate is a logic gate that inverts the truth-conditions for `AND`. -Let's first introduce the circuit: +A real-life circuit showing two switches corresponding to two transistors which control the LED light: -The real-life circuit showing two switches corresponding to two transistors which control the LED light. -![NAND_from_transitors.png](../img/NAND_from_transitors.png) +![NAND_from_transitors.png](../../img/NAND_from_transitors.png) In this circuit, there are two transistors, each connected to a switch. The switches control the LED light. So the switches are the input and the LED is the output. For clarity, we are not going to draw both transistors, we will simplify the diagram with a symbol for them which stands for the NAND gate: -![NAND.png](../img/NAND.png) +![NAND.png](../../img/NAND.png) > > Remember that a 'logic gate' is a logical abstraction of a physical process: the voltage passing through a transistor. The transistors register the charge and the switches control it's flow, the 'gate' is just the combination of transistors and how they are arranged. There is not a physical gate per se, there is only the transistor whose output we characterize in terms of logic. -The diagram below shows how the circuit models the truth conditions for `AND` +The diagram below shows how the circuit models the truth conditions for `NAND` Diagram representing NAND gate: -![NAND.gif](../img/NAND.gif) +![NAND.gif](../../img/NAND.gif) * When both switches are off (corresponding to `false` `false`) the output is on (the bulb lights up). * If either one of the switches are on, the output remains on (corresponding to `true` `false` or `false` `true` ) * It is only when both switches are on, that the output is off (corresponding to `true` `true` ) - > - > Remember that switch circuitry is counter intuitive: the switches being on corresponds to the output ceasing to execute because the switches break the circuit, they don't join it. + +This is the exact opposite to the truth-conditions for `AND`. ## Transliterating the logic truth table to the switch behaviour -We can now present a truth table for NAND alongside the truth conditions for `AND` and `NOT` - -```` -// AND -p q p & q -_ _ _____ - -t t t (1) -t f f (2) -f t f (3) -f f f (4) - -// NOT - -p ~ p -_ __ -t f -f t -```` +We can now present a truth table for NAND: ```` A B Output @@ -101,8 +82,11 @@ _ _ _____ 1 1 0 (4) ```` -* So we can see that the binary representation of the circuit accords with `NOT` at rows (1) and (4): when both switches are off (`false` ), the bulb is on ( `true` ). And when both switches are on (`true` ), the bulb is off (`false` ). -* Rows (2) and (3) of the binary truth table accord with rows (2) and (3) of the `AND` truth table: if one of the switches is `true` but the other is `false` , the output is `false` (the bulb remains on). +## Significance of the NAND gate: functional completeness +> **Equipped with just a NAND we can represent every other possible logical condition within a circuit.** + +In practice, it is more efficient to use specific dedicated gates for the other Boolean connectives but in principle the same output can be achieved through NANDs alone. + ### More complex outputs from combining NANDS diff --git a/Hardware/Memory/Basics.md b/Hardware/Memory/Basics.md new file mode 100644 index 0000000..96cf2e2 --- /dev/null +++ b/Hardware/Memory/Basics.md @@ -0,0 +1,11 @@ +--- +tags: + - memory + - bits +--- + +# Basics of main memory + +In essence the main memory is just a large storage area for a bunch of binary digits. Each slot for a 0 or 1 is called a bit: + +> This is where the running kernal and processes reside - they're just big collections of bits. A CPU is just an operator on memory. It reads its instructions and data from the memory and write back out to the memory. \ No newline at end of file diff --git a/Linux/User_management.md b/Linux/User_management.md index 12608e2..7060a9b 100644 --- a/Linux/User_management.md +++ b/Linux/User_management.md @@ -3,6 +3,8 @@ tags: - Linux --- +# User management + ## Switch user If already logged in as a user you can switch users with the command `su - [username]`. diff --git a/Logic/Truth-tables.md b/Logic/Truth-tables.md index dc07cf5..20ff84c 100644 --- a/Logic/Truth-tables.md +++ b/Logic/Truth-tables.md @@ -6,6 +6,8 @@ tags: - truth-tables --- +# Truth-tables + We are already familiar with truth-tables from the previous entry on the *truth-functional connectives* and the relationship between sentences, connectives and the overall truth-value of a sentence. Here we will look in further depth at how to build truth-tables and on their mathematical relation to binary truth-values. We will also look at examples of complex truth-tables for large compound expressions and the systematic steps we follow to derive the truth conditions of compound sentences from their simple constituents. ## Formulae for constructing truth-tables diff --git a/Operating Systems/Basic Model.md b/Operating Systems/Basic Model.md new file mode 100644 index 0000000..de97e95 --- /dev/null +++ b/Operating Systems/Basic Model.md @@ -0,0 +1,36 @@ +--- +tags: + - os + - Linux +--- + +# Basic model of a (*nix) operating system + +We can abstract the Linux OS into three operational levels or tiers, from the bottom up: + +
+
User processes
+
The running programs that the kernel manages. Also known as the user space. Comprising
+ +
Kernel
+
The core of the operating system. Software residing in memory that tells the CPU where to look for its next task. Acts as a mediator and primary interface between the hardware and the user processes. Comprising: +
    +
  • System calls
  • +
  • Process management
  • +
  • Memory management
  • +
  • Device drivers
  • +
+
+
Hardware
+
The base: one or more CPUs and RAM memory performing computations and writing to memory. Comprising: +
    +
  • Processor (CPU)
  • +
  • Main memory (RAM)
  • +
  • Disks
  • +
  • Network ports
  • +
+
diff --git a/Linux/test.md b/Operating Systems/The Kernel.md similarity index 100% rename from Linux/test.md rename to Operating Systems/The Kernel.md