美文网首页
C++代写 Operating Systems Assign

C++代写 Operating Systems Assign

作者: layaxian | 来源:发表于2019-03-06 19:37 被阅读0次

    Introduction函数主要功能见函数名主要过程见注释注:queue[0]对应Queue2,Queue[1]~[3]对应优先级为3~5的Queue1void ReadFromFile(vector AllProcess,char FileName){fstream fin;int i=0;fin.open(FileName,ios::in);Process tmp;while(fin>>tmp.Name>>tmp.StartTime>>tmp.Priority>>tmp.Age>>tmp.Ticket){tmp.EndTime=-1;tmp.RunTime=0;tmp.ReadyTime=-1;tmp.id=i;tmp.Turn=0;AllProcess.push_back(tmp);i++;}sort(AllProcess.begin(),AllProcess.end(),cmp);fin.close();}*RequirementCOMP SCI 3004/7064 - Operating Systems Assignment 1DUE: 9:00pm, 13th Sept, 2017Important Notes• Handins:– The deadline for submission of your assignment is 9pm the 13th of Sept, 2017.– For undergraduate students, you may do this assignment as a team of two stu-dents and 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 partner’s 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:– 12 marks for online testing on 3 standard tests (4 marks per test).– 3 marks for the structure of your code and comments.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 Coopers Stadium’s public-seating section (red-coloured section in Coopers Stadium’s seats map shown in Figure 1)In the system, all the customers are grouped into five priority classes, ranged from 1 to5, according to their loyalty (accumulated points) to this ticketing system. A larger prioritynumber indicates a higher priority. All ticketing processes (purchase/cancellation) generatedby a customer are assigned with the same priority number of that customer. To maximisethe system service performance, you are required to implement a customer process schedulingalgorithm using multi-level queue strategy with two queues: a high priority Queue 1 and a lowpriority Queue 2. Queue 1 has absolute priority over Queue 2. In other words, a customerprocess in Queue 2 will only be processed if there is no process in Queue 1. There is a threshold(=2) that is used to determine whether a process should remain in Queue 1 (priority > threshold)or Queue 2 (priority  threshold). Detailed actions in these two queues are listed below:Queue 1: This is the high priority queue. All processes in this queue are treated in theway of combined Highest Priority First (HPF) and Round Robin. That is, select the highestpriority process and process it for a ticket quota of 5 tickets (= 5 units of time quantum) non-preemptively, then move the process to the end of Queue 1. Processes of the same priority are1Figure 1: Stadium Map.selected in their arrival order. The priority of a process in this queue is decreased by one every5 runs of this process, i.e. when the process has processed 25 tickets under its current priority.If a process’s priority goes below the threshold (=2), it is demoted from Queue 1 to Queue 2.Queue 2: This is the low priority queue. Processes in this queue are handled in RoundRobin. That is, select a process according to First Come First Serve and process it for a ticketquota of 20 tickets (= 20 time units) preemptively, then move the process to the end of Queue 2.Note: once a running process P in this queue is interrupted by a new arrival process in Queue1, P will be preempted immediately even if it has not used up its time quantum. If the priorityof a process in this queue reaches the threshold (=2) due to the Ageing mechanism below, it ispromoted from Queue 2 to Queue 1.Ageing mechanism: Because processes in Queue 2 will execute only when Queue 1 isempty, starvation may occur, i.e., some processes in Queue 2 may never get to run. To resolvethis starvation issue, you must implement a mechanism which ages each process. This need notbe done for every process run as it will slow the system down, but once every 9th run. That is,if a process has waited 8 runs (the interrupted process is counted as one run) of other processessince its last run, its priority number will be increased by one. In this way, the priority of eachprocess in Queue 2 increases gradually in proportion to the waiting time since the last run.Note: For the case if three processes of the same priority — a new arrival process A, a2preempted process B of Queue 1 (by Round-Robin) and a promoted process C from Queue 2 toQueue 1 — are put to the end of Queue 1 at the same time, their order will be A ! B ! C.Same rule is applied in Queue 2 regardless of process priority, i.e., new arrival first, preemptedsecond and demoted last, if the three processes come to the end of Queue 2 at the same time,regardless of their priorities.Test data formatInputEach process is identified by a line in the input file (see “input-sample.txt” in the assignmentfolder). The line describes the process ID, arrival time, priority, age and the total ticketsrequired. For example s1 3 1 0 50 describes a process s1 which arrived at time 3 with priority 1and age 0, and requires 50 tickets. One ticket processing consumes one time unit.OutputThe output provides information of each process execution. The line starts with the process ID,arrival and termination times, ready time (the first time the system processes the process) anddurations of running and waiting (see “output-sample.txt” in the assignment folder).You may monitor the execution of your code by displaying all its intermediate outputs asshown in the sample “detailed-output.txt” in the assignment folder. Note that this is merelyfor your own code debugging purpose, and should not be presented in the final output.Web-submission instructions• First, type the following command, all on one line (replacing xxxxxxx with your studentID):svn mkdir –parents -m “OS”• Then, check out this directory and add your files:svn co cd assignment1svn add TicketBooker.cppsvn add StudentFile1.cppsvn add StudentFile2.cpp···svn commit -m “assignment1 solution”• Next, go to the web submission system at:Navigate to 2017, 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 code does not compile you won’t get any marks for theonline testing part.• We will test your codes by the following Linux commands:g++ TicketBooker.cpp -o TicketBooker./TicketBooker input.txt > output.txt3本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

    相关文章

      网友评论

          本文标题:C++代写 Operating Systems Assign

          本文链接:https://www.haomeiwen.com/subject/vxoxpqtx.html