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

  Summary of the architecture of your system

Summary of the architecture of your system - The report should summarise the structure of your implementation, and in particular which source code files I must read to find where ?you have made use of sessions and multi-table select or join query.

  Describe how you will implement your ads

Create 5 ad groups, including their purpose and suggestions for headlines and text. Describe how you will implement your ads and the type of data you will track

  When you buy a new software package

When you buy a new software package, why does it state the atleast RAM and hard drive space your computer must have for you to run this program.

  What is meant by the internal processes of a team

What is meant by the "internal processes" of a team? Why is it important to manage both the internal processes and external opportunities/constraints of a team?

  Discuss about massachusetts high court orders suspect

Take a position on the Massachusetts Supreme Judicial Court's decision that forced decryption of a suspect's encrypted volume.

  Explain the dataset and describe each of the variables

Describe the dataset and describe each of the variables. For each variable answer the question is it categorical or numerical? The dataset is based on survey questions so propose 2 other survey questions.

  Determine the max value of range for this data set

Values of Q should be accepted in degrees and then converted to radians within the function body for use in the formula. Be sure to structure your function in a way that will accept both scalar and vector inputs.

  How to compute both the average

Write down a program that declares a vector of real numbers and input values until a 0 is entered. Add the values to the vector by using push_back(), and compute both the average and the maximum value of the numbers. Output the average and the max..

  Write a java program that read strings until done is entered

Write a java program that reads strings until "done" is entered that will count the number of times a specified character is contained in the string.

  If packet-filtering routers and firewalls protect a

if packet-filtering routers and firewalls protect a network by only allowing some traffic through what types of

  What would be a growth function for the following code

What would be a growth function for the following code fragment?

  Analyze and explain the attack process

Analyze and explain the attack process in details "technical details" includingwhere is the bug in the code, why it is a bug

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