vault backup: 2024-04-21 22:58:56

This commit is contained in:
2024-04-21 22:58:56 +01:00
parent 4266ea8300
commit d58c22b4dc
57 changed files with 3807 additions and 26 deletions

BIN
.1b.csv.swp Normal file

Binary file not shown.

View File

@@ -6,5 +6,6 @@
"obsidian-diagrams-net",
"obsidian-full-calendar",
"obsidian-style-settings",
"url-into-selection"
"url-into-selection",
"obsidian-csv-table"
]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-csv-table",
"name": "CSV Table",
"version": "1.2.0",
"minAppVersion": "0.11.10",
"description": "Render CSV data as a table within your notes.",
"author": "Adam Coddington <me@adamcoddington.net>",
"authorUrl": "https://coddingtonbear.net/",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,8 @@
.csv-table {
width: 100%;
}
.csv-error {
font-weight: 700;
padding: 10em;
border: 1px solid #f00;
}

View File

@@ -25,7 +25,7 @@
"state": {
"type": "markdown",
"state": {
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
"file": "Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/Trimester 2 Assignment.md",
"mode": "source",
"source": false
}
@@ -99,7 +99,7 @@
"state": {
"type": "backlink",
"state": {
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
"file": "Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/Trimester 2 Assignment.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@@ -116,7 +116,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md",
"file": "Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/Trimester 2 Assignment.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
@@ -139,7 +139,7 @@
"state": {
"type": "outline",
"state": {
"file": "Semester 2/Database Systems/Trimester 2 Assignment.md"
"file": "Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/Trimester 2 Assignment.md"
}
}
},
@@ -181,38 +181,39 @@
},
"active": "3ed058b7ba32ddc0",
"lastOpenFiles": [
"images/Pasted image 20240417140336.png",
"images/Pasted image 20240417140243.png",
"Semester 2/Database Systems/Week 11/Week 11 Database Systems.md",
"images/Pasted image 20240421224020.png",
"Semester 2/Database Systems/Trimester 2 Assignment.md",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/Trimester 2 Assignment.md",
"images/Pasted image 20240421194501.png",
"images/Pasted image 20240421190116.png",
"1b.csv",
"1a.csv",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/1a.csv",
"images/Pasted image 20240421172016.png",
"images/Pasted image 20240421171351.png",
"images/Pasted image 20240421171345.png",
"images/Pasted image 20240421171300.png",
"images/Pasted image 20240421171121.png",
"images/Pasted image 20240421170953.png",
"images/Pasted image 20240421170326.png",
"images/Pasted image 20240421165326.png",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/q2.sh",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/q1txt2.txt",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/q1txt1.txt",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment/q1.sh",
"Semester 2/Computer Systems Internals & Linux/Trimester 2 Assignment",
"Semester 2/Database Systems/Week 11/Week 11 Database Systems.md",
"Semester 2/Database Systems/Exercise Booklet.pdf",
"Semester 2/Database Systems/Week 11",
"Semester 2/Untitled",
"Semester 2/Database Systems/Week 10/Week 10 Database Systems.md",
"Semester 2/Database Systems/Week 9/Week 9 Database Systems.md",
"Semester 2/Database Systems/Week 8/Week 8 Database Systems.md",
"images/Pasted image 20240415190127.png",
"images/Pasted image 20240415190010.png",
"images/Pasted image 20240415175614.png",
"images/Pasted image 20240415135455.png",
"images/Pasted image 20240415134042.png",
"Semester 2/Programming 2/Week 10 Revision/Q5.md",
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS2.md",
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS1.md",
"Semester 2/HCI/Week 3/Week 3 Human Computer Interfaces.md",
"Semester 2/Programming 2/Assessment 3 Revision/Parameter Passing WS3.md",
"Semester 2/Programming 2/Project/Part 2/package.bluej",
"Semester 2/Programming 2/Project/Part 2",
"Semester 2/Programming 2/Project/Part 4 Complete.zip",
"Semester 2/Programming 2/Project/Part 4 Complete/doc/resources/inherit.gif",
"Semester 2/Programming 2/Project/Part 4 Complete/doc/stylesheet.css",
"Semester 2/Programming 2/Project/Part 4 Complete/doc/resources",
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-summary.html",
"Semester 2/Programming 2/Project/Part 4 Complete/doc/package-list",
"images/Pasted image 20240319234142.png",
"images/Pasted image 20240319225420.png",
"Semester 2/Programming 2/Week 10 Revision/Q4.md",
"images/Pasted image 20240319224232.png",
"Semester 2/Programming 2/Week 10 Revision/Q3.md",
"Semester 2/Programming 2/Week 10 Revision/Q1.md",
"Semester 2/Database Systems/Week 2/Week 2 Database Systems.md",
@@ -223,7 +224,6 @@
"Semester 2/Database Systems/Week 7/Week 7 Database Systems.md",
"Semester 2/Database Systems/Week 6/Week 6 Database Systems.md",
"Semester 2/Computer Systems Internals & Linux/Week 6/Week 6 Computer Systems Internals.md",
"Semester 2/Computer Systems Internals & Linux/Untitled.md",
"Semester 2/Database Systems/Week 5/Week 5 Database Systems.md",
"Semester 2/HCI/Week 2/Week 2 Human Computer Interfaces.md",
"Semester 1/Database Systems/Week 11/Week 11 Database Systems.md",

9
1a.csv Normal file
View File

@@ -0,0 +1,9 @@
A,B,C,XOR1,OR,NAND,NOT,XOR2,X
0,0,0,0,0,1,1,0,0
0,0,1,0,1,1,0,1,1
0,1,0,1,1,0,1,1,1
0,1,1,1,1,0,0,0,0
1,0,0,1,0,1,1,0,0
1,0,1,1,1,0,0,0,0
1,1,0,0,1,1,1,0,0
1,1,1,0,1,1,0,1,1
1 A B C XOR1 OR NAND NOT XOR2 X
2 0 0 0 0 0 1 1 0 0
3 0 0 1 0 1 1 0 1 1
4 0 1 0 1 1 0 1 1 1
5 0 1 1 1 1 0 0 0 0
6 1 0 0 1 0 1 1 0 0
7 1 0 1 1 1 0 0 0 0
8 1 1 0 0 1 1 1 0 0
9 1 1 1 0 1 1 0 1 1

9
1b.csv Normal file
View File

@@ -0,0 +1,9 @@
IN1,IN2,IN3,OUT
0,0,0,1
0,0,1,1
0,1,0,0
0,1,1,0
1,0,0,0
1,0,1,0
1,1,0,1
1,1,1,1
1 IN1 IN2 IN3 OUT
2 0 0 0 1
3 0 0 1 1
4 0 1 0 0
5 0 1 1 0
6 1 0 0 0
7 1 0 1 0
8 1 1 0 1
9 1 1 1 1

View File

@@ -0,0 +1,232 @@
| Roll Number | 00677611 |
| ----------- | -------- |
| ID | CHC119 |
# 1 - Linux Bash
### 1.1 - If Statements
![](Pasted%20image%2020240421152012.png)
![](Pasted%20image%2020240421151943.png)
### 1.2 - Processing Variable Number of Arguments with While, Using if
![](Pasted%20image%2020240421161729.png)
![](Pasted%20image%2020240421161749.png)
# 2 - Linux System Administration
#### Setup:
- Create **sysadmin** user:
![](Pasted%20image%2020240421162622.png)
- Add **sysadmin** to the **root** group
![](Pasted%20image%2020240421162657.png)
- Create global_aliases.sh and set permissions
![](Pasted%20image%2020240421170953.png)
- Create aliases:
![](Pasted%20image%2020240421171121.png)
- Add source for existing users:
![](Pasted%20image%2020240421171300.png)
- Create users:
![](Pasted%20image%2020240421163023.png)
![](Pasted%20image%2020240421163115.png)
![](Pasted%20image%2020240421163226.png)
- Create group for Hugh and Ryan
![](Pasted%20image%2020240421163525.png)
- Add Hugh and Ryan to the group
![](Pasted%20image%2020240421163651.png)
- Create shared directory
![](Pasted%20image%2020240421163552.png)
- Set permissions to directory to allow root and sharedaccess to read, write and execute, others can read
![](Pasted%20image%2020240421164145.png)
![](Pasted%20image%2020240421164122.png)
![](Pasted%20image%2020240421163852.png)
- Set permissions of all folders in /home/ to rwx for exclusively the user that owns it. Other users may not read, write or execute
![](Pasted%20image%2020240421164526.png)
![](Pasted%20image%2020240421164507.png)
#### Testing:
##### Aliases
- Test **ll** alias:
![](Pasted%20image%2020240421162846.png)
- Test **la** alias:
![](Pasted%20image%2020240421162908.png)
- Test other uses can use alias:
![](Pasted%20image%2020240421171351.png)
##### Shared Directory:
- Both Ryan and Hugh can read and write inside the shared directory.
![](Pasted%20image%2020240421164724.png)
- Rob can read from the directory:
![](Pasted%20image%2020240421170326.png)
- Rob cannot write to the directory:
![](Pasted%20image%2020240421165326.png)
##### Home Directories:
- Users cannot access each other's home directories.
![](Pasted%20image%2020240421164909.png)
![](Pasted%20image%2020240421165151.png)
![](Pasted%20image%2020240421165256.png)
- However, the owner may access the home directory.
![](Pasted%20image%2020240421165222.png)
![](Pasted%20image%2020240421164948.png)
#### bash_history
# CSI Task 1
### a)
![](Pasted%20image%2020240421172016.png)
#### i)
```
X = (A ∧ B ∧ C) ( ¬A ∧ B ∧ ¬C) ( ¬A ∧ ¬B ∧ C)
```
#### ii)
```csvtable
source: 1a.csv
```
### b)
Truth Table:
```csvtable
source: 1b.csv
```
Karnaugh Graph:
| | | AB | | | |
| --- | --- | --- | --- | --- | --- |
| | | 00 | 01 | 11 | 10 |
| C | 0 | 1 | 0 | 1 | 0 |
| | 1 | 1 | 0 | 1 | 0 |
As we can see from the Karnaugh Graph, the output of C is completely irrelevant.
Boolean Expression:
```
OUT = (IN1 ∧ IN2) ( ¬IN1 ∧ ¬IN2)
```
Logic Circuit:
![](Pasted%20image%2020240421190116.png)
# CSI Task 2
### a)
| Name | George |
| ------- | ---------------------------------------------------------------------------------------- |
| Decimal | 71,101,111,114,103,101 |
| Binary | 1000111,1100101,1101111,1110010,1100111,1100101 |
| 8N2 | 0(Idle) 1(Start) 01000111 00(Stop) 1(Start) 01100101 00(Stop) 1(Start) 01101111 00(Stop) |
| | 1(Start) 01110010 00(Stop) 1(Start) 01100111 00(Stop) 1(Start) 01100101 00(Stop) 0(Idle) |
- ![](Pasted%20image%2020240421194501.png)
### b)
| Sent | UTF-8 | Binary | UTF-8 | Received |
| -------- | ----- | ------------ | ----- | -------- |
| G | 71 | 0100 0111 | 71 | G |
| e | 101 | 0110 0101 | 101 | e |
| o | 111 | 0110 1111 | 111 | o |
| r | 114 | 0111 0010 | 114 | r |
| g | 103 | 0110 0111 | 103 | g |
| e | 101 | 0110 0101 | 101 | e |
| Sum | 601 | 10 0101 1001 | 601 | |
| Checksum | 89 | | 89 | |
601 $mod$ 256 = 89
or,
10 0101 1001 AND
00 1111 1111
00 0101 1001 = 89
Example:
| Sent | UTF-8 | Binary | UTF-8 | Received |
| -------- | ----- | ------------- | ----- | -------- |
| G | 71 | 0100 0111 | 71 | G |
| e | 101 | 011**1** 0101 | 117 | u |
| o | 111 | 0110 11**0**1 | 109 | m |
| r | 114 | 0111 0010 | 114 | r |
| g | 103 | 01**0**0 0111 | 71 | G |
| e | 101 | 0110 0101 | 101 | e |
| Sum | 601 | 10 0100 0111 | 583 | |
| Checksum | 89 | | 71 | |
Here we can detect an error in transmission, since the checksum differs on each side of the message. A checksum however cannot detect *where* an error occurs, just the fact that it has.
### c)
$Baud Rate = \frac{Bitrate}{Bits Per Symbol}$
$Bit Rate = 2MBps$
$Bits Per Symbol = 8 data + 1 start + 2 stop = 11 bits$
$Baud Rate = \frac{2MBps}{11b} = 0.1818MHz = 181.8kHz$
$5F = 5 * \frac{Baud Rate}{2}$
$5F = 5 * 90.9kHz = 454.5kHz$
Required Bandwidth: 454.5kHz
# CSI Task 3
### a)
#### Page Accesses
1. 1 2 3 4 5
2. 2 3 4 1 5
3. 3 4 1 2 5
![](Pasted%20image%2020240421224020.png)
Using the clock algorithm, there are 7 page faults total with this sequence of page accesses.
### b)
Since A has a runtime of 4 seconds, it is impossible to allocate 4-7 (4, 5, 6, 7 -> 5 processes) second runtime with no conflicts, so I will allocate 4 in a process of my choice.
$Response Ratio = \frac{Wait Time + Run Time}{Run Time}$
| Process | Runtime | Start Time | Response Ratio |
| ------- | ------- | ---------- | -------------- |
| A | 4 | 0 | 1 |
| B | 5 | 1 | 1.2 |
| C | 6 | 2 | 1.33 |
| D | 7 | 3 | 1.43 |
| E | 4 | 4 | 2 |
Process E has the highest Response Ratio, and will be scheduled first.
Then Process D, Process C, B and finally A.
| t (Time) | Complete Process | Start Process |
| -------- | ---------------- | ------------- |
| 0 | | A |
| 4 | A | E |
| 8 | E | D |
| 15 | D | C |
| 21 | C | B |
| 26 | B | |
Since the only available process at t=0 is A, it must still be performed first, regardless of where it sits in the queue.
E is then available at t=4, when A is completed, allowing the remaining queue to run in descending order of response ratio.

View File

@@ -0,0 +1,22 @@
#!bin/bash
if [ $# -ne 2 ]; then
echo "Please provide 2 files as arguments"
exit 1
fi
if [ ! -f "$1" ] || [ ! -f "$2" ]; then
echo "Both arguments must be files"
exit 1
fi
print() {
file="$1"
echo "$file"
head -n 2 "$file"
}
print "$1"
print "$2"
echo "Total number of characters is: $(cat "$1" "$2" | wc -c)"

View File

@@ -0,0 +1,8 @@
4
5
6
7
8
9
10
11

View File

@@ -0,0 +1,25 @@
#!bin/bash
if [ $# -ne 6 ]; then
echo "Please provide 6 arguments"
exit 1
fi
total=0
count=0
marks=("$@")
# Expands the list of arguments to be space seperated, then splits the output
# on a space with a newline. The list is then sorted in descending order.
# This allows the iteration through the list until count = length=1, removing
# the last value from the calculation.
marks=($(echo "${marks[@]}" | tr ' ' '\n' | sort -nr))
while [ "$count" -lt 5 ]; do
total=$((total + marks[count]))
count=$((count + 1))
done
avg=$(( ( total + 5 / 2 ) / 5 ))
echo "Average of best five modules: $avg%"

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB