Question: Write code for the LMC for the following tasks. (5*3 =15) In addition to the commands INP, OUT, STA, LDA, ADD, SUB, DAT and HLT,

Write code for the LMC for the following tasks. (5*3 =15) In addition to the commands INP, OUT, STA, LDA, ADD, SUB, DAT and HLT, you will also need to use the branching instructions such as BRZ, BRP and BRA commands. For each task below, you should submit annotated mnemonics, that is, submit the code together with comments explaining what each line of code does: A. Ask the user for two numbers and print out the biggest. For example, Test data Expected output 7, 9 9 8, 7 8 12, 9 12 B. Ask the user for three numbers and print out all three from largest to smallest. For example, Test data Expected output 3, 16, 5 16, 5, 3 4, 5, 20 20, 5, 4 C. Ask the user to input two numbers. If the first number is greater than the second, output 1; if the second number is greater than the first, output -1, and if the two numbers are the same, output 0. Test data Expected output 12, 5 1 6, 13 -1 8, 8 0 PART 2 (5+5+5) A. What is the output of the following commands on LINUX terminal as we tried in the class (5): i. whoami ii. touch iii. kill iv. chmod v. ls -l B. Write down the LINUX commands to accomplish the following tasks (5+5): B1. Assume you are currently within root directory at your LINUX machine terminal (i.e., Command Line Interface). Navigate to the following directory: /user/myspace/computersystems Create a new directory named mydir here. Navigate to the newly created mydir. Create a file named mytestfile.txt. Check if the file has successfully been created. B2. Check the access permissions of this file (mytestfile.txt) created above. Please note that r=read, w=write, and x=execute. Now consider the following: 0 = No Permission 1 = Execute 2 = Write 4 = Read Change the access permissions for full access to owner and owning group, but only read access to others. Check back again the access permissions to ensure they have been changed for your file. PART 3: (7 + 3) A) Provide the Gantt chart and Average Waiting Time of the following using Shortest Job First algorithm for both preemptive and non-preemptive scheduling: B) Provide Gantt chart and Average Waiting Time for the set of processes in (3A) using Round Robin Algorithm for Time Quantum = 3. Processes Arrival Time Burst Time P1 0 7 P2 2 5 P3 4 1 P4 5 4 P5 7 2 Marking Guide

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!