To write a program which simulates a few methods of managing critical sections between several processes.

Words: 732
Pages: 3
Subject: Uncategorized

Purpose
To write a program which simulates a few methods of managing critical sections between several processes.
Worth and Time Frame
Points 20 Due Date/Time Friday March 25, 2022 @ 11:59pm
The Problem
HELP / toggle view DAY 10 – THU, FEBRUARY 24, 2022 71
Lecture described several ways of dealing with mutual exclusion when dealing with critical regions. Select two and write a program to simulate a multi-processing system which implements those two methods.
Description
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).
Operation
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.
Process Files
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 process 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 and/or blank lines. Comment lines have, optionally, tabs/spaces followed by a hash/pound symbol ‘#’.
Example:
# Process #00
500
# first critical section
1500
200
# Second critical section
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 integer-containing lines” are non-critical regions, “even integer-containing 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, inclusive, where integers are 4 bytes (or however many bytes your system supports for integers).
CPU Details Timing
For this project, have your “CPU” give a 500ms time slice to a process before switching it out and moving to another process.
Process Priority
For this project, when a process’s 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).
Execution
Executing your program should be as simple as:
$ ./homework2 # Bash, Perl, Python, C, C++, etc.
or
$ java homework2 # Java
or
$ {other??}
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.
Write-up
Provide a write-up PDF describing your program, how to execute it, your programming approach, the mutual exclusion methods implemented, and your findings/outputs.
Submission
(Still needs to be finalized, but…)
I would like you to submit:
Source code files only (no compiled binaries)
PDF Write-up
Input process file data-sets (especially the set causing a deadlock/race-condition, if you found one)
Whether to submit via Canvas or Gradescope is being determined.

Let Us write for you! We offer custom paper writing services Order Now.

REVIEWS


Criminology Order #: 564575

“ This is exactly what I needed . Thank you so much.”

Joanna David.


Communications and Media Order #: 564566
"Great job, completed quicker than expected. Thank you very much!"

Peggy Smith.

Art Order #: 563708
Thanks a million to the great team.

Harrison James.


"Very efficient definitely recommend this site for help getting your assignments to help"

Hannah Seven