COMP SCI 3004编程 写作、 辅导C++课程设计编程

” COMP SCI 3004编程 写作、 辅导C++课程设计编程COMP SCI 3004/7064 – Operating Systems Assignment 1Important Notes Handins: The deadline for submission of your assignment is . For undergraduate Students, you may do this assignment as a team of two studentsand hand in one submission per team. For postgraduate students, you have to do this assignment individually and makeindividual submissions. All implementations have to be done in C++. You need to submit your source code using the web submission system. You shouldattach you and your partners name and student number in your submission. Late submissions will attract a penalty: the maximum mark you can obtain will bereduced by 25% per day (or part thereof) past the due date or any extension you aregranted. 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 youcan all help each other and everyone gets to see the answers.The assignmentThe aim of this assignment is to improve your learning experience in the process schedulingalgorithms. You are required to design an online ticketing system for the Melbourne Cup heldevery year in Melbourne Arena. Specifically, there are 10,500 seats for public booking via thissystem for a single match. Figure 1 shows the distribution of the seat sections, where all theyellow and green areas are for public reservations.In the system, all the customers are grouped into five priority classes (numbers), ranged from1 to 5, according to their loyalty (accumulated points) to this ticketing system. A smaller prioritynumber indicates a higher priority. All ticketing processes (purchase/cancellation) generated bya customer are assigned with the same priority number of that customer. To maximise thesystem service performance, you are required to implement a scheduling algorithm using multilevelqueue strategy with two queues: a high priority Queue 1 and a low priority Queue 2, whereQueue 1 has absolute priority over Queue 2. In other words, customers in Queue 2 will only beprocessed if there is no Customer in Queue 1.A new customer on arrival will be put on Queue 1 if his/her priority number 3 or Queue2 otherwise.Detailed actions in these queues are described below:COMP SCI 3004作业 写作、 辅导C++课程设计作业、Systems作业Figure 1: Hisense ArenaQueue 1: This is the High-Priority queue (priority number 3). Customers in thisqueue are treated in the way of combined Highest Priority First (HPF) and Weighted RoundRobin (WRR Definition see below) on priority as follows: Select the highest priority customer(customers with the same priority are processed in their arrival order), and then process thiscustomers request for a ticket quota of N =weighted time quantum5 time units tickets non-preemptively, thenmove this customer to the end of (the priority-subqueue of) Queue 1, where weighted time quantum = (10 customers priority number) 10 1 ticket costs 5 time units to process. customers priority number is the customers current priority number.Weighted Round Robin (WRR): Given n processes P1, P2, . . . , Pn, where process Pi hasa weight wi (1 i n), WRR allocates Pi a weighted time quantum of wi time units (i.e.a share of P wini=1 wiCPU time). In this assignment, to simplify the implementation, a processweight is (10 customers priority number), and customers priority number is the customerscurrent priority number.2For example, The priority number 2 in this queue is decreased by one run of this customer,i.e. once booked the first N =(102)105 = 16 tickets its priority will become 3 and its ticketquota for the next run will book N =(103)105 = 14 (instead of 16 in its first run).Customers of the same priority are processed in their arrival order. The priority of acustomer in this queue is decreased by one every 2 runs of this customer, i.e. when a customerhas been processed 2 times under its current priority, its priority number will be increased by1. When a customers priority number reaches 4, it will be demoted from Queue 1 to Queue 2.Queue 2: This is the Low-Priority queue (priority number 4). Customers in this queueare handled in Shortest Remaining Time First. That is, select the customer with shortestremaining time, regardless Of their priorities, and process this customers request preemptively(to any a new arrival or promoted customer in Queue 1).Customers of the same job length (time units) are processed in their priority number increasingorder. Customers of The same job length and priority are processed in their arrivalorder.Note: once a running customer X in this queue is interrupted by a promoted or new arrivingcustomer in Queue 1, customer X will quit execution immediately and the new customer in Queue1 will get the CPU to run.Aging mechanismBecause Queue 1 has priority over Queue 2, and the HPF strategy is applied, starvationmay occur. That is, some customers in Queue 2 may never get to run because there is alwaysa job with higher priority in Queue 1. To address the starvation issue, you must implement thefollowing aging mechanism that dynamically promotes a customer of Queue 2 to Queue 1 whenhe/she experiences starvation.The priority of a customer in this queue (Queue 2) is increased by one every 100 time unitsrun of other customers Since the last run of this customer. That is, if a customer has waited 100time units of other customers since his/her last run, his/her priority number will be decreasedby one. In this way, the priority number of each customer in Queue 2 decreases gradually inproportion to the waiting time since the last run. When a customers priority number reaches3, it will be promoted from Queue 2 to Queue 1.Note: Order of simultaneous arrivals of same-priority customers:For customers arriving at the same time with the same priority to both queues, we assumetheir 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 simultaneouslyat the end of (the priority-subqueue of) Queue 1 a new arrival customer Ato Queue 1, a customer B with this priority of Queue 1 moved to the end of Queue 1 (byWeighted-Round-Robin), and a promoted customer C from Queue 2 to Queue 1. In thiscase, their execution) order in Queue 1 will be Queue1 A B C For Queue 2, there may be two types of customers arriving simultaneously to Queue 2 a new arrival customer A to Queue 2 and a demoted customer B from Queue 1, theirrelative arrival order in Queue 2 will be Queue2 B A.TestInputWe have N customers, Each customer is identified by a line in the input file. The linedescribes the customer ID, arrival time(Can be divisible by 5), priority, age and the total tickets3required. For example a1 5 1 0 50 describes a customer a1 which arrived at time 5 with prioritynumber 1 and age 0, and requires 50 tickets. One ticket processing consumes one time unit.OutputThe output includes N+1 lines. it provides information of each customer execution. Firstline is string Include name arrival end ready running waiting. The next N lines (sorted bytermination time) should report the customer ID, arrival and termination times, ready time (thefirst 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 studentID):svn mkdir parents -m OS httpss://version-control.adelaide.edu.au/svn/axxxxxxx/2020/s2/os/assignment1 Then, check out this directory and add your files:svn co httpss://version-control.adelaide.edu.au/svn/axxxxxxx/2020/s2/os/assignment1cd assignment1svn add TicketBooker.cppsvn add StudentFile1.cppsvn add StudentFile2.cpp svn commit -m assignment1 solution Next, go to the web submission system at: httpss://cs.adelaide.edu.au/services/websubmission/Navigate to 2020, Semester 2, Operating Systems, Assignment 1. Then, click Tab MakeSubmission for this assignment and indicate that you agree to the declaration. Theautomark script will then Check whether your code compiles. You can make as manyresubmissions as you like. If your final solution does not compile you wont get any marksfor this solution. We will Test your codes by the following Linux commands:g++ TicketBooker.cpp -o TicketBooker./TicketBooker input.txtoutput.txt For undergraduate student write students name and ID on File Header comments of TicketBooker.cpp4如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导