| 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.