CS计算机代考程序代写 Hive ICT374 Assignment 1

ICT374 Assignment 1

ICT374 Assignment 1

Introduction
Deadline and Penalty for Late Submission

Question 1 (30%): Comparing the Cost of Output with Three I/O Models

Question 2 (30%): Executing Commands in Child Processes

Question 3 (30%): Reporting Information of Files

Documentation Requirements
Policy on the Reuse of Third Party Source Code
Grievance with Assignment Marking
Errata

Introduction
(Back to Beginning)

This is an individual assignment. Each student must complete this assignment
independently.

This assignment consists of three questions, including both theory
questions and programming questions and it covers Topic 1 to Topic 5.

Please note that one of the objectives of this unit is to develop skills
in self-learning and research. This assignment deliberately includes questions
that requires some independent research on your part in order to
come up with an answer.

The assignment will be marked out of 100 marks, including 10 marks awarded
for the quality of presentation (including formatting and layout of your
assignment documents).

To achieve good marks you must strictly adhere to the
Documentation Requirements. Marks will be deducted if any of
the requirements is not met. In some cases, such as failing to submit the assignment
check list or failing to include source code and/or test evidences we may refuse to
accept your assignment.

You should try each question as soon as the relevant topic is covered, not
to wait until all relevant topics are covered. Otherwise you may find that you do
not have enough time to complete the assignment.

Deadline and Penalty for Late Submission
(Back to Beginning)

This submission deadline of this assignment is specified
in the Unit Information Page of the Unit LMS. If there is any change
in the submission deadline, it will be announced in the Announcements page
of the Unit LMS.

Assignments submitted on or before the deadline will be marked out of 100%.

Late submission of the assignment will have 10% of the student’s raw
mark deducted per day, unless an application for extension of submission
deadline is granted. Submission that is late by more than 10 days
will not be accepted (in fact the Unit LMS will stop accepting assignments
10 days after the published deadline).

Applications for extension of your assignment deadline can only be made
via email to the Unit Coordinator, normally prior to
the specified due date of the assignment. If an extension is granted
(also by email), you must attach a copy of the email to your submission
(see Documentation Requirements). Applications for extension by phone
or in person do not count even if granted. The above policy will be
rigorously enforced.

Question 1 (30%): Comparing the Cost of Output with Three I/O Models
(Back to Beginning)

The textbook discussed three I/O modes: Programmed I/O, Interrupt-driven I/O,
and DMA. Answer the following questions:

What are the main differences between the three I/O models
and what are their strength and weakness?
Assuming that an application needs to output 1000 words from
the internal memory to the hard disk, calculate the following
values for for each I/O model:
How many times the processor is interrupted?
How many times the internal memory is read by the processor
for those 1000 words?
How many times the disk controller is read by the processor?
How many times the disk controller is written to by the processor?

Draw a table to contain your answers. You need to justify the numbers you
put in the table.

Hint: note that only one word (32-bits or 64-bits depending on the processor)
can be transfered each time between the processor and the main memory
and between the processor and an I/O device because the data bus is
only 32-bit or 64-bit wide.

Question 2 (30%): Executing Commands in Child Processes
(Back to Beginning)

Write a C program that takes a list of command line arguments, each of
which is the full path of a command (such as /bin/ls,
/bin/ps, /bin/date, /bin/who,
/bin/uname etc). Assume the number of such
commands is N, your program would then create
N direct child processes (ie, the parent of these
child processes is the same original process), each of which
executing one of the N commands. You should make
sure that these N
commands are executed concurrently, not sequentially one after
the other. The parent process should
be waiting for each child process to terminate. When a child process
terminates, the parent process should print one line on the standard
output stating that the relevant command has completed successfully
or not successfully (such as “Command /bin/who has completed
successfully”, or “Command /bin/who has not completed
successfully”). Once all of its child processes have
terminated, the parent process should print “All done,
bye-bye!” before it itself terminates.

Note: do not use function system, or any other function
that will invoke a shell program in this question.

Question 3 (30%): Reporting Information of Files
(Back to Beginning)

Write a C program, myls.c, that is similar to
the standard Unix utility ls -l (but with much less functionality).
Specifically, it takes a list of command line arguments, treating each
command line argument as a file name. It then reports the following information
for each file:

user name of the user owner (hints: Stevens & Rago, 6.2.);
group name of the group owner; (hints: Stevens & Rago, 6.4.);
the type of file;
full access permissions, reported in the format used by the ls
program;
the size of the file;
i-node number;
the device number of the device in which the file is stored, including
both major number and minor number (hints: Stevens & Rago,
4.23.);
the number of links;
last access time, converted to the format used by the ls
program (hint: Stevens & Rago, 6.10.);
last modification time, converted to the format used by the ls
program;
last time file status changed, converted to the format used by the ls
program;

Like ls -l command, if no command line argument is provided,
the program simply reports the above information about the files in the current directory.

Of course, your program cannot use programs, such as
/bin/ls, and /usr/bin/stat, that is able to
report the file status in this question.

Documentation Requirements
(Back to Beginning)

Your assignment must be submitted in the form of a single
zip archive file (or tar file) via the Unit LMS. The zip file must be
named in the following format:

ICT374_A1_.zip

For example, the student, John Smith, would name his zip file as
ICT374_A1_SmithJohn.zip.

Your zip archive must contain the following files:

One PDF document named “Assignment1.pdf”.
See the detailed requirements of this file later
in this section.

For each programming question (ie, Question 2 to Question 3),
you must include a separate folder appropriately named (ie,
q2, q3 and q4) that contains

the source code for the question
the Linux executable for the program
test files used in the test (if any)

You can get the test output by cut-and-pasting from
your terminal output. Another way is to redirect
standard output to a file, eg: q3>q3_output.txt
and then copy the test output to your documenation.

You must make sure that your program can be compiled and run
on other machines. Do not use any non-standard feature or
any feature that is only available in your machine.
Do not hard code any directory path into your program otherwise
your program may not run on someone else’s machine.

The file “Assignment1.pdf”

This PDF file should contain the documents in the following order:

ICT374 Assignment 1 Check List:
all students (internal and external) must
complete this check list and include it in the file.

Extension Granted: if you have been granted extension,
include the email from your Unit Coordinator after the
declaration form.

List of Files: list the name and purpose of each file
included in the tar archives.

Include documents for each question in the order of question
numbers. For each question, you must include

The question itself :
you can cut-and-paste the question from this web
page to your file.

Your answer (theory question only) :
please note the marks are not awarded purely based on the
length of your answer. Most questions can be answered
in half to one page.

Self diagnosis and evaluation(programming question only) :
a statement giving following details for each requiement of the question:
what have been fully completed and working, and
what have been fully completed but not fully working,
and what are not been fully completed or not attempted.
This statement is essential. You will lose at least
50% of the mark allocated to the question if this statement is
missing, misleading, or too vague.

Test evidence (programming questions only) :
depending on the nature of the problem, you may need one
or more test cases to demonstrate that your program
has met all requirements.

When testing your program, please turn on the gcc warning
(gcc -Wall …), and make sure you fixed all warnings
before submitting your program.

For each test case, you should 1) explain the purpose of
the test, 2) provide the test output including the command line
used, and 3) give an explanation on what the test has achieved
based on the test results.

It is important that you present a sufficient number
of test cases to convince your tutor that your solution works
in all situations. Please note that although your tutor may
test your program to verify the evidence presented in your
documentation, it is not the responsibility of your tutor to
test your program for the purpose of finding marks for you.
It is up to individual student to mount a convincing case
that the submitted solution works as required. You will be
be awarded marks based on the test evidences you presented.
Therefore if you do not provide test evidence you do not get
marks regardless of whether your program works or not.
If the test evidence you have provided is not sufficient,
your marks will be substantially reduced.

You should format your test output
using fixed point fonts so that test output
is clearly distinguishable from the rest of
the document. You should not modify the test
output unless it is too long and repetitive.

In presenting your test cases, do not use the tabular format
that you may have been told to use in some other units. Simply
present one test case after the other in a linear order.

Source code listing (programming question only) :
the source code must be properly indented, commented,
and formatted. The source code included in this PDF
file must be identical to those source code file(s)
included in the tar archive. Use a fixed point font to format your
source code.

The documentation requirements described above will be strictly
enforced. Your assignment will not be marked, or your marks will be significantly
reduced, if you fail to adhere to the above requirements.

Policy on the Reuse of the Third Party Source Code
(Back to Beginning)

Please read this section very carefully.

All students are encouraged to solve complete the assignment independently
with their own source code. I understand, however, that occasionally there
may be justifiable reasons to use source code from a third party.
Please note that if you have used one or more pieces of third party source
code in your program (this includes the situations where you have made
minor modifications to the third party source code), your assignment
will be acceptable only if you have satisfied all of the following
conditions:

The third party source code is fully identified, including the page
numbers and line numbers, in your source code and also in your assignment
documentation, and
The origin of the third party code is fully disclosed and acknowledged
in your project submission, and
The third party source code is fully commented in your program listing.
All variables, functions and major control structures must be commented to
show clearly that you understand the logic of the code, and
The third party source code is less than 10% of your program
(in terms of the number of lines), excluding the code specifically allowed
to be used.
The source code does not come from a student assignment, whether
from Murdoch University or not.

Failure to satisfy any one of the above conditions will result in
0 mark being awarded to your entire assignment.

If unsure, you must seek clarification from your tutor or
unit coordinator, and get his or her confirmation in writing.

The above policy will be rigorously enforced by the Unit Coordinator
and Tutors.

Grievance with Assignment Marking
(Back to Beginning)

Once you have received your marked assignment, if you have any grievance
with the marking, you must raise it with your Unit Coordinator by email,
within 7 days of returning of your marked assignment to the Unit LMS,
or within the announced deadline in the Unit LMS, whichever is earlier.
Otherwise the marks awarded to you will be final and will be used to calculate
your final weighted average score for the unit.

Errata
(Back to Beginning)

This page is subject to change based on errors found. Any errors found
and corrected will be posted in the Announcements page of
the Unit LMS. If you print out a copy of this page, please follow the
news in the Announcements page of the Unit LMS for any updates.

Dr Hong Xie

Unit Coordinator for ICT374

Last revision: Wednesday, 1 September 2021

Document author: Dr. H. Xie,
Unit Coordinator, ICT374 Operating Systems and Systems Programming

Last Modified: Wednesday, 01-Sep-2021 15:43:57 AWST

Disclaimer &
Copyright Notice © 2020
Murdoch University

This document is relevant for 2020 only