First Fit,Best Fit, Worst Fit Algorithm Implementation

XNENA27
timer Asked: Apr 27th, 2017

Question Description

hello,

i have a code completed and running successfully for first fit best fit and worst fit algorithms.

i just wanted to add a method in my code where i can get the no of blocked process i.e process which are in the waiting queue.

also wanted to calculate the blocking probability i.e no of blocked process/total no of process entered by user.

also memory utilization calculation where total no of memory chunks created are added up and total space taken by process memory is seen and it is divided to get memory utilization.



Unformatted Attachment Preview

Memory Management Project Part 2 Contents Introduction. ................................................................................................................................................. 2 Requirements................................................................................................................................................ 2 Requirements Achieved: ............................................................................................................................... 3 Execution Steps: ............................................................................................................................................ 3 1 Memory Management Design Document • • User Input will be solely on through the Command line. What input should be passed is displayed as a menu, the actions are done based on the Menu. Written in java language, Coding standard are followed with meaning full variable and method names, Comments are added to method, which displays the action the method is performing. For Simplicity the parent process Id, Register, Program counter, Memory limit is hard coded. • • Introduction. The project is implemented in such a way that if the process is allocated into memory blocks based on the algorithm. Once the processes are allocated to memory blocks, the process can be executed. The project is completely menu driven, from the initial stage i.e. selecting the algorithm, creating the memory chunks to execution of the process. Requirements • • • • Each process will include some information about the amount of memory needed and when (implicit: when it is created) and how long it will be needed for. You program (simulated OS) will need to keep track of all the memory space, in connection with information kept at each process. You are required to implement three algorithms: first-fit, best-fit, and worst-fit. To do this, you might need to implement a simulated clock. You need to report possible memory fragmentation. In particular, you can terminate each of the three algorithms at the first reporting of memory fragmentation. However, if you don't encounter the problem, run your program until all processes are finished or until an explicit exit command is issued by user and/or OS-admin 2 Memory Management Requirements Achieved: • • • • Each process will include some information about the amount of memory needed and when (implicit: when it is created) and how long it will be needed for. (Pass) You program (simulated OS) will need to keep track of all the memory space, in connection with information kept at each process. (Pass) You are required to implement three algorithms: first-fit, best-fit, and worst-fit. To do this, you might need to implement a simulated clock. (Pass) You need to report possible memory fragmentation. In particular, you can terminate each of the three algorithms at the first reporting of memory fragmentation. However, if you don't encounter the problem, run your program until all processes are finished or until an explicit exit user and/or OS-admin issue command. (Pass) Execution Steps: • • Copy the attached java files to a directory. Here it will be copied to D:\PCB. Open command prompt, set the java class path by executing the following command. Set path =D:\Oracle\Middleware\jdk160_24\bin 3 Memory Management • Compile the following java files in the same order. ProcessBean.java AlgorithmImplementation.java ExecuteProcess.java TestImplementation.java • Execute the TestImplementation file to run the project. 4 Memory Management • Select the Algorithm you would like to choose, and enter the memory chunks. The memory chunks needs to be created by entering the memory of different blocks in a comma separated values. Example 40, 60, 80. Any number of blocks any can created. Note: Only one algorithm can be checked at once. The project needs to execute another time to check another algorithm. • • Select 1 to add a process. Please enter the memory required for the process. In order to enter the multiple process, again enter comma separated values or memory for different process. Example 40,120 for two processes. • Please enter the time required for each process to complete, Again Please enter the same number of process as enter above. Example 4000,12000 for the above two processes. Note the time is in milli seconds. 5 Memory Management • Enter number two to display the status. By displaying the status we can know which block is occupied and the memory fragmentation. • Enter the option 3 to execute the process, Execution is based on the time when the process entered to the time when process option is selected. If the difference is more then the time required for the process. Then the process will be removed. If not the process will continues to execute until the next Execute the process is executed. 6 Memory Management • In case if more process are added than the number of blocks then process will get on to Ready Queue, And once the other process are completed execution the process in the ready will automatically move into execution if there is eligible amount of memory. How arrival time is considered is displayed below. • Once the execute the process selected. The process which are already executing will be removed, if the execution is complete and the process ready block will be added. • On selecting exit. The and running again the TestImplemention class another algorithm can be tested. 7 Memory Management Project Part 2 Contents Introduction. ................................................................................................................................................. 2 Requirements................................................................................................................................................ 2 Requirements Achieved: ............................................................................................................................... 3 Execution Steps: ............................................................................................................................................ 3 1 Memory Management Design Document • • User Input will be solely on through the Command line. What input should be passed is displayed as a menu, the actions are done based on the Menu. Written in java language, Coding standard are followed with meaning full variable and method names, Comments are added to method, which displays the action the method is performing. For Simplicity the parent process Id, Register, Program counter, Memory limit is hard coded. • • Introduction. The project is implemented in such a way that if the process is allocated into memory blocks based on the algorithm. Once the processes are allocated to memory blocks, the process can be executed. The project is completely menu driven, from the initial stage i.e. selecting the algorithm, creating the memory chunks to execution of the process. Requirements • • • • Each process will include some information about the amount of memory needed and when (implicit: when it is created) and how long it will be needed for. You program (simulated OS) will need to keep track of all the memory space, in connection with information kept at each process. You are required to implement three algorithms: first-fit, best-fit, and worst-fit. To do this, you might need to implement a simulated clock. You need to report possible memory fragmentation. In particular, you can terminate each of the three algorithms at the first reporting of memory fragmentation. However, if you don't encounter the problem, run your program until all processes are finished or until an explicit exit command is issued by user and/or OS-admin 2 Memory Management Requirements Achieved: • • • • Each process will include some information about the amount of memory needed and when (implicit: when it is created) and how long it will be needed for. (Pass) You program (simulated OS) will need to keep track of all the memory space, in connection with information kept at each process. (Pass) You are required to implement three algorithms: first-fit, best-fit, and worst-fit. To do this, you might need to implement a simulated clock. (Pass) You need to report possible memory fragmentation. In particular, you can terminate each of the three algorithms at the first reporting of memory fragmentation. However, if you don't encounter the problem, run your program until all processes are finished or until an explicit exit user and/or OS-admin issue command. (Pass) Execution Steps: • • Copy the attached java files to a directory. Here it will be copied to D:\PCB. Open command prompt, set the java class path by executing the following command. Set path =D:\Oracle\Middleware\jdk160_24\bin 3 Memory Management • Compile the following java files in the same order. ProcessBean.java AlgorithmImplementation.java ExecuteProcess.java TestImplementation.java • Execute the TestImplementation file to run the project. 4 Memory Management • Select the Algorithm you would like to choose, and enter the memory chunks. The memory chunks needs to be created by entering the memory of different blocks in a comma separated values. Example 40, 60, 80. Any number of blocks any can created. Note: Only one algorithm can be checked at once. The project needs to execute another time to check another algorithm. • • Select 1 to add a process. Please enter the memory required for the process. In order to enter the multiple process, again enter comma separated values or memory for different process. Example 40,120 for two processes. • Please enter the time required for each process to complete, Again Please enter the same number of process as enter above. Example 4000,12000 for the above two processes. Note the time is in milli seconds. 5 Memory Management • Enter number two to display the status. By displaying the status we can know which block is occupied and the memory fragmentation. • Enter the option 3 to execute the process, Execution is based on the time when the process entered to the time when process option is selected. If the difference is more then the time required for the process. Then the process will be removed. If not the process will continues to execute until the next Execute the process is executed. 6 Memory Management • In case if more process are added than the number of blocks then process will get on to Ready Queue, And once the other process are completed execution the process in the ready will automatically move into execution if there is eligible amount of memory. How arrival time is considered is displayed below. • Once the execute the process selected. The process which are already executing will be removed, if the execution is complete and the process ready block will be added. • On selecting exit. The and running again the TestImplemention class another algorithm can be tested. 7
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Content

Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors