辅导COSC 1133编程、UNIX Systems程序讲解、辅导c/c++程序语言 讲解R语言编程|讲解Database
- 首页 >> Java编程 UNIX Systems Administration and Programming (USAP)
COSC 1133
Assignment 2
Assessment
Type
Individual assignment. Submit online via Canvas→Assignments→Assignment
2. Marks awarded for meeting requirements as closely as possible.
Clarifications/updates may be made via announcements/relevant discussion
forums.
Due Date Week 12, Sunday 18th October 2020, 9:00 pm
Marks 100 (40% of the marks for the course)
Please remember that all times in this assignment specification are Melbourne local time. No
extensions shall be given for misreading of deadlines or being in a different time zone.
1. Overview
Performance monitoring and management are key systems adminstration tasks. You are going
to demonstrate those skills as well as compiling and installing the linux kernel based on a
provided tutorial.
2. Learning Outcomes
This assessment relates to all of the learning outcomes of the course which are:
CLO 1: Demonstrate knowledge of the role and responsibilities of a Unix systems
Administrator
CLO 2: Install and configure the Linux operating system
CLO 3: Manage the resources and security of a computer running Linux at a basic level
CLO 4: Make effective use of Unix utilities, and scripting languages
3. Assessment details
Requirement 1 – Code Quality (10 Marks)
An important part of the management of Linux installations is to use shell scripts in combination
with the right choice of system programs. Many of the skills you will learn in this assignment are
using programs you would use for system maintenance. You should use standard Unix utilities to
fulfil each requirement.
Your scripts must be written using the bash shell scripting language with the addition of utilities
such as grep, awk and sed. In particular you should not use python or perl scripting languages
(some students had some confusion about this in the past) - use of tools other than those
approved will result in getting no marks for the code. If you are unsure whether a tool you are
using is acceptable, please ask on the discussion board.
All scripts written for this assignment should be written with the appropriate preamble (the
shebang/hash-bang). All your scripts should have appropriate permissions to be runnable by a
normal user as ./scriptname where “scriptname” is the name you have given the script. All paths
to executables need to be specified by constants at the beginning of your script, you should
quote variables to avoid certain kinds of issues with the shell, variables should have meaningful
names, should be local if they are not required for the sharing of information. Also, functions
should be used for all longer or more complex scripts.
You will also be required to have your scripts be validated by shellcheck. In the lab exercises we
will provide instructions for how to install this. Do not use the web version of shellcheck as it is
not consistent with the installed binary which is what we will use in marking. So this requirement
will be broken down into 5 marks for correct programming practices and 5 marks for passing
shellcheck with no errors or warnings,
Page 1 of 6
Requirement 2 – Code Commenting and Program Manpage (10 Marks)
This requirement is broken into two parts – comments and user documentation. You are
expected to provide comments sufficient so that a maintainer of your code will be able to
understand what you are trying to do solely from the comments. There should be file level,
function level and inline comments in the code which clearly show your intention. The idea is not
to go overboard with this, but it does need to be sufficient so that a maintainer can understand
your intentions. You should also identify yourself in all files. Please see the lecture notes for
required details on what is expected in the program header comment in each file.
You are also expected to provide user documentation which explains to a user how to use your
program. Your user documentation should follow the standard manpage format (one man page
for each script). See https://www.tldp.org/HOWTO/Man-Page/q3.html but feel free to leave out a
section if it is not relevant.
Your documentation must be written using the markdown format - you should only use the
features outlined here: https://www.markdownguide.org/basic-syntax/#overview.
3 marks will be given for code commenting and 7 marks will be given for the created
documentation.
Requirement 3: Kernel Compilation (10 Marks)
You are to follow the instructions in the week 7 lab to compile and install a Linux kernel. You will
need to install a bootable kernel and boot from it using that guide. You will need to remove
support for cameras and video devices and append your student number to the kernel version
so that it will show up when "uname -r" is typed at the command prompt.
Please note you will not be submitting the kernel itself but rather a script that will handle the
build process as specified in the following requirements. It should be easy for a systems
administrator to modify your script for different versions of the Raspberry Pi.
Requirement 4: Git Configuration (10 Marks)
You are to sign up with a github account for the github student pack. Your github account will
show a graph of contributions over time that is expected to show ongoing work on this
assignment through the assessment period. You can sign up for the github student pack here:
https://education.github.com/pack
You are also required to configure your local git setup on the raspberry pi so that all commits
show your full name and your rmit student email to show the authenticity of each commit.
You are also required to submit your git log as part of the assessment. You will export this once
done using the following command:
git log --pretty > gitlog
3 marks are awarded for following the correct process in signing up, 3 marks are awarded for
adequate commits and 4 marks for the correct git configuration.
Page 2 of 6
Requirement 4: Kernel Compilation Script (15 Marks)
You are to place the .config file generated by the kernel configuration into your git repository.
You are then to write a script called "build_kernel" that will:
checkout your repository
check out the raspberry pi kernel repository as provided in the week 7 lab sheet.
copy your “.config” file into the right place
build the kernel.
Make a backup of appropriate files in /boot and store them in an appropriate compressed
format.
copy the new files created by this build process into the right place and reboot the
system.
After having done this the new kernel and associated drivers should be installed.
Requirement 5: First Performance Monitoring Script (20 Marks)
You are to write a second script, a performance monitoring script.
You are to read the "vcgencmd" command, the documentation for which is available here:
https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md
Use vcgencmd to get information about the performance of your pi while compiling the kernel.
This script should output data in tab delimited format with the first column being elapsed time
measured in seconds followed by a tab. This data should be written to a file called
"kernel_performance_data" (no file extension). You will also need to now modify your
compilation script to start this script when the compile starts and stop this script gracefully.
That is, you should intercept a “USR1” signal sent from the build_kernel script as an indication
to cease this monitoring script. Your script should sleep between measurements. Approaches
that keep the cpu busy or do not behave consistently between different machines will be
marked down.
5 marks awarded for correctly backgrounding and graceful exit, 5 marks awarded for a good
selection of relevant data to monitor and 10 marks for the monitoring script itself.
Requirement 6: Second Performance Monitoring Script (15 Marks)
This one is a bit more tricky and that is by design and is targeted at those who are aiming to get
a higher mark or want more of a challenge.
Do some research about how to control the flickering of the green led on the raspberry pi. We
want you to control this with a script.
Each second, you should poll the current cpu load and have the led turn on for that fraction of a
second. For example if the cpu is under 20% load then the led should be on for one fifth of a
second each second. Your script should sleep between changes to the led state. Approaches
that keep the cpu busy or do not behave consistently between different machines will be
marked down.
When kernel compilation is complete, a “USR2” signal will be sent from your “build_kernel”
script and this script should then handle this signal and exit gracefully.
Page 3 of 6
4 marks are given for monitoring of the cpu load and 4 marks for your script to manipulate the
leds. 4 marks will be given for evidence of your research and references that you have drawn
upon. 3 marks will be given for handling the USR2 signal and gracefully exiting.
Requirement 7: Graphs and Report (15 Marks)
import the data from “kernel_performance_data” into gnuplot (you will have to install this on the
pi first). Draw / overlay graphs of the performance data. Save these as png files.
For example, the gnuplot command
plot "kernel_performance_data" using 1:2 title "temperature" linetype 7 linecolor 0 with
linepoints
Would take the data from your file and plot against time (in seconds). It would give the graph
the title of “temperature” and set a linetype and line colour. It would also draw connections
between the lines. Please note that you might need to preprocess some of the output from
vcgencmd to make it more meaningful for graphing. All graphs should be readable and clearly
labelled.
Here is a possible sample image for the temperature graph:
Finally, you are to write a report called "report.md". This is to be written in the markdown format
as specified The report is not expected to be too complicated. It should include the graphs you
have generated and your observations of the performance of your raspberry pi, It should not be
more than 250 words.
Page 4 of 6
5 marks will be given for your graphs and 10 marks for your analysis. An analysis that shows an
understanding of the relationships between important factors affecting performance will get a
higher mark.
4. Submission
Submit a .tar.gz file that contains the script that kickstarts the build process and your git log.
Everything else should be stored in the git repository referred to by your script.
Late Submission Policy and Extensions
You may request extensions no less than 24 hours before a component is due but please note
that your request must comply with university policy as outlined here:
https://www.rmit.edu.au/students/student-essentials/assessment-and-exams/assessment/
adjustments-to-assessment
In the absence of extensions, you will lose 10% of the marks available for each day late, up to
five days and then no marks can be awarded for submissions that are later than this.
Page 5 of 6
Assessment declaration:
When you submit work electronically, you agree to the assessment declaration:
https://www.rmit.edu.au/students/student-essentials/assessment-and-exams/assessment/
assessment-declaration
5. Academic integrity and plagiarism (standard warning)
Academic integrity is about honest presentation of your academic work. It means acknowledging
the work of others while developing your own insights, knowledge and ideas. You should take
extreme care that you have:
Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you
have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in
your assessment through the appropriate referencing methods,
Provided a reference list of the publication details so your reader can locate the source if
necessary. This includes material taken from Internet sites.
If you do not acknowledge the sources of your material, you may be accused of plagiarism
because you have passed off the work and ideas of another person without appropriate
referencing, as if they were your own.
RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism
covers a variety of inappropriate behaviours, including:
Failure to properly document a source
Copyright material from the internet or databases
Collusion between students
For further information on our policies and procedures, please refer to
https://www.rmit.edu.au/students/student-essentials/rights-and-responsibilities/academicintegrity
As part of this process we will check your code with an automated plagiarism checker.
7. Marking Guidelines
All sections of this assignment will be marked in the following manner:
If we find no problem in your submission, you will get full marks.
if there are minor problems (such as formatting) but otherwise it is ok, you will get 75%
of the marks
If there are more consistent errors but it mostly runs ok, you will get 50% of the marks.
If you have made a decent attempt but you could not get anything to work, you will get
25% of the marks.
If there is little to no code/attempt, you cannot get any marks.
Page 6 of 6
COSC 1133
Assignment 2
Assessment
Type
Individual assignment. Submit online via Canvas→Assignments→Assignment
2. Marks awarded for meeting requirements as closely as possible.
Clarifications/updates may be made via announcements/relevant discussion
forums.
Due Date Week 12, Sunday 18th October 2020, 9:00 pm
Marks 100 (40% of the marks for the course)
Please remember that all times in this assignment specification are Melbourne local time. No
extensions shall be given for misreading of deadlines or being in a different time zone.
1. Overview
Performance monitoring and management are key systems adminstration tasks. You are going
to demonstrate those skills as well as compiling and installing the linux kernel based on a
provided tutorial.
2. Learning Outcomes
This assessment relates to all of the learning outcomes of the course which are:
CLO 1: Demonstrate knowledge of the role and responsibilities of a Unix systems
Administrator
CLO 2: Install and configure the Linux operating system
CLO 3: Manage the resources and security of a computer running Linux at a basic level
CLO 4: Make effective use of Unix utilities, and scripting languages
3. Assessment details
Requirement 1 – Code Quality (10 Marks)
An important part of the management of Linux installations is to use shell scripts in combination
with the right choice of system programs. Many of the skills you will learn in this assignment are
using programs you would use for system maintenance. You should use standard Unix utilities to
fulfil each requirement.
Your scripts must be written using the bash shell scripting language with the addition of utilities
such as grep, awk and sed. In particular you should not use python or perl scripting languages
(some students had some confusion about this in the past) - use of tools other than those
approved will result in getting no marks for the code. If you are unsure whether a tool you are
using is acceptable, please ask on the discussion board.
All scripts written for this assignment should be written with the appropriate preamble (the
shebang/hash-bang). All your scripts should have appropriate permissions to be runnable by a
normal user as ./scriptname where “scriptname” is the name you have given the script. All paths
to executables need to be specified by constants at the beginning of your script, you should
quote variables to avoid certain kinds of issues with the shell, variables should have meaningful
names, should be local if they are not required for the sharing of information. Also, functions
should be used for all longer or more complex scripts.
You will also be required to have your scripts be validated by shellcheck. In the lab exercises we
will provide instructions for how to install this. Do not use the web version of shellcheck as it is
not consistent with the installed binary which is what we will use in marking. So this requirement
will be broken down into 5 marks for correct programming practices and 5 marks for passing
shellcheck with no errors or warnings,
Page 1 of 6
Requirement 2 – Code Commenting and Program Manpage (10 Marks)
This requirement is broken into two parts – comments and user documentation. You are
expected to provide comments sufficient so that a maintainer of your code will be able to
understand what you are trying to do solely from the comments. There should be file level,
function level and inline comments in the code which clearly show your intention. The idea is not
to go overboard with this, but it does need to be sufficient so that a maintainer can understand
your intentions. You should also identify yourself in all files. Please see the lecture notes for
required details on what is expected in the program header comment in each file.
You are also expected to provide user documentation which explains to a user how to use your
program. Your user documentation should follow the standard manpage format (one man page
for each script). See https://www.tldp.org/HOWTO/Man-Page/q3.html but feel free to leave out a
section if it is not relevant.
Your documentation must be written using the markdown format - you should only use the
features outlined here: https://www.markdownguide.org/basic-syntax/#overview.
3 marks will be given for code commenting and 7 marks will be given for the created
documentation.
Requirement 3: Kernel Compilation (10 Marks)
You are to follow the instructions in the week 7 lab to compile and install a Linux kernel. You will
need to install a bootable kernel and boot from it using that guide. You will need to remove
support for cameras and video devices and append your student number to the kernel version
so that it will show up when "uname -r" is typed at the command prompt.
Please note you will not be submitting the kernel itself but rather a script that will handle the
build process as specified in the following requirements. It should be easy for a systems
administrator to modify your script for different versions of the Raspberry Pi.
Requirement 4: Git Configuration (10 Marks)
You are to sign up with a github account for the github student pack. Your github account will
show a graph of contributions over time that is expected to show ongoing work on this
assignment through the assessment period. You can sign up for the github student pack here:
https://education.github.com/pack
You are also required to configure your local git setup on the raspberry pi so that all commits
show your full name and your rmit student email to show the authenticity of each commit.
You are also required to submit your git log as part of the assessment. You will export this once
done using the following command:
git log --pretty > gitlog
3 marks are awarded for following the correct process in signing up, 3 marks are awarded for
adequate commits and 4 marks for the correct git configuration.
Page 2 of 6
Requirement 4: Kernel Compilation Script (15 Marks)
You are to place the .config file generated by the kernel configuration into your git repository.
You are then to write a script called "build_kernel" that will:
checkout your repository
check out the raspberry pi kernel repository as provided in the week 7 lab sheet.
copy your “.config” file into the right place
build the kernel.
Make a backup of appropriate files in /boot and store them in an appropriate compressed
format.
copy the new files created by this build process into the right place and reboot the
system.
After having done this the new kernel and associated drivers should be installed.
Requirement 5: First Performance Monitoring Script (20 Marks)
You are to write a second script, a performance monitoring script.
You are to read the "vcgencmd" command, the documentation for which is available here:
https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md
Use vcgencmd to get information about the performance of your pi while compiling the kernel.
This script should output data in tab delimited format with the first column being elapsed time
measured in seconds followed by a tab. This data should be written to a file called
"kernel_performance_data" (no file extension). You will also need to now modify your
compilation script to start this script when the compile starts and stop this script gracefully.
That is, you should intercept a “USR1” signal sent from the build_kernel script as an indication
to cease this monitoring script. Your script should sleep between measurements. Approaches
that keep the cpu busy or do not behave consistently between different machines will be
marked down.
5 marks awarded for correctly backgrounding and graceful exit, 5 marks awarded for a good
selection of relevant data to monitor and 10 marks for the monitoring script itself.
Requirement 6: Second Performance Monitoring Script (15 Marks)
This one is a bit more tricky and that is by design and is targeted at those who are aiming to get
a higher mark or want more of a challenge.
Do some research about how to control the flickering of the green led on the raspberry pi. We
want you to control this with a script.
Each second, you should poll the current cpu load and have the led turn on for that fraction of a
second. For example if the cpu is under 20% load then the led should be on for one fifth of a
second each second. Your script should sleep between changes to the led state. Approaches
that keep the cpu busy or do not behave consistently between different machines will be
marked down.
When kernel compilation is complete, a “USR2” signal will be sent from your “build_kernel”
script and this script should then handle this signal and exit gracefully.
Page 3 of 6
4 marks are given for monitoring of the cpu load and 4 marks for your script to manipulate the
leds. 4 marks will be given for evidence of your research and references that you have drawn
upon. 3 marks will be given for handling the USR2 signal and gracefully exiting.
Requirement 7: Graphs and Report (15 Marks)
import the data from “kernel_performance_data” into gnuplot (you will have to install this on the
pi first). Draw / overlay graphs of the performance data. Save these as png files.
For example, the gnuplot command
plot "kernel_performance_data" using 1:2 title "temperature" linetype 7 linecolor 0 with
linepoints
Would take the data from your file and plot against time (in seconds). It would give the graph
the title of “temperature” and set a linetype and line colour. It would also draw connections
between the lines. Please note that you might need to preprocess some of the output from
vcgencmd to make it more meaningful for graphing. All graphs should be readable and clearly
labelled.
Here is a possible sample image for the temperature graph:
Finally, you are to write a report called "report.md". This is to be written in the markdown format
as specified The report is not expected to be too complicated. It should include the graphs you
have generated and your observations of the performance of your raspberry pi, It should not be
more than 250 words.
Page 4 of 6
5 marks will be given for your graphs and 10 marks for your analysis. An analysis that shows an
understanding of the relationships between important factors affecting performance will get a
higher mark.
4. Submission
Submit a .tar.gz file that contains the script that kickstarts the build process and your git log.
Everything else should be stored in the git repository referred to by your script.
Late Submission Policy and Extensions
You may request extensions no less than 24 hours before a component is due but please note
that your request must comply with university policy as outlined here:
https://www.rmit.edu.au/students/student-essentials/assessment-and-exams/assessment/
adjustments-to-assessment
In the absence of extensions, you will lose 10% of the marks available for each day late, up to
five days and then no marks can be awarded for submissions that are later than this.
Page 5 of 6
Assessment declaration:
When you submit work electronically, you agree to the assessment declaration:
https://www.rmit.edu.au/students/student-essentials/assessment-and-exams/assessment/
assessment-declaration
5. Academic integrity and plagiarism (standard warning)
Academic integrity is about honest presentation of your academic work. It means acknowledging
the work of others while developing your own insights, knowledge and ideas. You should take
extreme care that you have:
Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you
have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in
your assessment through the appropriate referencing methods,
Provided a reference list of the publication details so your reader can locate the source if
necessary. This includes material taken from Internet sites.
If you do not acknowledge the sources of your material, you may be accused of plagiarism
because you have passed off the work and ideas of another person without appropriate
referencing, as if they were your own.
RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism
covers a variety of inappropriate behaviours, including:
Failure to properly document a source
Copyright material from the internet or databases
Collusion between students
For further information on our policies and procedures, please refer to
https://www.rmit.edu.au/students/student-essentials/rights-and-responsibilities/academicintegrity
As part of this process we will check your code with an automated plagiarism checker.
7. Marking Guidelines
All sections of this assignment will be marked in the following manner:
If we find no problem in your submission, you will get full marks.
if there are minor problems (such as formatting) but otherwise it is ok, you will get 75%
of the marks
If there are more consistent errors but it mostly runs ok, you will get 50% of the marks.
If you have made a decent attempt but you could not get anything to work, you will get
25% of the marks.
If there is little to no code/attempt, you cannot get any marks.
Page 6 of 6