Question
The objective of multiprogramming is to have some process running at the same time to maximize CPU utilization. However, for a uniprocessor system, there will
The objective of multiprogramming is to have some process running at the same time to maximize CPU utilization. However, for a uniprocessor system, there will never be more than one running process. If there are more processes, the rest will have to wait until the CPU is free and can be rescheduled. Our project is dealing about the second kind of processors. We have three kind of queues: - Job queue ? set of all processes in the system admitted for loading in the RAM and processing by the CPU - Ready queue ? set of all processes residing in main memory, ready and waiting to be executed. - Device queues ? set of processes waiting for an I/O device. Each device has its own device queue. We will limit our devices in this project to four kinds: Keyboard, Monitor, Hard disk and printer. Each queue is stored as a linked list. A Queue Header will contain pointers to the first process in the list. Each process has a pointer field that points to the next process in the Queue. The main information describing a process is it?s:
- state: Process may be in one of two states : Running or Not-running
PId : process Id, - Time_exe : time needed for the process to be executed - Kind of I/O device needed Processor will execute each waiting processor for a given time execution (Time_pr). It is also described by a state which is set to ON by the dispatcher and set to OFF after a (Time_pr) duration. Process life cycle: As presented in figure 1. The processes are waiting in the Job queue with the state Not-running, when the operating system (OP) asks for loading of a process, a process is de-queued from the Job queue and added to the ready queue. When the OP asks for a process to be executed by the CPU, the dispatcher verify if the state of the CPU is OFF, a process is de-queued from the Ready queue, the state of the process is set to Running, and the state of the processor is set to ON. After a predefined Time_pr, if the Time_exe of the running process P is greater than the Time_pr, P will be re-inserted in the ready queue with a new time execution equal to (Time_exe ? Time_pr). Else, P will be inserted in one of the four device queues according to the kind of I/O needed
For this program you have to : - Analyze the problem and extract the information needed. - Write a report of 10 pages (as explained in technical writing course) describing the different steps of the project and the UML diagram of the defined classes.
-Create four classes: ? Process.java: This class will be used to create objects of type Process. Each Process object will store all the needed information for one Process described by (state, PId, Time_exe, Kind_IO). These Process objects will be added (and deleted) from linked lists according to the state of the process and the processor. ? Job_Queue.java: This class is a Linked List, which is used to store nodes of type Process admitted in the system. This is a linked list of Process objects. This class will include all the methods that are used to operate on a queue. ? Ready_Queue.java: This class is the very basic Linked List, which is used to store nodes of type Process loaded in the RAM. This is a linked list of Process objects. This queue can contain, in addition to the basic methods needed by a queue, a method: ?Upload? to add a new process loaded in the memory ready to be executed by the CPU in the ?Ready queue?. A method ?Dispatch? moving a process to the CPU to be executed and a method ?Waitime? calculating for a given process, the waiting time to be executed by the CPU. Waitime must be a recursive method. ? Device_Queue.java: This class is also a Linked List, which is used to store nodes of type Process. This linked list of Process objects will store all the process waiting for the same device on the same LL. It is described by the Head and the kind of I/O device. This class will include all the methods that are used to operate on a queue. Input File & Output File You must Create a ?Job queue from a given input text file called ?Processfilein?. The input will consist of many lines. The first line corresponds to the number N of processes to be inserted in the Job Queue. Followed by N lines. Each line contains respectively the state of the process (R/N), its Id, the time execution and the kind of I/O devices needed (M: Monitor, K:Keyboard, H: Hard Disk and P:Printer) The user will replace the OS. By the use of a menu, he ask for: removing a process from the ?Job Queue?, and inserting it in the ?Ready queue?, removing a process from the ?Ready Queue? and re-inserting it in the ?Ready queue? again if necessary, and asking for the waiting time of a given process in the ?Ready queue?. After each of the previous action the content of the three Queues should be displayed in an output text file called ?Processfileout?. We have provided you a sample input file with matching output file. ***WARNING***
Your program MUST adhere to the EXACT format shown in the sample output file (spacing capitalization, punctuation, etc). The graders will use very large input files, resulting in very large output files. As such, the graders will use text comparison programs to compare your output to the correct output. If, for example, you have two spaces between in the output when there should be only one space, this will show up as an error even through you may have the program correct. You WILL get points off if this is the case, which is why this is being explained in detail. Minimum deduction will be 10% of the grade, as the graders will be forced to go to text editing of your program in order to give you an accurate grade. Again, your output MUST ADHERE EXACTLY to the sample output.
Grading Details Your program will be graded upon the following criteria: 1) Adhering to the implementation specifications listed on this write-up. 2) Your algorithmic design. 3) Correctness. 4) Use of Linked-Lists for the implementation of the all the Queues. If your program does not use linked-lists, you will get a zero. 5) The frequency and utility of the comments in the code, as well as the use of white space for easy readability. (If your code is poorly commented and spaced and works perfectly, you could earn as low as 80-85% on it.) 6) Compatibility to the newest version of NetBeans. (If your program does not compile in NetBeans, you will get a large deduction from your grade.) 7) Your program should include a header comment with the following information: your name, email, Student ID number, section number, assignment title, and date. 8) Your output MUST adhere to the EXACT output format shown in the sample output file. Deliverables You should submit a zip file with FIVE files inside: 1. Report.doc. 2. Process.java 3. Job_Queue.java 4. Ready_Queue.java 5. Device_Queue.java ***
Load Job Queue Ready Queue Dispatch Pause Processor Exit
Step by Step Solution
3.44 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
To complete the project described you need to perform the following tasks Analyze the problem and extract the required information Read and understand the problem statement provided Identify the key e...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started