C/C++ 编程代写
当前位置:以往案例 > >案例C语言 计算机专业CS: Computer Project 9-process ma
2017-07-16


project Overview


This project focuses on process management within an operating system, including processor scheduling. You will design and implement the C/C++ program which is described below.


It is worth 50 points (5% of course grade) and must be completed no later than 11:59 PM on Thursday, 11/30.


project Deliverables


The deliverables for this project are the following files:


proj09.makefile – the makefile which produces "proj09" proj09.student.c – the source code file for your solution


Be sure to use the specified file names and to submit your files for grading via the CSE handin system before the project deadline.


project Specifications


The program will simulate the steps that an operating system takes to manage user processes. The operating system uses a five-state process model: New, Ready, Running, Blocked, and Exit.


When a process is created, it is assigned a Process Control Block (PCB) and it moves into the Ready state.


While in the Running state, a process may issue two types of requests: a request to halt (which is issued when a process has completed its processing and is ready to leave the system), and a request to block (which is issued when the process must wait for some event, such as an I/O operation).


When a process becomes unblocked, it moves from the Blocked state to the Ready state.


1. Your program will process a file which contains the simulation parameters and the process stream. The first three lines of the file will contain the simulation parameters (one item per line):


a) Length of the simulation in ticks (an integer; 0 or more for this project)

b) Number of CPUs in the system (an integer; 1 for this project)

c) Short-term scheduling algorithm (a string; "FCFS" or "Priority" for this project)


2. Zero or more lines will follow the simulation parameters to represent the process stream. Each line will contain the following fields, separated by blanks:


a) Process identification number

b) Priority (from 1 to 3)

c) Number of CPU bursts

d) Burst time (in ticks)

e) Blocked time (in ticks)

f) Arrival time (in ticks since start of simulation)




The number of CPU bursts is an integer value representing the number of times that the process uses the CPU.



The burst time is an integer value representing the length of time that the process uses the CPU before issuing a service request.


The blocked time is an integer value representing the length of time that the process is blocked after issuing a service request.


3. On each tick of simulated time, the program will do zero or more of the following (in order):


a) Recognize a request issued by a process in the Running state

b) Recognize when a process in the Blocked state has become unblocked

c) Recognize the arrival of a new process

d) Dispatch a process in the Ready state


4. When a process terminates, the program will display the following information about that process:


a) All process parameters (items (2a) to (2f) above)

b) Departure time (in ticks since start of simulation)

c) Cumulative time in the Ready state (in ticks)

d) Cumulative time in the Running state (in ticks)

e) Cumulative time in the Blocked state (in ticks)

f) Turnaround time (in ticks)

g) Normalized turnaround time (with two fractional digits of accuracy)


5. The string "FCFS" represents non-preemptive first-come-first-served scheduling. The string "Priority" represents non-preemptive priority scheduling, where 1 represents the highest priority.


6. The program will accept two command-line arguments: an integer representing the value of N and the name of the input file.


7. The program will display the command-line arguments and the simulation parameters (items (1a) to (1c) above) before processing the process stream.


8. The program will display the following information at the end of the simulation:


a) The current tick

b) Process ID of each process in the Ready state

c) Process ID of each process in the Running state

d) Process ID of each process in the Blocked state


That display will reflect the state of the processes immediately after the transition from one tick to the next (after all actions associated with the previous tick have occurred, but before any actions associated with the current tick).


In addition, if the value of N (the first command-line argument) is a positive integer value, the program will display items (8a) to (8d) after every N ticks.


9. The program will include appropriate error-handling.


project Notes


1. In Project #10, you will extend your program from Project #9.


2. For this project, you may assume that contents of the input file will be valid.

在线提交订单