COMP SCI 3004/7064

COMP SCI 3004/7064 - Operating Systems Assignment 1
Important Notes Handins:
– For undergraduate students, you may do this assignment as a team of two students
and hand in one submission per team.
– For postgraduate students, you have to do this assignment individually and make
individual submissions.
– All implementations have to be done in C++.
– You need to submit your source code using the web submission system. You should
attach you and your partner’s name and student number in your submission.
– Late submissions will attract a penalty: the maximum mark you can obtain will be
reduced by 25% per day (or part thereof) past the due date or any extension you are
granted.
Marking scheme:
– 20 marks for 10 randomly generated tests (2 marks per test).
If you have any questions, please send them to the student discussion forum. This way you
can all help each other and everyone gets to see the answers.
The assignment
The aim of this assignment is to improve your learning experience in the process scheduling
algorithms. You are required to design an online ticketing system for Coopers Stadium. Specifi-
cally, there are two seat sections: red section for public booking via this system; non-red section
for private booking via hot line. Figure 1 shows the distribution of the seat sections.
In the system, all the customers are grouped into seven priority classes(numbers), ranged

代做COMP SCI 3004作业、代写Operating Systems作业、C++程序设计作业调试
from 1 to 7, according to their loyalty (accumulated points) to this ticketing system. A smaller
priority number indicates a higher priority. All ticketing processes (purchase/cancellation) generated
by a customer are assigned with the same priority number of that customer. To maximise
the system service performance, you are required to implement a scheduling algorithm using
multi-level queue strategy with two queues: a high priority Queue 1 and a low priority Queue
2. Queue 1 has absolute priority over Queue 2. In other words, customer request in Queue 2
will only be processed if there is no customer in Queue 1. There is a threshold (=3) that is
used to determine whether a customer should remain in Queue 1 (priority number ≤ threshold)
or Queue 2 (priority number > threshold). Detailed actions in these two queues are listed below:
Queue 1: This is the high priority queue(priority number ≤ threshold). Customers in this
queue are treated in the way of combined Highest Priority First (HPF) and Weighted Round
Robin (WRR — definition see below) on priority as follows: Select the highest priority customer
1
Figure 1: Stadium Map.
(customers with the same priority are processed in their arrival order), and then process this
customer’s request for a ticket quota of N =
weighted time quantum
5 time units tickets non-preemptively, then
move this customer to the end of (the priority-subqueue of) Queue 1, where
weighted time quantum = (8 customer’s priority number) × 10
1 ticket costs 5 time units to process.
customer’s priority number is the customer’s current priority number.
Weighted Round Robin (WRR): Given n processes P1, P2, . . . , Pn, where process Pi has a weight
wi (1 ≤ i ≤ n), W RR allocates Pi a weighted time quantum of wi time units (i.e. a share of P win i=1 wi
CPU time). In this assignment, to simplify the implementation, a process’ weight
is (8 customer’s priority number), and customer’s priority number is the customer’s current
priority number.
Customers of the same priority are processed in their arrival order. The priority of a
customer in this queue is decreased by one every 3 runs of this customer, i.e. when a customer
has been processed 3 times under its current priority, its priority number will be increased by
2
1. When a customer’s priority number goes above the threshold (=3), it will be demoted from
Queue 1 to Queue 2.
For example, The priority number 2 in this queue is decreased by one run of this customer,
i.e. once booked the first N =(82)×10
5 = 12 tickets its priority will become 3 and its ticket
quota for the next run will book N =(83)×10
5 = 10 (instead of 12 in its first run).
Queue 2: This is the low priority queue (priority number > threshold). Customers in this
queue are handled in Round Robin. That is, select the customer with First Come First Serve,
regardless of their priorities. And process this customer’s request for a fixed time quantum of 20
tickets (= 100 time units) preemptively (to any a new arrival or promoted customer in Queue 1),
then move this customer to the end of Queue 2. Note: once a running customer X in this queue
is interrupted by a promoted or new customer from Queue 1, customer X will leave his/her
time quantum immediately and the newly customer in Queue 1 will get the CPU to run. If the
priority number of a customer in this queue goes equal to or below the threshold (=3) by the
following Ageing mechanism, that customer is promoted from Queue 2 to Queue 1.
Ageing mechanism Because Queue 1 has priority over Queue 2, and the HPF strategy is
applied, starvation may occur. Namely, some customers in Queue 2 may never get to run because
there is always a job with higher priority in Queue 1. To address the starvation issue, you must
implement a mechanism which ages each customer. This need not be done every time a customer
run as this will slow the system down, but say once every 9th customer. That is, if a customer
has waited 8 runs (the interrupted customer is counted as one run) of other customers since
his/her last run, his/her priority number will be decreased by one. In this way, the priority
number of each customer in Queue 2 decreases gradually in proportion to the waiting time since
the last run.
Note:
Order of simultaneous arrivals of same-priority customers:
For customers arriving at the same time with the same priority to both queues, we assume
their arrival order follows the increasing order of their customer IDs.
Order of new arrivals, preemption and promotion
For Queue 1, there may be three types of customers with the same priority arriving simultaneously
at the end of (the priority-subqueue of) Queue 1 — a new arrival customer
A to Queue 1, a customer B with this priority of Queue 1 moved to the end of Queue 1
(by Weighted-Round-Robin), and a promoted customer C from Queue to Queue 1. In this
case, their execution) order in Queue 1 will be Queue1 → A → B → C
For Queue 2, there may be two types of customers arriving simultaneously at the end of
Queue 2 — a new arrival customer A to Queue 2 and a customer B of Queue 2 moved
to the end of Queue 2 (by Round-Robin), their (execution) order in Queue 2 will be
Queue2 → B → A . Note that a demoted customer from Queue 1 is regraded as customer
B.
Test
Input
We have N customers, Each customer is identified by a line in the input file. The line
describes the customer ID, arrival time(Can be divisible by 5), priority, age and the total tickets
required. For example a1 5 1 0 50 describes a customer a1 which arrived at time 5 with priority
number 1 and age 0, and requires 50 tickets. One ticket processing consumes one time unit.
3
Output
The output includes N+1 lines. it provides information of each customer execution. First
line is string include ”name arrival end ready running waiting”. The next N lines (sorted by
termination time) should report the customer ID, arrival and termination times, ready time (the
first time the system processes his/her request) and durations of running and waiting.
Web-submission instructions
? First, type the following command, all on one line (replacing xxxxxxx with your student
ID):
svn mkdir –parents -m ”OS”
https://version-control.adelaide.edu.au/svn/axxxxxxx/2019/s2/os/assignment1
Then, check out this directory and add your files:
svn co https://version-control.adelaide.edu.au/svn/axxxxxxx/2019/s2/os/assignment1
cd assignment1
svn add TicketBooker.cpp
svn add StudentFile1.cpp
svn add StudentFile2.cpp
· · ·
svn commit -m ”assignment1 solution”
Next, go to the web submission system at:
https://cs.adelaide.edu.au/services/websubmission/
Navigate to 2019, Semester 2, Operating Systems, Assignment 1. Then, click Tab ”Make
Submission” for this assignment and indicate that you agree to the declaration. The
automark script will then check whether your code compiles. You can make as many
resubmissions as you like. If your final solution does not compile you won’t get any marks
for this solution.
We will test your codes by the following Linux commands:
g++ TicketBooker.cpp -o TicketBooker
./TicketBooker input.txt>output.txt

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codehelp

原文地址:https://www.cnblogs.com/comp163/p/11443391.html

时间: 2024-08-29 23:45:02

COMP SCI 3004/7064的相关文章

COMP SCI 3004/7064 - Operating Systems

COMP SCI 3004/7064 - Operating Systems Assignment 2DUE: 23:30pm, 28th Oct, 2019Important Notes• Handins:– The deadline for submission of your assignment is 23:30pm, 28th Oct, 2019.– For undergraduate students, you may do this assignment as a team of

COMP SCI 3004/7064 - Operating Systems Assignment

COMP SCI 3004/7064 - Operating Systems Assignment 2DUE: 23:30pm, 28th Oct, 2019Important Notes• Handins:– The deadline for submission of your assignment is 23:30pm, 28th Oct, 2019.– For undergraduate students, you may do this assignment as a team of

COMP SCI 2ME3, SFWR ENG

Assignment 4COMP SCI 2ME3, SFWR ENG 2AA4March 29, 2019Assigned: March 22, 2019Spec and Code: April 9, 2019Last Revised: March 29, 2019All submissions are made through git, using your own repo located at:https://gitlab.cas.mcmaster.ca/se2aa4 cs2me3 as

COMP SCI 3306 Assignment 3: Frequent Itemsets, Clustering

Assignment 3: Frequent Itemsets, Clustering,AdvertisingFormative, Weight (15%), Learning objectives (1, 2, 3),Abstraction (4), Design (4), Communication (4), Data (5), Programming (5)Due date: 11 : 59pm, 3 June, 20191 OverviewRead the following caref

C++ and OO Num. Comp. Sci. Eng. - Part 2.

本文参考自<C++ and Object-Oriented Numeric Computing for Scientists and Engineers>. 1. Basic Types 在 C++ 中,变量的声明不必像 C 和 Fortran 一样放在程序最前方,可以在变量使用前声明,增加程序可读性. C++ 中有布尔类型变量,关键字为 bool. C++ 中标准库内 numeric_limits 模板函数可以返回不同类型变量的最大值与最小值. C++ 内标示符要求由字符.数字与下划线组成,

C++ and OO Num. Comp. Sci. Eng. - Part 5.

类 class 关键字提供了一种包含机制,将数据和操作数据的方法结合到一起,作为内置类型来使用. 类可以包含私有部分,仅其成员和 friend 类访问,公有部分可以在程序中任意位置处访问. 构造函数与类重名.析构函数用来定义对象销毁时操作. class pt2d { // class for 2D points private: // private members double x; // x coordinate double y; // y coordinate public: // pu

2008 SCI 影响因子(Impact Factor)

Excel download 期刊名缩写 影响因子 ISSN号 CA-CANCER J CLIN 74.575 0007-9235 NEW ENGL J MED 50.017 0028-4793 ANNU REV IMMUNOL 41.059 0732-0582 NAT REV MOL CELL BIO 35.423 1471-0072 PHYSIOL REV 35.000 0031-9333 REV MOD PHYS 33.985 0034-6861 JAMA-J AM MED ASSOC 3

数据库系统概念笔记-引言

 数据库管理系统(DBMS)由一个互相关联的数据的集合和一组用以访问这些数据的程序组成.这个数据集合通常称作数据库,其中包含了关于某个企业的信息.   DBMS的主要目标是要提供一种可以方便.高效地存取数据库信息的途径. 1.1 数据视图 1.1.1 数据抽象 一个可用的系统必须能高效地检索数据.这种高效性的需求促使设计者在数据库中使用了复杂的数据结构来表示数据,但是,有很多数据库用户不懂这些.为此,数据库的系统开发人员通过如下几个层次上的抽象来对用户屏蔽复杂性,以简化用户与系统的交互: 物理层

学好数学能让程序员的水平更高

I've been working for the past 15 months on repairing my rusty math skills, ever since I read a biography of Johnny von Neumann. I've read a huge stack of math books, and I have an even bigger stack of unread math books. And it's starting to come tog