300167 { Systems Programming 1
Assignment One (15 marks)
Due date: 10:00 pm Friday, 1 May 2020
Task:
This assignment is to simulate the disk I/O handling in system programming by a
linked list.
A particular Unix kernel operation handles disk I/O by allowing independent user
processes to place I/O request blocks (IORB) in a linked list. The order in which these
requests are serviced depends on their scheduling priority. The scheduling strategy is
adaptive, which simply means that the kernel may carry out different computations at
different times in order to calculate the priority value for each element of the list.
You are required to write a C program on Linux which designs, implements and tests
a sorting function: sortList(). The first argument of the function is a pointer to the head
of the list. The second argument is a priority computing function which computes and
returns the scheduling priority. The sorting function will sort such a list according to the
scheduling priority of each element. Since the OS will have other structures with pointers
to IORB blocks, the list must be sorted in place.
Requirement:
1. IORB structure:
Its data type is defined as:
typedef struct iorb
int base_pri;
struct iorb *link;
char filler[100];
IORB;
where base pri is an integer representing the block’s base priority; link is a pointer
to next block; filler is a description about the block which is opaque to the sorting
routine.
2. Separate source file for the priority computing function:
void sortList(IORB ∗ head; int(∗prio)(int));
where head is a pointer to the linked list, and prio is a priority computing function.
The sortList() implementation is to be in a separate source file from any driver
code. You may however include other functions you’ll need for testing, such as those
to build and display the list, in the same source file of the driver code.
3. Priority computing function:
For this assignment, to keep things simple, scheduling priorities will be computed
from a single integer field (named base pri) in each IORB. You may design any
computing method. The function is to return an integer representing the scheduling
priority.
4. Sorting algorithm:
You are required to use the Selection Sort algorithm to sort the list in an ascending
order. This algorithm finds the minimum value, swaps it with the value in the first
position, and repeats these steps for the remainder of the list. In practice a more
complex linking structure, permitting more efficient sorting, would be used, but this
is beyond the scope of this assignment.
5. Sorting in place:
The list must be sorted in place. This means that ONLY the links within the list
may be altered, no IORB block may be copied to somewhere else in memory.
6. Building and display the list:
The list is initially built by a function buildList().
For each IORB in the list, its base scheduling priority base pri is calculated by a
random number generator. You may assign any string to filler.
The list is displayed by a function displayList(), which shows the description, the
base priority and priority of each element.
Documentation:
1. You should write a text file readme.txt which contains:
(a) your name and student ID
(b) How to compile and run your code
(c) A simple description of your solution logic or pseudo code (no more than a
page)
(d) your test plan, test run and output.
(e) the limitations if your program does not output the expected result.
2. Your code should contain necessary comments to explain what the code is accomplishing and how. Your code should be well organised and easy to read.
Submission:
ALL related files (such as readme.txt, c source files for sorting and driver) should
be zipped into a single file StudentID.zip and submitted via vUWS. You are required
to demonstrate your program via ZOOM during the next scheduled lab session after the
deadline. Please note
1. It is students’ responsibility to ensure that they can upload successfully their submissions before the deadline.
2. students’ responsibility to ensure that their programs are runnable on the schools
lab machines.
3. It is students’ responsibility to ensure that they keep a copy of their submission.
4. No email submissions will be accepted
The post 300167 { Systems Programming 1 appeared first on My Assignment Online.