首页 > > 详细

代写COMP2401A – Assignment 1

COMP2401A – Assignment 1
Prerequisites
Before you can attempt the steps in this assignment you need to install and configure your
development environment. Please work with your TA to set up either Virtualbox or your
Openstack environment, complete with an editor of your choice and the gcc compiler.
Please review the lectures up to Module 5.
Learning Objectives
• Convert a set of requirements into a running C program
• Learn how to read user input in C
• Learn how to write output to the terminal in C
• Learn how to use primitive and compound data types in C
• Understand bit models, and how to leverage them to make your program more efficient
Learning Outcomes
1. You will be to write C programs that collect input from the user, and display output on
the terminal.
2. You will be able to use bitwise operations to minimize memory footprint.
Program to Control Access to an Object (Object Access Control Program)
Operating systems and middleware often need to be able to control access to an object
(authorization). The term objects, in this case, refers to things like files, directories, messages,
network interfaces, discs, etc.
Access control lists and are typically cached in RAM memory, so that access permission checks
can be performed very quickly. An instance of an operating system typically manages many
thousands of objects. The data structure used to store permissions for a given object should be as
compact as possible to reduce the memory footprint. The screen capture below shows the file
permissions descriptor in Linux.
The sequence of letters listed on the left describes the different types of permissions that the
currently logged on user has with respect to the object listed on the right. For now, we don’t need
to understand what all of these letters signify. As part of this assignment, we will build
something similar, although simpler. Remember - this is the human-friendly output of the
underlying file permissions descriptors. Is there a more compact way to store this information?
We will construct a simple object permissions descriptor. The descriptor will not be associated
with any object for now. The objective is to simply practice storing information in an efficient
manner.
Sections below summarize the functional and non-functional requirements for the simple
program that you will develop for this assignment. Please read these sections carefully. Please
also carefully review the ‘Deliverables’ section below.
Functional Requirements
The functional requirements for a computer program are often recorded as use case. Use cases
describe how different users (called actors) interact with the program. Each use case lists the
actor, the steps, and alternate flows - if any.
Use Case 1 – System Administrator Starts the Object Access Control Program (OACP).
Actor: System Administrator
Steps:
1. The System Administrator starts the access permissions program.
2. The OACP prompts the user to enter a sequence of letters that represent the
permissions that are to be associated with an object.
a. The sequence contains 3 letters
b. Each letter is either a ‘y’, or an ‘n’
c. The letter ‘y’ indicates that the user will have the associated permission (give
permission).
d. The letter ‘n’ indicates that the user will not have the permission (deny
permission).
e. The sequence of letters is only 3 characters long.
f. The first letter from the right represents the permission to read the object.
g. The second letter from the right represents the permission to write to, or
modify, the object.
h. The third letter from the right represents the permission to execute the object.
i. Examples of valid input are: 1 - ‘yyy’ to give permissions to read, write, and
execute; 2 - ‘yny’ to give permissions to read and execute, but not write to the
object; 3 - ‘nnn’ to deny all permissions; 4 - ‘ynn’ to allow the user to only
execute the object, but not to read it, or to modify it.
j. This sequence of letters is used to collect user input and would not be stored
permanently. The information contained in the character sequence should be
stored permanently in a more compact, separate, variable – the Access Control
Descriptor (ACD). For this assignment the ACD does not need to be stored
permanently (e.g. into a file), but normally it would be.
Use Case 2 – System Administrator Enters the Permissions String into OACP.
Actor: System Administrator
Steps:
1. The System Administrator enters the sequence of characters (string) and presses the
‘Enter’ key. The format of the string is described in Use Case 1. User input error checking
and exception handling does not need to be implemented – the System Administrator
can be assumed to enter the character sequence correctly.
2. The OACP stores the permissions information captured in the string entered by the
System Administrator in the ACD
3. The OACP displays the contents of the ACD in:
a. Character format
b. Decimal format
c. Binary format
4. The OACP exits.
Non-Functional Requirements
Computer programs need to meet not-only the requirements of people who use them, but also of
people who need to maintain, operate, extend, and debug them. These types of requirements are
called Non-Functional Requirements (NFRs). Typically, the non-functional requirements focus
on the following:
• Performance
• Maintainability
• Security
• Availability
• Extensibility
• Others…
For this assignment we will focus on the following NFRs.
NFR1 – Memory Scalability
The access control descriptor variable, used to store object access control information, should
use the smallest possible amount of memory to allow for a very large number of objects to be
stored in the RAM.
Deliverables
This assignment will have two deliverables:
1. Design document.
a. Submitted in PDF format.
b. The design should be brief and to-the-point. Aim for not more than 3 pages.
c. It should explain the overall flow of the program using either pseudo-code or a
flow chart.
d. It should discuss:
i. How to collect the input from the System administrator – what type of
variable would you use?
ii. The type of variable to use to store the permissions more permanently,
to minimize the memory footprint, and why.
2. C code.
a. .c file that implements the program design.
b. For full marks the code should:
i. Run without errors.
ii. Implement the functional and non-functional requirements documented
above - correctly.
iii. Should include comments that explain what is going on.
iv. Should follow one of the recommended coding styles described in the
lecture notes.
v. It should use local variables and functions to structure the program.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!