Write a program in java to evaluate different solutions

Assignment Help Computer Engineering
Reference no: EM132210260

Question :

Write a program in Java to evaluate different solutions to the critical sections problem in a simulated multiprogramming environment. Your program needs to read and "execute" 1-100 processes. Each process will contain several (non)critical sections. The output of the program should be a listing (table) of the process ID and it's time of completion since time 0 (to be explained later).

Your program, like a computer, needs to prep the processes at first. The program will read/open all the processes and once they're all ready to go, you begin executing process #00. This is time 0.

As a process finishes, print out the process that finished and the total time the process took to complete using the mutual exclusion method used. Since there will be two methods used, you'll have two tables to print out. See if you can catch "deadlocks": race conditions where no processes are running anymore. Hint: they may not occur! Try and force one by creating process files with values that will result in one.

For this assignment, a process will be a file of the name pXX.txt where XX is a two digit number ranging from 00 to 99. These represent process IDs. Your program needs to support up to 100 processes. The file will primarily contain nothing but a list of positive integers, one integer per line. Each integer represents milliseconds (i.e. 500 == 0.5 seconds). Also in this file may be comments. Comment lines have, optionally, tabs/spaces followed by a hash/pound symbol '#'.

Example:

# Process #00 500 # first critical section 1500 200 15 5000 # End of Process #00
Since processes typically have "setup" at their beginning, the first integer will represent a non-critical region. The second integer will be a critical region. The third, a non-critical, then 4th critical, etc. "Odd lines" are non-critical regions, "even lines" are critical regions. Note: "" are around "odd" and "even" because the process file may have comments in them!! Process files may have at most 10000 integers with each integer being a positive value between 1 and MAXINT where integers are 4 bytes.

Have your "CPU" give a 500ms time slice to a process before switching it out and moving to another process. when a process' time slice is up, move on to the next PID that has not completed. For example, if you initially had PIDs from 00 to 15 but 14 has finished and the CPU is currently on 13, when 13's time slice is done, move on to PID 15 (since 14 has finished).

The program should look for process files in the current directory. Read and account for process files sequentially, starting at 00, until you don't find one. For example, if file p01.txt through p99.txt exist, running your program should quit almost immediately because p00.txt wasn't found. Another example, if p00.txt through p99.txt all exist EXCEPT for p10.txt, your program should only process p00.txt through p09.txt since p10.txt won't be found.

Reference no: EM132210260

Questions Cloud

What is the size of the labor force : Suppose the number of employed people in an economy is 121,166,640.The unemployment rate in this economy is 10.4 percent,or .104,and the labor force.
Competitive advantages of wal-mart is least bounded : Which of the following competitive advantages of Wal-Mart is LEAST bounded by the US contexts?
Communication problem can often surface when barriers-blocks : Communication problems can often surface when barriers or “blocks” to listening occur, whereby the intended listener may be:
What is the probability that the signal is correct : Imagine a group of contestants at a TV quiz show. Behind a screen there is an urn containing 10 balls which can be either Red or Blue.
Write a program in java to evaluate different solutions : Write a program in Java to evaluate different solutions to the critical sections problem in a simulated multiprogramming environment.
Explain how understanding of logistics management : Explain how an understanding of logistics management could be relevant to your favorite charitable organization
Write a program to implement heap sort : Write a program to implement Heap sort. Also implement one of the slow sorts (Bubble, Insertion...).
Determine the probability that the groups wins the prize : Suppose the group has 3 members? What is the probability that the group wins the prize? Suppose the group had 5 members - can you write the equation.
Write a program that inputs one number consisting of five : Write a program that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd