aboutsummaryrefslogtreecommitdiff
path: root/notes
diff options
context:
space:
mode:
authorMohit Agarwal <mohit.agarwal@sky.com>2021-10-09 19:07:24 +0100
committerMohit Agarwal <mohit.agarwal@sky.com>2021-10-09 19:07:24 +0100
commitcedb3eb5a58241d9d6079f07d5cd40e8ef81007d (patch)
treee5fb669e605395b18bb804d2493527bf671c5293 /notes
Initial commit. Started notes and data rep test.
Diffstat (limited to 'notes')
-rwxr-xr-xnotes/Makefile11
-rw-r--r--notes/algorithms.tex86
-rw-r--r--notes/hardware.tex239
-rw-r--r--notes/images/by.pngbin0 -> 12588 bytes
-rw-r--r--notes/networks.tex94
-rw-r--r--notes/paper.tex112
-rw-r--r--notes/software.tex47
7 files changed, 589 insertions, 0 deletions
diff --git a/notes/Makefile b/notes/Makefile
new file mode 100755
index 0000000..4f8bc00
--- /dev/null
+++ b/notes/Makefile
@@ -0,0 +1,11 @@
+default: build
+
+build:
+ ls target || mkdir target
+ cp *tex target
+ cp -r images target
+ cd target && xelatex paper.tex
+clean:
+ rm -rf target
+read:
+ zathura target/paper.pdf&
diff --git a/notes/algorithms.tex b/notes/algorithms.tex
new file mode 100644
index 0000000..581a5e5
--- /dev/null
+++ b/notes/algorithms.tex
@@ -0,0 +1,86 @@
+\chapter{Algorithms}
+
+An algorithm is a set of instructions that is followed, generally to
+complete a task or solve a specific problem. Although algorithms are
+often thought of in terms of computers, both humans and computers can
+follow algorithms, an example of which might be Euclid's algorithm
+\footnote{\url{https://en.wikipedia.org/wiki/Euclidean_algorithm}} for
+calculating the highest common factor of two numbers.
+
+\section{Representing algorithms}
+
+Pseudocode is recommended and the AQA teaching guide gives the style
+guide for pseudocode, however religious following of this is not
+important, as long as code is clear and consistent.
+
+\section{Complexity}
+
+We might want to compare different algorithms, particularly when they
+accomplish the same task, such as sorting an array of numbers. In
+particular, we might want to see how resource intensive or `complex'
+an algorithm is. This might be in how quickly an algorithm can be
+computationally run, or how much memory is used in running the
+algorithm.
+
+--best and worst case
+
+\section{Searches}
+
+Let us say that we have a list of numbers $n$ where $n =
+\{2,6,4,7,8,3,9,0\}$ Let us now consider algorithms to `search' for a
+value in the list $n$.
+
+--key
+
+\subsection{Linear search}
+
+The most obvious way to do this is arguably `linear search'. This
+involves looking at each element and comparing it to what we want to
+find. In our list $n$, let us say we want to find the element $8$. We
+would start on the left and go through $2,6,4,9$ having compared them
+each to $8$ and having not yet found it. Yet when we compare the next
+element ($8$) to $8$, it will be a match, and we can say we have found
+the element.
+
+On the other hand, if we are looking for the value $1$, we would go
+through each element in the list, and not find it, and could thereby
+declare that it is not in the list. This suggests that in the worst
+case the time complexity become quite large, as the size of the list
+gets larger because if the element is the last element in the list or
+is not in the list at all the algorithm will have to compare against
+every single other element in the list. The best case for this
+algorithm would be if the first element in the element we are looking
+for: if we were looking for $2$ in $n$, it is the first element and we
+would immediately find it.
+
+\subsection{Binary search}
+
+Consider searching for an item if the list is already sorted, so $n$
+would become $\{0,2,3,4,6,7,8,9\}$. Now if we wanted to search for an
+item we could think of it in a way different from linear search.
+Let us say we are looking for the value $6$. One way to do this is to
+start in the middle, at the value $4$, and comparing it to $6$. $4 <
+6$, so because are list is already sorted, we can discard all the
+numbers left of and including $4$, knowing that we are not discarding
+$6$, so our list becomes $\{6,7,8,9\}$. Let us do the same again,
+picking the middle value $7$ and comparing it to $6$. $7 > 6$, so we
+can discard everything right of and including $7$, knowing that $6$
+will not be discarded, as the list is sorted. Thus our list becomes
+$\{6\}$. Let us pick the middle value $6$ and compare it to $6$. $6 =
+6$, thus we have found the element. If there were no more elements
+left and we had not found our key, then we would know it is not in the
+list.
+
+--unclear
+
+The major drawback to binary search is that the list must be sorted
+for the sort to work. However, once the list is sorted, it is
+significantly faster (less time complex) then linear search, as each
+time the search is performed, half of the list is `discarded', so far
+fewer comparisons will be made.
+
+\section{Sorts}
+
+\subsection{Bubble sort}
+
+\subsection{Merge sort}
diff --git a/notes/hardware.tex b/notes/hardware.tex
new file mode 100644
index 0000000..d9cebed
--- /dev/null
+++ b/notes/hardware.tex
@@ -0,0 +1,239 @@
+\chapter{Hardware}
+
+\begin{myquote}
+Hardware is the wiring and other physical components of a computer.
+\end{myquote}
+
+Modern computers have several typical components. There is a
+motherboard which has wiring printed on it in order to connect all of
+the other components. The central processing unit (CPU) is the main
+component that performs the instructions of computer programs.
+Graphics and sound cards provide the user with graphics on screen and
+sound through headphones or speakers. Input/output ports (I/O ports)
+transfer data between input devices such as a mouse or keyboard and
+output devices such as a printer or speakers.
+
+A popular I/O connector is the Universal Serial Bus (USB). A bus is a
+collection of parallel wires that transmit data as electrical signals.
+
+\section{von Neumann architecture}
+
+\footnote{Prof David Murray, University of Oxford, `A3 Computer
+Architecture',
+\url{https://www.robots.ox.ac.uk/~dwm/Courses/3CO_2000/3CO-L2.pdf}}
+In the 1940s von Neumann's (pronounced Noy-Man, not New-Man) created a
+design for general purpose computer, reliant on a CPU alongside
+\textbf{a single memory unit for both instructions and data}.
+Instructions are executed in series in the `fetch-decode-execute'
+cycle. It is very successful due to its need for only one memory unit
+and the ability to have general purpose rather than specific purpose
+hardware, which early computers were and had to be rewired to change.
+
+The design however does lead to the \textbf{`von Neumann bottleneck'} as data
+and instructions must be fetched from the same memory unit over the
+same bus.
+
+\section{Boolean logic}
+
+George Boole was able to devise a mathematical representation of
+arithmetic using only 1 (True) and 0 (False). Computers use circuits
+that can perform this logic by using on and off circuitry to represent
+1s and 0s. We can represent these circuits as `gates' and describe the
+logic in truth tables to show all possibilities.
+Typically we consider:
+\begin{itemize}
+ \item `And' gates, where the result is true if and only if both of
+ the two inputs are true.
+ \item 'Or' gates, where the result is true if either of the two
+ inputs are true.
+ \item 'Not' gates where the result is the inverse of the one input,
+ so a 1 becomes a 0 and a 0 becomes a 1.
+\end{itemize}
+
+\section{Central processing unit and performance}
+
+The central processing unit (CPU) performs the instructions that we
+ask of a computer. It controls data and instructions through the
+\textit{fetch-decode-execute} cycle, where an instruction is fetched
+from main memory, decoded by the CPU so that it can perform the
+correct logic (such as adding two numbers), and then the instruction
+is executed giving the output of the instruction (say the result of
+the addition).
+
+There are some critical components of the CPU that we typically consider:
+
+\begin{itemize}
+ \item The \textbf{control unit} `oversees' the operations of the CPU and
+ organises the operations performed and the movement of data
+ and instructions.
+ \item The \textbf{arithmetic and logic unit} (ALU) carries out the boolean
+ logic and mathematics via circuits that are designed to do so.
+ \item \textit{Registers} are high speed, small memory locations which hold
+ important data.
+ \begin{itemize}
+ \item The \textit{program counter} is a specific register
+ which stores the location in memory of the next
+ instruction to be executed.
+ \end{itemize}
+\end{itemize}
+
+The CPU executes instructions at a rate dictated by the system
+\textit{clock}. The \textit{clock speed} determines how many
+\textit{clock cycles} (fetch-decode-execute cycles) occur per second.
+This is measured in Hertz (Hz), which means times per second. A CPU
+in a computer today cycles with a clock speed around 4 GHz or
+around 4 billion clock cycles per second
+\footnote{7-Zip LZMA Benchmark, Intel Ice Lake:
+\url{https://www.7-cpu.com/cpu/Ice_Lake.html}}.
+
+The performance of the CPU can be bettered by:
+
+\begin{itemize}
+ \item Increasing the clock speed, so that more clock cycles occur
+ per second (overclocking). This does, however, increase power
+ consumption and CPU heat production.
+ \item Increasing the number of CPU cores. A \textit{multicore} CPU
+ has the ability to do multiple cycles at the same time,
+ depending on the number of cores and, for programs that have
+ the functionality, can perform parallel processing where a
+ large algorithm or calculation is distributed between cores,
+ thus improving performance.
+ \item Increasing cache size, to allow faster access to data and
+ instructions.
+ \item Increasing cache/memory speed, to allow faster access to data and
+\end{itemize}
+
+\section{Memory}
+
+Volatile memory is erased when electrical power to the system is
+turned off or interrupted, meaning that all data is lost. Random
+access memory (RAM) is reasonably fast and is volatile. RAM holds
+current application and operating system data, as well as instructions
+for programs that need to be executed.
+
+Read only memory (ROM) is not volatile and cannot be changed by the
+system, as the name suggests. Modern computers use ROM to contain the
+Basic Input/Output System (BIOS) and other instructions that are
+required in the \textit{booting process} of a computer. This performs
+tasks such as initialising hardware and initialising the operating
+system.
+
+Virtual memory might be necessary when there is insufficient RAM for
+data and instructions. This stores data that would be stored in RAM in
+secondary storage. \textit{Paging} is the process of swapping chunks
+of data between RAM and storage. Because secondary storage is
+significantly slower than RAM and due to the paging process, when
+virtual memory is necessary, the computer is significantly slowed
+down.
+
+\section{Cache}
+
+Cache is memory that is much smaller and more expensive than RAM, but
+is significantly faster also. Cache is used to store current
+instructions and data in order to increase CPU performance. There are
+three levels of cache, each with varying size and speed
+\footnote{7-Zip LZMA Benchmark, Apple M1:
+\url{https://www.7-cpu.com/cpu/Apple_M1.html}; Intel Ice Lake:
+\url{https://www.7-cpu.com/cpu/Ice_Lake.html}}:
+
+\begin{itemize}
+ \item Level 1 (L1) cache is very fast and small. It is located
+ directly on CPU cores. It is in the range of 64kB.
+ \item Level 2 (L2) cache is larger and slower than L1. It is
+ shared between CPU cores but is still very close to them, It
+ is in the range of 512kB.
+ \item Level 3 (L3) cache is significantly slower and larger than
+ L2, but is still much faster than normal RAM. It is in the
+ range of 8MB.
+\end{itemize}
+
+\section{Storage media}
+
+--intro
+
+\subsection{Magnetic storage}
+
+Magnetic storage relies on rotating \textit{platters} coated with
+magnetic material. A \textit{read/write head} can move across the
+platter. To write data the head contains electromagnets that can give
+the magnetic particles a positive or negative charge, representing one
+or zero in binary. A platter is divided into \textit{tracks} which are
+concentric circles, and segments which are radial divisions. A single
+segment on a single track is called a \textit{block}. Data is
+generally organised by blocks.
+
+Magnetic storage is high capacity with the highest available capacity
+in 2021 being 20TB
+\footnote{\url{https://www.tomshardware.com/news/seagate-ships-hamr-hdds-increases-dual-actuator-shipments}}.
+Magnetic storage is reasonably cheap and fast. However, the read/write
+head of a modern hard drive can be only 5 nm from the platter, which
+can spin at up to 15,000 rpm
+\footnote{\url{https://en.wikipedia.org/wiki/Hard_disk_drive};
+\url{https://en.wikipedia.org/wiki/Flying_height}}. This can create a
+lot of noise, power. The moving parts involved can fail and the
+read/write head can \textit{crash} into the platter causing
+significant data loss, particularly in the case the drive is impacted
+when running, such as if a laptop is dropped.
+
+\subsection{Solid state storage}
+
+\textit{Flash} memory chips store data with transistors that can reain
+their one or zero sate without power (non-volatile). As there are no
+moving parts, they are durable, silent, and portable. They are,
+however, very expensive per unit data and risk corruption of data in a
+power interruption event.
+
+\subsection{Optical storage}
+
+Optical media (such as a DVD) contains an inwardly spiralling track
+with pits and lands (small changes in height) to store data. A LASER
+is aimed at the media, and the reflection is captured by a sensor. The
+change from a pit to land can represent a zero or a one. This relies
+on the laser to be moved very precisely by motors to align with the
+track, and for the disc to be rotated at a precise speed (much like
+magnetic storage) in order to read data at the correct rate.
+
+Optical storage is very portable and can be read by many devices, but
+requires that they have a compatible drive. However, large quantities
+of data are expensive to store and discs can very easily be scratched
+or damaged, although error correcting methods are generally used
+\footnote{3Blue1Brown, `How to send a self-correcting message':
+\url{https://www.youtube.com/watch?v=X8jsijhllIA}}. Reading data from
+an optical disc is slower than solid state or magnetic storage.
+
+\subsection{Cloud storage}
+
+Businesses and other organisations (such as schools) traditionally use
+servers for data storage of all data and for running services such as
+email and websites. This however, depends on skilled IT staff and
+expensive equipment and maintenance. Cloud data storage involves the
+use of offsite servers around the world, provided by large
+organisations providing storage for a monthly cost. This can be
+cheaper than an in house operation and provides the benefit of the
+server model to individuals such as the ability to access data from
+many devices and reliable backups. However, a cloud storage solution
+requires a reliable internet connection to access data, can become
+expensive for large amounts of data and due to the repeat cost, and
+raises philosophical concerns such as those surrounding the ownership
+of data.
+
+\section{Embedded systems}
+
+An embedded system
+\footnote{\url{https://en.wikipedia.org/wiki/Embedded_system}} is
+\textbf{custom built hardware} designed to perform a
+\textbf{specific task as part of a wider system}, as opposed to a
+general purpose computer. Examples of embedded systems are visible
+all around us, such as in common electricals appliances such as
+printers, televisions, and cameras; in household appliances such as
+dishwashers and microwaves; and in advanced situations such as engine
+management in cars, guidance systems in aeroplanes, and medical
+equipment such as an MRI scanner.
+
+Embedded systems generally have no RAM and only have ROM which
+contains the \textit{firmware} for the specific program the system
+needs. They have \textbf{no operating system}. The have
+\textit{sensors} to gather informations about their surroundings (such
+as a thermometer or camera) and \textit{actuators} to act on or change
+their surroundings (such as the shutter in a camera or the motor in a
+washing machine).
diff --git a/notes/images/by.png b/notes/images/by.png
new file mode 100644
index 0000000..c8473a2
--- /dev/null
+++ b/notes/images/by.png
Binary files differ
diff --git a/notes/networks.tex b/notes/networks.tex
new file mode 100644
index 0000000..a41c844
--- /dev/null
+++ b/notes/networks.tex
@@ -0,0 +1,94 @@
+\chapter{Networks}
+
+A \textit{network} is a system involving two or more computers that are
+connected, allowing them to \textbf{communicate}. A computer not
+connected to a network is a \textit{stand alone computer}.
+
+Networks allows the easy sharing of data, file, backups, and
+peripherals (such as printers). Networks also allow for efficient and
+high volume communication and can reduce the cost of computing.
+However, a network can also allow hacking and the spread of viruses.
+Networks require additional security measures and potentially
+specialist equipment or staff at additional expense.
+
+We typically identify three classes of network:
+
+\begin{itemize}
+ \item A personal area network (PAN) exists in the range of a
+ single person. This may include an individuals devices that
+ are networked such as a computer, mobile phone, or tablet and
+ other devices connected by network such as Bluethooth
+ headphones or USB devices.
+ \item A large area network (LAN) covers a small geographical area.
+ This could be anything from a single home to a university and
+ thereby can vary in complexity and scale. Twisted pair cables
+ (Ethernet) and Wi-Fi are commonplace in a LAN.
+ \item A wide area network (WAN) covers a large geographical area.
+ The Internet is a very large WAN through the use of fibre
+ optic cables, often undersea, reaching every continent other
+ than Antarctica
+ \footnote{\url{https://en.wikipedia.org/wiki/Submarine_communications_cable}}
+ (which is nonetheless served by satellite Internet links).
+ Organisations with significant sums of money may also
+ create a WAN for the transfer of large amounts of data or
+ speed critical transfer.
+\end{itemize}
+
+\section{Wired networks}
+
+In a wired network the \textit{communication media} is a physical
+cable that transmits a signal. A \textit{coaxial cable} is a single
+copper cable with shielding. A twisted pair cable is also copper but
+can transmit data at a higher \textit{bandwidth} and is flexible
+whilst coaxial cable is not. Fibre optic cables are made of glass and
+transmit light.
+
+Copper cables are cheap and generally compatible with existing
+hardware, but are easy to \textit{eavesdrop} on and cannot transmit
+data at longer distances. Fibre optic cables are better for long
+distance communications and are much higher bandwidth than copper.
+They are also lightweight and hard to eavesdrop on. However fibre
+optic cables are very expensive and often require new infrastructure
+in order to use.
+
+\section{Wireless networks}
+
+Wireless networks send data by transmitting and receiving
+\textit{electromagnetic radiation} (generally radio waves). A wireless
+access point (WAP) transmits and receives this data for many devices
+and is often built into modern household routers. Wi-Fi removes the
+need for cables which are expensive and inconvinient. However the
+range, speed, and bandwidth of Wi-Fi are limited. Transmission is
+limited by interference (such as thick walls or metal construction)
+and the signal can be easily intercepted causing the need for further
+security measures.
+
+\section{Network topology}
+
+The topology of a network describes the layout of network devices and
+allow the planning of suitable network infrastructure.
+
+\subsection{Bus topology}
+
+\begin{center}
+\begin{tikzpicture}
+ \draw (0,0) edge[*-*] (12,0);
+ \draw [-o] (2,0) -- (2,-2);
+ \draw [-o] (4,0) -- (4,2);
+ \draw [-o] (6,0) -- (6,-2);
+ \draw [-o] (8,0) -- (8,2);
+ \draw [-o] (10,0) -- (10,-2);
+\end{tikzpicture}
+\end{center}
+
+In the bus topology, nodes (devices or computers) are connected along
+the \textit{backbone}, each sending and receiving data.
+\textit{Terminators} are positioned at each end of the backbone to
+prevent the signal \textit{bouncing} and transmitting to the devices
+again.
+
+A bus topology is cheap and scalable, but the backbone is a single
+point of failure and can be eavesdropped on, leading to the compromise
+of all data. Data sent by one device is received by all other devices
+thus compromising privacy and only one device can send data on the
+backbone at a time, thus slowing the network.
diff --git a/notes/paper.tex b/notes/paper.tex
new file mode 100644
index 0000000..4a1dbaf
--- /dev/null
+++ b/notes/paper.tex
@@ -0,0 +1,112 @@
+\documentclass[12pt, oneside]{extbook}
+
+\hyphenpenalty=10000
+\hbadness=10000
+\widowpenalty=10000
+\clubpenalty=10000
+\sloppy
+
+\pagestyle{plain}
+\usepackage{titlesec}
+\usepackage{circuitikz}
+\usepackage{graphicx}
+\usepackage{svg}
+\usepackage[a4paper, right=1.5in, left=1.5in,
+top=0.5in, bottom=0.8in ]{geometry}
+\usepackage{lipsum}
+\usepackage{fix-cm}
+\usepackage{amsmath}
+
+\usepackage[scale=0.85]{plex-mono}
+\usepackage{plex-sans}
+
+\usepackage{fontspec}
+\defaultfontfeatures{LetterSpace=1.05}
+\setmainfont{Sabon}
+
+\ctikzset{resistor = european}
+
+\usetikzlibrary{calc,shapes.geometric,shapes.gates.logic.US,arrows}
+
+
+\setlength{\parskip}{0.5em}
+
+
+\PassOptionsToPackage{hyphens}{url}
+\usepackage{hyperref}
+\hypersetup{
+ colorlinks,
+ citecolor=black,
+ filecolor=black,
+ linkcolor=black,
+ urlcolor=teal
+}
+
+\newenvironment{myquote}{
+\list{}{\leftmargin=1in\rightmargin=0.6in}\item[]}%
+{\endlist}
+
+
+
+\title{Physics}
+\author{Mohit Agarwal}
+\date{2021}
+
+\titleformat{\section}{\large}{}{0em}{}
+\titleformat{\subsection}{\bfseries}{}{0em}{}
+\titleformat{\chapter}{\tt\huge\itshape}{}{0em}{}
+
+\begin{document}
+\begin{titlepage}
+ \vspace*{4cm}
+
+ \noindent\fontsize{1.30cm}{1cm}\selectfont
+ \texttt{\textit{Computer Science}}
+
+ \vspace{2cm}
+
+ \noindent\large AQA GCSE notes
+
+ \noindent \normalsize by Mohit Agarwal
+\end{titlepage}
+
+
+\tableofcontents
+
+\input{algorithms.tex}
+\input{hardware.tex}
+\input{software.tex}
+\input{networks.tex}
+
+\chapter{Acknowledgements, about, and license}
+Notes for AQA GCSE Computer Science.\\
+\\by Mohit Agarwal <\url{https://mohit.uk}>, in October 2021
+
+\vspace{2cm}
+\noindent This work was made possible by:\\
+\begin{myquote}
+ \large Ms N. Clarke
+\end{myquote}
+\vspace{2cm}
+
+This work is based on notes I made whilst taking my Computer Science
+GCSE and later edited and formatted. The idea of the notes are just
+that: to be notes to assist in learning. This work is not the word of
+God and should only be used to form an understanding and intuition of
+the topics covered in lessons, allowing for a greater emphasis of your
+time on trying to answer questions and play with the ideas discussed.
+
+\vspace{2cm}
+\noindent\includegraphics{images/by.png}
+
+\begin{myquote}
+
+This work is licensed under the Creative Commons Attribution 4.0
+International License. To view a copy of this license, visit\\
+\url{http://creativecommons.org/licenses/by/4.0/} or send a letter to
+Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
+\end{myquote}
+
+
+\end{document}
+
diff --git a/notes/software.tex b/notes/software.tex
new file mode 100644
index 0000000..472b558
--- /dev/null
+++ b/notes/software.tex
@@ -0,0 +1,47 @@
+\chapter{Software}
+
+We can think of the operations of a system in \textit{layers}. At
+the very top there is the user. Below this there are applications
+that the user interacts with. These then interact with the
+operating system in the layer below, which interacts with the
+system hardware as the bottom layer.
+
+\begin{myquote}
+ \textit{Software} consists of the
+ programs and other operating information used by a computer.
+\end{myquote}
+
+\textit{Application software} performs tasks for a user (such as a
+word processor, game, or web browser) through interaction with the
+operating system. \textit{Utility programs} are used to maintain and
+improve functionality of the computer. Utility programs include
+\textit{firewalls} (which blocks network activity deemed dangerous),
+\textit{disk defragmenters} (which ensure that files are organised in
+a sensible way across the blocks on a hard disk in order to improve
+performance, rather than having a file scattered across multiple
+blocks), \textit{disk formatters}, and \textit{system information and
+diagnostics} tools.
+
+\section{Operating sytem}
+
+The operating system is a type of system software which provides an
+interface between applications and the hardware. It has five primary
+tasks:
+
+\begin{itemize}
+ \item Processor management: allocating time and cores for
+ applications to run on the CPU.
+ \item Memory management: allocating and managing main memory
+ needed by applications.
+ \item Security: managing login and other basic authentication and
+ security operations of the system, such as preventing an
+ unprivileged user from making some changes.
+ \item Input/output (I/O) device management: managing any I/O
+ devices such as keyboards, mice, screens, printers, speakers,
+ and network interfaces by ensuring that the necessary drives
+ are present to allow many different devices to work with the
+ system.
+ \item Applications: interfacing with the applications being run
+ and providing essentials such as a graphical interface for the
+ application to the user and network access to an application.
+\end{itemize}