Assignment title: Information


​​ Task A: - Before you start working through the assignment tasks, do not forget to type in the script command (the Record Session Command), which enables you to record the terminal session(s) for submission. The name of the script file must start with your student ID, followed by "cw2part1", e.g. if your student ID is 05123456, your script file must be '05123456cw2part1'. The full command you type in is therefore: script 05123456cw2part1. After you complete all assignment tasks, use either Control-d or exit command to stop recording.

If you work through those tasks in several short sub-sessions (i.e. sequence of sub-sessions), use option –a of the script command or concatenation of files (cat command).

After you complete all assignment tasks (and record your terminal session(s) too), transfer (FTP) your script file from UNIX server to your PC Windows Operating System and check/edit it using any text editor from your Windows system. You will lose marks without editing. You should submit one script file only onto the WebLearn site for Task A

Task B: Carry out your own research to produce a technical report on the Management of I/O Request in Operating System. Further requirement details about the report are mentioned in Task B section. Filename: report05123456.doc You are required to submit two files:

1. The script file for Task A: 05123456cw2part1 2. The report file for Task B: report05123456.doc

Please Note: The filename must follow the convention described above, and use your ID to replace "05123456"; All 2 files must be submitted online by uploading onto the WebLearn by the deadline:

no later than 15:00, Mon, week 26, 25th Apr. 2016. Task A - UNIX Shell Operations and Shell Script Program (60% of Coursework 2 in total)

1. Aim of the Coursework • To train you for organizing your work within the deadline • To experience the submission of your coursework online to the WebLearn • To familiarize yourself with relevant details of UNIX interface • To perform file system-based operations on the UNIX shell

2. Requirement with Guidance (a) It is a good practice to check and edit your script file before submission. Each task section should have a title with relevant comments. A special marking scheme will apply if your script file is swamped with "garbage" and consequently exceeds its reasonable size, you may lose all the marks in the worse situation (your file size> 70 Kb).

(b) Tasks should be completed in required directories; otherwise, you could lose up to 50% of the allocated marks, or even more. (c) If a task/tasks requires: "Show that you are in (some) directory", you may use shell prompt or pwd command to show your working directory. To simplify your operation, you should type in script command, immediately followed by the command: PS1='$PWD> ' to set the shell prompt displaying the pathname of your working directory. If your prompt does not show your working directory, you could lose up to 15 marks (15%).

(d) If a task/tasks requires: "Give a short explanation", you have to type in 1-3 line(s) of explanation in echo or print command. You may also use a text editor to input the explanation. If no explanation is given, you may lose up to 50% of the allocated marks, or even more. 3. Assignment Tasks

3.0 The Coursework submission file (10 marks) • The file submitted to WebLearn should be well structured with very good readability, such as, filename is correct, consistent style for task titles with brief comments, and "Rubbish" cleaned. 3.1 Creating New Directories (3 marks) Starting from your home directory • Create the directory structure shown in the figure below and then go back to your home directory (using relative pathnames) • Show the structure • Stay in your home directory

3.2 Removing Existing Files and Directories (4 marks) • Change to d-36 directory using a relative pathname • Show that you are in this directory. Create two text files in this directory using any UNIX utility

Change to CW22 directory: • Remove both text files with the Interactive Mode (-i) option and d-36 directory using corresponding command(s) • Show the absence of two text files and the directory 3.3 Use of 'print' Command (3 marks) Remember that the print command can replace the echo command to print the argument of a command. • Print the following string using one print command Hello! Shell started • Print the following three-line string in one print command We can print different characters in the print command, for example: a-b, A-B, –, +, <, >, #, $, %, &.

3.4 Use of 'cd' Command (4 marks) • Now you are still in CW22 directory. Change to d-34 directory using a relative pathname. Show that you are in this directory

• Type in the following commands and give a short explanation of the results: pwd ; cd ; pwd

• Change to d-34 directory again using a relative pathname. Type in the following commands: pwd ; cd .. ; pwd ; cd .. ; pwd and give a short explanation of the results

3.5 System Manual and Large Files (5 marks) • Change to d-35 directory using a relative pathname. Show that you are in this directory. • Display the system manual for ls command. Do not display more than two screenfuls. Do not clutter up your transcript!. • Copy the system manual for ls command to the file named ls-man, and use more utility to read ls-man file (just display two screenfuls) and exit from more

3.6 Use of 'ls' Command (6 marks) Type in the following commands and then give a short explanation for the results from each command line: • cd ; pwd • ls • ls – a • ls –al • cd ; pwd ; cd CW22 ; pwd • ls –R

3.7 Use of 'cat' Command (13 marks) Change to d-34 directory and use cat utility to create the following 3 files with the contents as listed in the table: - (3 marks) File Name testd teste testf Contents: AAAAA BBBBB CCCCC DDDDD aaabb bbbcc cccdd dddaa Aaaaa Bbbbb Ccccc Ddddd

• Copy these files to d-33 directory using a relative pathname - - (2 marks) • Concatenate the files, using the following commands. - (8 marks) o cat testd teste testf

o cat testd teste testf > testg o cat testd – teste >> testg For the third command above, type in 2 lines of any string during the execution and give a short explanation for the results from the execution.

3.8 Use of 'chmod' Command (8 marks) Change to d-33 directory - (5 marks) • Remove all access permissions for testd. • Display access permissions for testd. • Read file testd using any utility. • Add read and write access permissions to testd for you (the owner). • Display the new access permissions for testd. • Read file testd using any utility. Change to CW22 directory – (3 marks) • Remove all access permissions for d-33. • Display the new access permissions for d-33. • Try to read a file from d-33 using any utility. • Add read, write, and execute access permissions to d-33 for you (the owner). • Display the new access permissions for d-33. • Read a file from d-33 using any utility.

3.9 Use of 'grep' Command (6 marks) Change to d-34 directory and type in the following commands: • grep dd testf • grep -v dd testf • grep -n dd testf • grep -l dd * • grep -i dd * • grep -i DD *

Give a short explanation for the results from each command you typed in. You are advised to read the section "A 1.8 grep" in UNIX commands material. 3.10 Startup Files (8 marks) Modify your .profile and create your environmental file (do not forget to set ENV variable in your .profile file). Both files must have at least an echo or print command to show the startup files working (If you have already created these files, just display and execute them.). • Change your .profile file. • Display your .profile file • Create your environmental file • Show both files working

3.11 Shell scripts (25 marks) Write a UNIX shell script (a shell program) to complete the following two tasks: 1. the program accepts your order 2. the program should produce a summarized report of your order. Your session should be similar to:

In the screenshot above, "orderNoodle" is the name of the shell program which you should create for this task. It should be able to recognize the commands "quit" and "order", which are functions defined below: • "quit" – displays a message such as "-----Thanks for your order-----" and then quit the program. (3 marks) • "order" – starts your order with prompts that takes inputs as shown in the screenshot above. (15 marks) • At the end of each order, you should have the option to execute another order, or "quit" the program. (3 marks) • If you enter a wrong command, for example 'ok', the program should recognize this and display a message, such as: 'Sorry, 'ok' is not a valid command. Please enter 'quit' or 'order'.' until a correct command is entered, i.e. 'quit' or 'order'. (4 marks)

3.12 Presentation (or viva) (5 marks) You need to present/demo your session file to your tutor, explain the tasks you did and answer questions asked by your tutor. If no presentation, you may lose 50 marks of this piece of work Part1. End of Task A – 60 Marks in total

Task B - Technical Report (40% of Coursework 2 in total) 1. Task Description

Device management is an important part of Operating System (OS) management. Despite the multitude of devices that appear and disappear in reality and quick changes in device technology, the Device Manager in OS must manage every peripheral device of the system. You are required to write a technical report about device management. You should focus on the Management of I/O Request (such as how to control the I/O traffic, how to schedule the I/O and handle the I/O device), with example/s to illustrate your understanding. The report should be the culmination of good literature search work carried out through using a good mix of sources: book, journals, industry white papers, research outputs of organisations, web resources that have provenance, and textbooks. It should describe in depth the technical content. This technical report should be about 1500 words in length (excluding Cover page, Contents page and References).

The report structure and quality will also be marked, based on the criteria of quality of communication/expression and overall structure – organisation of material and quality of documentation.

2. A recommended report structure is shown below for your reference • Cover Page {clear and concise- e.g. Task B: Technical Report, Module Code, Module Title, your name and student ID number} • Contents Page {shows structure of report - section numbers, heading and pages} • Introduction {very brief description of aims (general) and objectives (what is done to achieve the aims to put report within context/sets the scene for the reader (e.g. where does this development fit within the field)} • Body of report {main part of the report; e.g. describe the structure of the management of I/O System, more efforts on detailing the I/O traffic controller, the I/O scheduler and the I/O device handler, etc. } • Conclusions {condensed version of body; briefly gives key findings} • References (Bibliography) {demonstration of your referencing skills}

3. Marking Scheme • Technical content, depth, range of source materials and discussion demonstrations – 32 Marks • Report structure (e.g., organisation of materials) and quality (communication or expression) – 8 Marks End of Task B - 40 Marks in total