SlideShare a Scribd company logo
1 of 27
prog-03.pdf
CSci 430: Programming Project #3
Deadlock Detection
Spring 2019
Dates:
Assigned: Monday February 25, 2019
Due: Wednesday March 13, 2019 (before Midnight)
Objectives:
ˆ Learn more about Deadlock algorithms.
ˆ Better understand how we can algorithmically detect
deadlocks on a
system.
ˆ Use C/C++ to implement vector and matrix data structures, get
prac-
tice in creating and using such data structures in C/C++.
Description:
Our textbook gives the following algorithm (pg. 276) for
algorithmically
detecting if a deadlock is present or not in a system. It requires
that the
system keep an Allocation matrix A, listing which resources are
currently
allocated to which processes, and the available vector V, which
gives the
amount of each resource currently available in the system. In
addition, the
deadlock detection algorithm requies a request matrix Q, which
keeps track
of the amount of each resource each process is currently
requesting from the
system. The algorithm is:
1. Mark each process that has a row in the Allocation matrix of
all zeros.
2. Initialize a temporary vector W to equal the Available vector
A.
1
3. Find an index i such that process i is currently unmarked and
the i th
row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k
≤ m.
If no such row is found, terminate the algorithm.
4. If such a row is found, mark process i and add the
corresponding row of
the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤
m.
Return to step 3.
A deadlock exists if and only if there are unmarked processes at
the end
of the algorithm. Each unmarked process is deadlocked.
In this assignment we will implement the deadlock detection
algorithm.
Your program will be given a �le that describes the A
allocation matrix
and the Q request matrix, representing the current state of all
allocations
and requested allocations in the system. Your program will
implement the
deadlock detection algorithm described above. The result of
your program
will be one of 2 outputs:
1. If no deadlock exists, the program will display No Deadlock
on stan-
dard output.
2. If a deadlock does exist, the program will display Deadlock:
P0, P1,
P2 on standard output, where P0, P1, P2 are the processes that
the
algorithm determined to be deadlocked in the system.
State simulation �le formats
I have provided a p3-start.cpp template that can open up and
read in the
process/resource state simulation �les used for this assignment.
Here we
discuss a bit more the format of these �le. I have provided 2 or
3 exam-
ple simulations, with expected correct answers, for you to use to
test your
implementations with.
The input �les needed for this assignment need to contain the
information
found in theV available vector and theA allocation andQ request
matrices.
In the following I use r as the number of resources and p as the
number of
processes. Thus the general format of the input �le is:
r p
V1 V2 V3 ... Vr
A11 A12 ... A1r
...
Ap1 Ap2 ... Apr
2
Q11 Q12 ... Q1r
...
Qp1 Qp2 ... Qpr
For example, the example of the deadlock detection algorithm
given on
page 277 has a system with r=5 resources and p=4 processes.
The V, A and
Q vector/matrices are shown on that page. The input �le for the
current
state of the system shown on page 277 would be
5 4
0 0 0 0 1
1 0 1 1 0
1 1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 1 0 0 1
0 0 1 0 1
0 0 0 0 1
1 0 1 0 1
The function named readSystemState() in your template p2-
start.cpp
code expects a �le of this format, and reads it into a State
structure for you.
Running Simulations
The following is a discussion of the expected output of your
program. Your
program must work from the command line, and expect a single
parameter,
the name of the state simulation input �le, as its input. Your
program
should display only a single line to standard output as a result
of running it.
If the system, described in the state input �le is not deadlocked,
the program
should simply state there was no deadlock to standard output:
$ p3.exe state-02.sim
No Deadlock
On the other hand, if your program is deadlocked, it should say
that it
detected a deadlock, and it should print out the processes that
are deadloked
to standard output:
$ p3.exe state-01.sim
Deadlock: P0, P1,
3
I have provided 2 or 3 example input state �les, named state-
01.sim,
state-02.sim, etc. I have also provided the correct and expected
output for
these simulations, named state-01.res, state-02.out, etc.
4
prog-03.zip
p3-start.cppp3-start.cpp/** @file p3-start.cpp
*
* @author Your Name Here
*
* @assg Programming Assignment #3
*
* @desc Implement the deadlock detection algorithm. Given a
file
* that describes the current allocation A of resources in th
e
* system, and the current set of outstanding requests Q in
* the system, determine if a deadlock is present or not. U
se
* the algorithm given on p.276 in the Stallings textbook.
*
* @date March 05, 2018
*/
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
usingnamespace std;
// global constants
constint MAX_PROCESSES =10;// I won't test your algorithm
with simulations with more than 10 processes
constint MAX_RESOURCES =10;// nor will I give a simulation
to test with more than 10 resources
// simple struct to read in and hold the state of the system
typedefstruct
{
int numResources;
int numProcesses;
int available[MAX_RESOURCES];// V available vector
int alloc[MAX_PROCESSES][MAX_RESOURCES];// A allocati
on matrix
int request[MAX_PROCESSES][MAX_RESOURCES];// Q requ
est matrix
}State;
/** Read system state from file.
* Given a file, read the current system state from the file.
* The system state file is expected to hold the available vector
V
* the allocation matrix A and the request matrix Q.
*
* @param simfilename The name of the file to open and read st
ate & request
* from.
* @return state A new State structure is allocated and filled wit
h the
* system state from the file. A pointer to this allocated sy
stem
* state structure is returned as a result of calling this func
tion.
*/
State* readSystemState(char* statefilename)
{
ifstream simstatefile(statefilename);
State* state;
int r, p;
// If we can't open file, abort and let the user know problem
if(!simstatefile.is_open())
{
cout <<"Error: could not open system state file: "<< statefile
name
<< endl;
exit(1);
}
// dynamically allocate a new State structure, to be filled in and
returned
state =newState;
// Format of file is this (where m = numResource n = numProces
ses
// V = available vector
// A = allocation matrix and
// Q = request matrix)
// m n
// V1 V2 V3 ... Vm
// A11 A12 ... A1m
// ...
// An1 An2 ... Anm
// Q11 Q12 ... Q1m
// ...
// Qn1 Qn2 ... Qnm
// First line, get m (numResources) and n (numProcesses)
simstatefile >> state->numResources >> state->numProcesses;
// Next line contains the available vector V
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->available[r];
}
// Next n lines contain the allocation matrix A
for(p =0; p < state->numProcesses; p++)
{
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->alloc[p][r];
}
}
// Next n lines contain the request matrix Q
for(p =0; p < state->numProcesses; p++)
{
for(r =0; r < state->numResources; r++)
{
simstatefile >> state->request[p][r];
}
}
// return the newly allocated and filled in system state
return state;
}
/** Display a vector
* Display a state vector to standard output
*
* @param len The number of items in the vector
* @param v An array of integers of len items
*/
void displayVector(int len,int v[])
{
int i;
// Display a header
for(i =0; i < len; i++)
{
cout <<"R"<< i <<" ";
}
cout << endl;
// Display values
for(i =0; i < len; i++)
{
cout << setw(2)<< v[i]<<" ";
}
cout << endl;
}
/** Display a matrix
* Display a state matrix to standard output
*
* @param rows The number of rows in the matrix
* @param cols The number of cols in the matrix
* @param m A 2 dimensional array of rows x cols integers
*/
void displayMatrix(int rows,int cols,int v[MAX_PROCESSES][
MAX_RESOURCES])
{
int r, c;
// display column headers
cout <<" ";// extra space over for row labels
for(c =0; c < cols; c++)
{
cout <<"R"<< c <<" ";
}
cout << endl;
// now display data in matrix
for(r =0; r < rows; r++)
{
cout <<"P"<< r <<" ";
for(c =0; c < cols; c++)
{
cout << setw(2)<< v[r][c]<<" ";
}
cout << endl;
}
cout << endl;
}
/** Display state
* Display the values of the resource vectors and matrices in the
indicated
* state structure
*
* @param state A pointer to a State struct whose info we shoul
d display on stdout.
*/
void displayState(State* s)
{
cout <<"numResources (m) = "<< s->numResources <<" ";
cout <<"numProcesses (n) = "<< s-
>numProcesses << endl << endl;
cout <<"Available vector V:"<< endl;
displayVector(s->numResources, s->available);
cout << endl;
cout <<"Allocation matrix A: "<< endl;
displayMatrix(s->numProcesses, s->numResources, s->alloc);
cout << endl;
cout <<"Request matrix Q: "<< endl;
displayMatrix(s->numProcesses, s->numResources, s-
>request);
cout << endl;
}
/** The deadlock detector
* The starting point for implementation of the deadlock detecti
on algorithm.
* We open and read in the allocation matrices here, then perfor
m the deadlock detection.
*
* @ param statefilename A string with the name of the file hol
ding the A and Q system state matrices
*/
void detectDeadlock(char* statefilename)
{
State* state;
state = readSystemState(statefilename);
// I have provided some example routines to read and display sy
stem state, implemented as a plain
// C struct using C 1 and 2 dimensional arrays. You can uncom
ment out the following, and/or use
// the displayMatrix() and displayVector() functions to help you
debug. But make sure you
// remove or comment back up any statements after you are done
debugging.
displayState(state);
// You need to implement your solution here. I would recomme
nd you use functions for each of
// these steps.
// Step 1: Set up a data structure that records marked/unmarked
// processes. All processes are initially unmarked Search
// through the allocation matrix to find rows of all 0, and
// mark corresponding processes in your mark structure
// Step 2: Create a temporary vector W. Copy contents of availa
ble
// vector V to W. Suggestion: create a function called
// copyVector, that takes a vector as its parameter, and returns
// a new vector.
// Need to put Steps 3 and 4 in a loop
// Step 3: Find index i such that process i is currently unmarked,
// and the ith row of Q is less than or equal to W. If no
// such process is found, need to terminate algorithm/loop.
// Suggestion: write a function that takes Q and W, and
// returns either i (index of process meeting criteria) or
// -1
// Step 4: If a row was found (e.g. i was a valid process that met
// criteria of step 3), mark process i and add the
// correspoinding row of allocation matrix to W. Loop bac
k
// to beginning of step 3.
// Step 5: after loop finishes,
// if (your marked/unmarked processes contains unmarked proce
sses)
// {
// cout << "Deadlock";
// // loop through your marked/unmarked structure, print out al
l unmarked processes as P1, P2, etc.
// cout << endl;
// }
// else // all processes were marked, so no deadlock
// {
// cout << "No Deadlock" << endl;
// }
}
/** Main entry point of deadlock detection.
* The main entry point of the deadlock detection program. Thi
s function
* checks the command line arguments, and calls the detection f
unction if correct
* arguments were supplied. We expect a single command line
argument
* which is the name of the file holding the allocation and reque
st matrices
* of the current state of the system.
*
* @param argc The argument count
* @param argv The command line argument values. We expect
argv[1] to be the
* name of a file in the current directory holding A and
Q matrices.
*/
int main(int argc,char** argv)
{
if(argc !=2)
{
cout <<"Error: expecting state matrix file as first command li
ne parameter"<< endl;
cout <<"Usage: "<< argv[0]<<" system-state.sim"<< endl;
exit(1);
}
detectDeadlock(argv[1]);
// if don't want to use command line do following. Need to reco
mpile by hand since file
// name to get simulated events from is hard coded.
// Make sure you revert back to using command line before sub
mitting your program.
//detectDeadlock("state-01.sim");
}
prog-03.pdf
CSci 430: Programming Project #3
Deadlock Detection
Spring 2019
Dates:
Assigned: Monday February 25, 2019
Due: Wednesday March 13, 2019 (before Midnight)
Objectives:
ˆ Learn more about Deadlock algorithms.
ˆ Better understand how we can algorithmically detect
deadlocks on a
system.
ˆ Use C/C++ to implement vector and matrix data structures, get
prac-
tice in creating and using such data structures in C/C++.
Description:
Our textbook gives the following algorithm (pg. 276) for
algorithmically
detecting if a deadlock is present or not in a system. It requires
that the
system keep an Allocation matrix A, listing which resources are
currently
allocated to which processes, and the available vector V, which
gives the
amount of each resource currently available in the system. In
addition, the
deadlock detection algorithm requies a request matrix Q, which
keeps track
of the amount of each resource each process is currently
requesting from the
system. The algorithm is:
1. Mark each process that has a row in the Allocation matrix of
all zeros.
2. Initialize a temporary vector W to equal the Available vector
A.
1
3. Find an index i such that process i is currently unmarked and
the i th
row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k
≤ m.
If no such row is found, terminate the algorithm.
4. If such a row is found, mark process i and add the
corresponding row of
the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤
m.
Return to step 3.
A deadlock exists if and only if there are unmarked processes at
the end
of the algorithm. Each unmarked process is deadlocked.
In this assignment we will implement the deadlock detection
algorithm.
Your program will be given a �le that describes the A
allocation matrix
and the Q request matrix, representing the current state of all
allocations
and requested allocations in the system. Your program will
implement the
deadlock detection algorithm described above. The result of
your program
will be one of 2 outputs:
1. If no deadlock exists, the program will display No Deadlock
on stan-
dard output.
2. If a deadlock does exist, the program will display Deadlock:
P0, P1,
P2 on standard output, where P0, P1, P2 are the processes that
the
algorithm determined to be deadlocked in the system.
State simulation �le formats
I have provided a p3-start.cpp template that can open up and
read in the
process/resource state simulation �les used for this assignment.
Here we
discuss a bit more the format of these �le. I have provided 2 or
3 exam-
ple simulations, with expected correct answers, for you to use to
test your
implementations with.
The input �les needed for this assignment need to contain the
information
found in theV available vector and theA allocation andQ request
matrices.
In the following I use r as the number of resources and p as the
number of
processes. Thus the general format of the input �le is:
r p
V1 V2 V3 ... Vr
A11 A12 ... A1r
...
Ap1 Ap2 ... Apr
2
Q11 Q12 ... Q1r
...
Qp1 Qp2 ... Qpr
For example, the example of the deadlock detection algorithm
given on
page 277 has a system with r=5 resources and p=4 processes.
The V, A and
Q vector/matrices are shown on that page. The input �le for the
current
state of the system shown on page 277 would be
5 4
0 0 0 0 1
1 0 1 1 0
1 1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 1 0 0 1
0 0 1 0 1
0 0 0 0 1
1 0 1 0 1
The function named readSystemState() in your template p2-
start.cpp
code expects a �le of this format, and reads it into a State
structure for you.
Running Simulations
The following is a discussion of the expected output of your
program. Your
program must work from the command line, and expect a single
parameter,
the name of the state simulation input �le, as its input. Your
program
should display only a single line to standard output as a result
of running it.
If the system, described in the state input �le is not deadlocked,
the program
should simply state there was no deadlock to standard output:
$ p3.exe state-02.sim
No Deadlock
On the other hand, if your program is deadlocked, it should say
that it
detected a deadlock, and it should print out the processes that
are deadloked
to standard output:
$ p3.exe state-01.sim
Deadlock: P0, P1,
3
I have provided 2 or 3 example input state �les, named state-
01.sim,
state-02.sim, etc. I have also provided the correct and expected
output for
these simulations, named state-01.res, state-02.out, etc.
4
state-01.sim
5 4
0 0 0 0 1
1 0 1 1 0
1 1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 1 0 0 1
0 0 1 0 1
0 0 0 0 1
1 0 1 0 1
state-01.res
Deadlock: P0, P1,
state-02.sim
5 4
0 1 0 0 1
1 0 1 1 0
1 1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 1 0 0 1
0 0 1 0 1
0 0 0 0 1
1 0 1 0 1
state-02.res
No Deadlock
state-03.sim
8 7
0 2 0 1 2 3 1 0
1 0 1 0 0 0 1 1
0 0 0 2 1 0 0 0
1 0 0 0 0 2 0 0
0 0 0 0 1 0 0 0
0 1 0 0 1 0 0 1
0 1 0 0 0 0 0 0
0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 2 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0
state-03.res
No Deadlock
state-04.sim
8 7
0 0 0 1 2 3 1 0
1 0 1 0 0 0 1 1
0 0 0 2 1 0 0 0
1 0 0 0 0 2 0 0
0 0 0 0 1 0 0 0
0 1 0 0 1 0 0 1
0 1 0 0 0 0 0 0
0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 2 0 0
0 1 0 0 0 0 1 0
0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0
state-04.res
Deadlock: P0, P2, P4, P5,
state-05.sim
10 10
1 0 1 0 2 2 1 2 2 1
1 0 1 0 0 0 0 2 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0
0 0 0 0 1 0 1 0 0 1
0 0 0 2 0 0 0 0 1 0
0 0 0 0 0 0 0 0 1 0
0 1 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1
0 0 0 1 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 1 1 0 1
1 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 1 1
1 0 0 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0 0 0
state-05.res
No Deadlock
state-06.sim
10 10
1 0 0 0 0 2 0 2 2 1
1 0 1 0 0 0 0 2 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0
0 0 0 0 1 0 1 0 0 1
0 0 0 2 0 0 0 0 1 0
0 0 0 0 0 0 0 0 1 0
0 1 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1
0 0 0 1 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 1 1 0 1
1 1 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 1 1
1 0 0 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0 0 0
state-06.res
Deadlock: P1, P3, P5,
state-07.sim
10 10
0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 2 0 1 0 0 0 0 0
0 1 0 0 1 0 1 0 0 0
0 0 0 1 0 0 0 0 0 0
0 1 0 0 0 0 1 1 0 0
0 0 1 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1 0
0 1 0 1 0 0 0 0 0 0
0 0 1 0 0 1 0 0 1 0
1 0 0 0 0 1 0 1 0 0
1 0 0 0 0 1 0 0 0 0
1 0 0 0 0 1 0 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
1 2 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1 0 0
state-07.res
Deadlock: P0, P1, P2, P3, P4,
state-08.sim
10 10
0 1 1 1 0 1 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 2 0 1 0 0 0 0 0
0 1 0 0 1 0 1 0 0 0
0 0 0 1 0 0 0 0 0 0
0 1 0 0 0 0 1 1 0 0
0 0 1 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1 0
0 1 0 1 0 0 0 0 0 0
0 0 1 0 0 1 0 0 1 0
1 0 0 0 0 1 0 1 0 0
1 0 0 0 0 1 0 0 0 0
1 0 0 0 0 1 0 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
1 2 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1 0 0
state-08.res
No Deadlock

More Related Content

Similar to prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx

Machinelearning Spark Hadoop User Group Munich Meetup 2016
Machinelearning Spark Hadoop User Group Munich Meetup 2016Machinelearning Spark Hadoop User Group Munich Meetup 2016
Machinelearning Spark Hadoop User Group Munich Meetup 2016Comsysto Reply GmbH
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questionsSrikanth
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3Srikanth
 
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxAssignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxcargillfilberto
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisEelco Visser
 
data.txtInternational Business Management l2 Cons.docx
data.txtInternational Business Management       l2        Cons.docxdata.txtInternational Business Management       l2        Cons.docx
data.txtInternational Business Management l2 Cons.docxtheodorelove43763
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packagesAjay Ohri
 
Rechecking Apache HTTP Server
Rechecking Apache HTTP ServerRechecking Apache HTTP Server
Rechecking Apache HTTP ServerPVS-Studio
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems PerformanceBrendan Gregg
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
30 5 Database Jdbc
30 5 Database Jdbc30 5 Database Jdbc
30 5 Database Jdbcphanleson
 
Java input Scanner
Java input Scanner Java input Scanner
Java input Scanner Huda Alameen
 
SQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cRachelBarker26
 
Introduction to Structured Streaming
Introduction to Structured StreamingIntroduction to Structured Streaming
Introduction to Structured StreamingKnoldus Inc.
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manualsameer farooq
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learningMax Kleiner
 

Similar to prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx (20)

Machinelearning Spark Hadoop User Group Munich Meetup 2016
Machinelearning Spark Hadoop User Group Munich Meetup 2016Machinelearning Spark Hadoop User Group Munich Meetup 2016
Machinelearning Spark Hadoop User Group Munich Meetup 2016
 
C aptitude questions
C aptitude questionsC aptitude questions
C aptitude questions
 
C - aptitude3
C - aptitude3C - aptitude3
C - aptitude3
 
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxAssignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
data.txtInternational Business Management l2 Cons.docx
data.txtInternational Business Management       l2        Cons.docxdata.txtInternational Business Management       l2        Cons.docx
data.txtInternational Business Management l2 Cons.docx
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
 
Rechecking Apache HTTP Server
Rechecking Apache HTTP ServerRechecking Apache HTTP Server
Rechecking Apache HTTP Server
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems Performance
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
30 5 Database Jdbc
30 5 Database Jdbc30 5 Database Jdbc
30 5 Database Jdbc
 
Java input Scanner
Java input Scanner Java input Scanner
Java input Scanner
 
SQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19cSQL Performance Tuning and New Features in Oracle 19c
SQL Performance Tuning and New Features in Oracle 19c
 
Introduction to Structured Streaming
Introduction to Structured StreamingIntroduction to Structured Streaming
Introduction to Structured Streaming
 
Co&amp;al lecture-07
Co&amp;al lecture-07Co&amp;al lecture-07
Co&amp;al lecture-07
 
Os lab final
Os lab finalOs lab final
Os lab final
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manual
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
 

More from stilliegeorgiana

1. The Incident Command System (ICS) is a tool forA. Co.docx
1. The Incident Command System (ICS) is a tool forA. Co.docx1. The Incident Command System (ICS) is a tool forA. Co.docx
1. The Incident Command System (ICS) is a tool forA. Co.docxstilliegeorgiana
 
1. The Thirteenth Amendment effectively brought an end to slaver.docx
1. The Thirteenth Amendment effectively brought an end to slaver.docx1. The Thirteenth Amendment effectively brought an end to slaver.docx
1. The Thirteenth Amendment effectively brought an end to slaver.docxstilliegeorgiana
 
1. The Thirteenth Amendment effectively brought an end to slavery in.docx
1. The Thirteenth Amendment effectively brought an end to slavery in.docx1. The Thirteenth Amendment effectively brought an end to slavery in.docx
1. The Thirteenth Amendment effectively brought an end to slavery in.docxstilliegeorgiana
 
1. The Fight for a True Democracyhttpswww.nytimes.com201.docx
1. The Fight for a True Democracyhttpswww.nytimes.com201.docx1. The Fight for a True Democracyhttpswww.nytimes.com201.docx
1. The Fight for a True Democracyhttpswww.nytimes.com201.docxstilliegeorgiana
 
1. The article for week 8 described hip hop as a weapon. This weeks.docx
1. The article for week 8 described hip hop as a weapon. This weeks.docx1. The article for week 8 described hip hop as a weapon. This weeks.docx
1. The article for week 8 described hip hop as a weapon. This weeks.docxstilliegeorgiana
 
1. The Hatch Act defines prohibited activities of public employees. .docx
1. The Hatch Act defines prohibited activities of public employees. .docx1. The Hatch Act defines prohibited activities of public employees. .docx
1. The Hatch Act defines prohibited activities of public employees. .docxstilliegeorgiana
 
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docxstilliegeorgiana
 
1. Some people say that chatbots are inferior for chatting.Others di.docx
1. Some people say that chatbots are inferior for chatting.Others di.docx1. Some people say that chatbots are inferior for chatting.Others di.docx
1. Some people say that chatbots are inferior for chatting.Others di.docxstilliegeorgiana
 
1. Some people say that chatbots are inferior for chatting.Other.docx
1. Some people say that chatbots are inferior for chatting.Other.docx1. Some people say that chatbots are inferior for chatting.Other.docx
1. Some people say that chatbots are inferior for chatting.Other.docxstilliegeorgiana
 
1. Some people say that chatbots are inferior for chatting. Others d.docx
1. Some people say that chatbots are inferior for chatting. Others d.docx1. Some people say that chatbots are inferior for chatting. Others d.docx
1. Some people say that chatbots are inferior for chatting. Others d.docxstilliegeorgiana
 
1. Tell us about yourself and your personal journey that has to .docx
1. Tell us about yourself and your personal journey that has to .docx1. Tell us about yourself and your personal journey that has to .docx
1. Tell us about yourself and your personal journey that has to .docxstilliegeorgiana
 
1. Tell us what characteristics of Loma Linda University are particu.docx
1. Tell us what characteristics of Loma Linda University are particu.docx1. Tell us what characteristics of Loma Linda University are particu.docx
1. Tell us what characteristics of Loma Linda University are particu.docxstilliegeorgiana
 
1. Tell us about yourself and your personal journey that has lea.docx
1. Tell us about yourself and your personal journey that has lea.docx1. Tell us about yourself and your personal journey that has lea.docx
1. Tell us about yourself and your personal journey that has lea.docxstilliegeorgiana
 
1. The Research paper will come in five parts. The instructions are.docx
1. The Research paper will come in five parts. The instructions are.docx1. The Research paper will come in five parts. The instructions are.docx
1. The Research paper will come in five parts. The instructions are.docxstilliegeorgiana
 
1. The minutiae points located on a fingerprint will help determine .docx
1. The minutiae points located on a fingerprint will help determine .docx1. The minutiae points located on a fingerprint will help determine .docx
1. The minutiae points located on a fingerprint will help determine .docxstilliegeorgiana
 
1. The initial post is to be posted first and have 300-500 words.docx
1. The initial post is to be posted first and have 300-500 words.docx1. The initial post is to be posted first and have 300-500 words.docx
1. The initial post is to be posted first and have 300-500 words.docxstilliegeorgiana
 
1. The key elements of supplier measurement are quality, delivery, a.docx
1. The key elements of supplier measurement are quality, delivery, a.docx1. The key elements of supplier measurement are quality, delivery, a.docx
1. The key elements of supplier measurement are quality, delivery, a.docxstilliegeorgiana
 
1. Search the Internet and locate an article that relates to the top.docx
1. Search the Internet and locate an article that relates to the top.docx1. Search the Internet and locate an article that relates to the top.docx
1. Search the Internet and locate an article that relates to the top.docxstilliegeorgiana
 
1. Text mining – Text mining or text data mining is a process to e.docx
1. Text mining – Text mining or text data mining is a process to e.docx1. Text mining – Text mining or text data mining is a process to e.docx
1. Text mining – Text mining or text data mining is a process to e.docxstilliegeorgiana
 
1. Students need to review 3 different social media platforms that a.docx
1. Students need to review 3 different social media platforms that a.docx1. Students need to review 3 different social media platforms that a.docx
1. Students need to review 3 different social media platforms that a.docxstilliegeorgiana
 

More from stilliegeorgiana (20)

1. The Incident Command System (ICS) is a tool forA. Co.docx
1. The Incident Command System (ICS) is a tool forA. Co.docx1. The Incident Command System (ICS) is a tool forA. Co.docx
1. The Incident Command System (ICS) is a tool forA. Co.docx
 
1. The Thirteenth Amendment effectively brought an end to slaver.docx
1. The Thirteenth Amendment effectively brought an end to slaver.docx1. The Thirteenth Amendment effectively brought an end to slaver.docx
1. The Thirteenth Amendment effectively brought an end to slaver.docx
 
1. The Thirteenth Amendment effectively brought an end to slavery in.docx
1. The Thirteenth Amendment effectively brought an end to slavery in.docx1. The Thirteenth Amendment effectively brought an end to slavery in.docx
1. The Thirteenth Amendment effectively brought an end to slavery in.docx
 
1. The Fight for a True Democracyhttpswww.nytimes.com201.docx
1. The Fight for a True Democracyhttpswww.nytimes.com201.docx1. The Fight for a True Democracyhttpswww.nytimes.com201.docx
1. The Fight for a True Democracyhttpswww.nytimes.com201.docx
 
1. The article for week 8 described hip hop as a weapon. This weeks.docx
1. The article for week 8 described hip hop as a weapon. This weeks.docx1. The article for week 8 described hip hop as a weapon. This weeks.docx
1. The article for week 8 described hip hop as a weapon. This weeks.docx
 
1. The Hatch Act defines prohibited activities of public employees. .docx
1. The Hatch Act defines prohibited activities of public employees. .docx1. The Hatch Act defines prohibited activities of public employees. .docx
1. The Hatch Act defines prohibited activities of public employees. .docx
 
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx
1. The Case for Reparations” by Ta-Nehisi Coates (604-19) in Rere.docx
 
1. Some people say that chatbots are inferior for chatting.Others di.docx
1. Some people say that chatbots are inferior for chatting.Others di.docx1. Some people say that chatbots are inferior for chatting.Others di.docx
1. Some people say that chatbots are inferior for chatting.Others di.docx
 
1. Some people say that chatbots are inferior for chatting.Other.docx
1. Some people say that chatbots are inferior for chatting.Other.docx1. Some people say that chatbots are inferior for chatting.Other.docx
1. Some people say that chatbots are inferior for chatting.Other.docx
 
1. Some people say that chatbots are inferior for chatting. Others d.docx
1. Some people say that chatbots are inferior for chatting. Others d.docx1. Some people say that chatbots are inferior for chatting. Others d.docx
1. Some people say that chatbots are inferior for chatting. Others d.docx
 
1. Tell us about yourself and your personal journey that has to .docx
1. Tell us about yourself and your personal journey that has to .docx1. Tell us about yourself and your personal journey that has to .docx
1. Tell us about yourself and your personal journey that has to .docx
 
1. Tell us what characteristics of Loma Linda University are particu.docx
1. Tell us what characteristics of Loma Linda University are particu.docx1. Tell us what characteristics of Loma Linda University are particu.docx
1. Tell us what characteristics of Loma Linda University are particu.docx
 
1. Tell us about yourself and your personal journey that has lea.docx
1. Tell us about yourself and your personal journey that has lea.docx1. Tell us about yourself and your personal journey that has lea.docx
1. Tell us about yourself and your personal journey that has lea.docx
 
1. The Research paper will come in five parts. The instructions are.docx
1. The Research paper will come in five parts. The instructions are.docx1. The Research paper will come in five parts. The instructions are.docx
1. The Research paper will come in five parts. The instructions are.docx
 
1. The minutiae points located on a fingerprint will help determine .docx
1. The minutiae points located on a fingerprint will help determine .docx1. The minutiae points located on a fingerprint will help determine .docx
1. The minutiae points located on a fingerprint will help determine .docx
 
1. The initial post is to be posted first and have 300-500 words.docx
1. The initial post is to be posted first and have 300-500 words.docx1. The initial post is to be posted first and have 300-500 words.docx
1. The initial post is to be posted first and have 300-500 words.docx
 
1. The key elements of supplier measurement are quality, delivery, a.docx
1. The key elements of supplier measurement are quality, delivery, a.docx1. The key elements of supplier measurement are quality, delivery, a.docx
1. The key elements of supplier measurement are quality, delivery, a.docx
 
1. Search the Internet and locate an article that relates to the top.docx
1. Search the Internet and locate an article that relates to the top.docx1. Search the Internet and locate an article that relates to the top.docx
1. Search the Internet and locate an article that relates to the top.docx
 
1. Text mining – Text mining or text data mining is a process to e.docx
1. Text mining – Text mining or text data mining is a process to e.docx1. Text mining – Text mining or text data mining is a process to e.docx
1. Text mining – Text mining or text data mining is a process to e.docx
 
1. Students need to review 3 different social media platforms that a.docx
1. Students need to review 3 different social media platforms that a.docx1. Students need to review 3 different social media platforms that a.docx
1. Students need to review 3 different social media platforms that a.docx
 

Recently uploaded

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 

Recently uploaded (20)

Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 

prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx

  • 1. prog-03.pdf CSci 430: Programming Project #3 Deadlock Detection Spring 2019 Dates: Assigned: Monday February 25, 2019 Due: Wednesday March 13, 2019 (before Midnight) Objectives: ˆ Learn more about Deadlock algorithms. ˆ Better understand how we can algorithmically detect deadlocks on a system. ˆ Use C/C++ to implement vector and matrix data structures, get prac- tice in creating and using such data structures in C/C++. Description: Our textbook gives the following algorithm (pg. 276) for algorithmically detecting if a deadlock is present or not in a system. It requires that the system keep an Allocation matrix A, listing which resources are
  • 2. currently allocated to which processes, and the available vector V, which gives the amount of each resource currently available in the system. In addition, the deadlock detection algorithm requies a request matrix Q, which keeps track of the amount of each resource each process is currently requesting from the system. The algorithm is: 1. Mark each process that has a row in the Allocation matrix of all zeros. 2. Initialize a temporary vector W to equal the Available vector A. 1 3. Find an index i such that process i is currently unmarked and the i th row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k ≤ m. If no such row is found, terminate the algorithm. 4. If such a row is found, mark process i and add the corresponding row of the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤ m. Return to step 3. A deadlock exists if and only if there are unmarked processes at the end of the algorithm. Each unmarked process is deadlocked.
  • 3. In this assignment we will implement the deadlock detection algorithm. Your program will be given a �le that describes the A allocation matrix and the Q request matrix, representing the current state of all allocations and requested allocations in the system. Your program will implement the deadlock detection algorithm described above. The result of your program will be one of 2 outputs: 1. If no deadlock exists, the program will display No Deadlock on stan- dard output. 2. If a deadlock does exist, the program will display Deadlock: P0, P1, P2 on standard output, where P0, P1, P2 are the processes that the algorithm determined to be deadlocked in the system. State simulation �le formats I have provided a p3-start.cpp template that can open up and read in the process/resource state simulation �les used for this assignment. Here we discuss a bit more the format of these �le. I have provided 2 or 3 exam- ple simulations, with expected correct answers, for you to use to test your implementations with. The input �les needed for this assignment need to contain the
  • 4. information found in theV available vector and theA allocation andQ request matrices. In the following I use r as the number of resources and p as the number of processes. Thus the general format of the input �le is: r p V1 V2 V3 ... Vr A11 A12 ... A1r ... Ap1 Ap2 ... Apr 2 Q11 Q12 ... Q1r ... Qp1 Qp2 ... Qpr For example, the example of the deadlock detection algorithm given on page 277 has a system with r=5 resources and p=4 processes. The V, A and Q vector/matrices are shown on that page. The input �le for the current state of the system shown on page 277 would be 5 4
  • 5. 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 The function named readSystemState() in your template p2- start.cpp code expects a �le of this format, and reads it into a State structure for you. Running Simulations The following is a discussion of the expected output of your program. Your program must work from the command line, and expect a single parameter, the name of the state simulation input �le, as its input. Your program should display only a single line to standard output as a result of running it. If the system, described in the state input �le is not deadlocked, the program
  • 6. should simply state there was no deadlock to standard output: $ p3.exe state-02.sim No Deadlock On the other hand, if your program is deadlocked, it should say that it detected a deadlock, and it should print out the processes that are deadloked to standard output: $ p3.exe state-01.sim Deadlock: P0, P1, 3 I have provided 2 or 3 example input state �les, named state- 01.sim, state-02.sim, etc. I have also provided the correct and expected output for these simulations, named state-01.res, state-02.out, etc. 4 prog-03.zip p3-start.cppp3-start.cpp/** @file p3-start.cpp * * @author Your Name Here * * @assg Programming Assignment #3
  • 7. * * @desc Implement the deadlock detection algorithm. Given a file * that describes the current allocation A of resources in th e * system, and the current set of outstanding requests Q in * the system, determine if a deadlock is present or not. U se * the algorithm given on p.276 in the Stallings textbook. * * @date March 05, 2018 */ #include<stdlib.h> #include<iostream> #include<iomanip> #include<fstream> #include<string> usingnamespace std; // global constants constint MAX_PROCESSES =10;// I won't test your algorithm with simulations with more than 10 processes constint MAX_RESOURCES =10;// nor will I give a simulation to test with more than 10 resources // simple struct to read in and hold the state of the system typedefstruct { int numResources; int numProcesses; int available[MAX_RESOURCES];// V available vector int alloc[MAX_PROCESSES][MAX_RESOURCES];// A allocati on matrix int request[MAX_PROCESSES][MAX_RESOURCES];// Q requ
  • 8. est matrix }State; /** Read system state from file. * Given a file, read the current system state from the file. * The system state file is expected to hold the available vector V * the allocation matrix A and the request matrix Q. * * @param simfilename The name of the file to open and read st ate & request * from. * @return state A new State structure is allocated and filled wit h the * system state from the file. A pointer to this allocated sy stem * state structure is returned as a result of calling this func tion. */ State* readSystemState(char* statefilename) { ifstream simstatefile(statefilename); State* state; int r, p; // If we can't open file, abort and let the user know problem if(!simstatefile.is_open()) { cout <<"Error: could not open system state file: "<< statefile name << endl; exit(1); } // dynamically allocate a new State structure, to be filled in and
  • 9. returned state =newState; // Format of file is this (where m = numResource n = numProces ses // V = available vector // A = allocation matrix and // Q = request matrix) // m n // V1 V2 V3 ... Vm // A11 A12 ... A1m // ... // An1 An2 ... Anm // Q11 Q12 ... Q1m // ... // Qn1 Qn2 ... Qnm // First line, get m (numResources) and n (numProcesses) simstatefile >> state->numResources >> state->numProcesses; // Next line contains the available vector V for(r =0; r < state->numResources; r++) { simstatefile >> state->available[r]; } // Next n lines contain the allocation matrix A for(p =0; p < state->numProcesses; p++) { for(r =0; r < state->numResources; r++) { simstatefile >> state->alloc[p][r]; } } // Next n lines contain the request matrix Q
  • 10. for(p =0; p < state->numProcesses; p++) { for(r =0; r < state->numResources; r++) { simstatefile >> state->request[p][r]; } } // return the newly allocated and filled in system state return state; } /** Display a vector * Display a state vector to standard output * * @param len The number of items in the vector * @param v An array of integers of len items */ void displayVector(int len,int v[]) { int i; // Display a header for(i =0; i < len; i++) { cout <<"R"<< i <<" "; } cout << endl; // Display values for(i =0; i < len; i++) { cout << setw(2)<< v[i]<<" "; } cout << endl; }
  • 11. /** Display a matrix * Display a state matrix to standard output * * @param rows The number of rows in the matrix * @param cols The number of cols in the matrix * @param m A 2 dimensional array of rows x cols integers */ void displayMatrix(int rows,int cols,int v[MAX_PROCESSES][ MAX_RESOURCES]) { int r, c; // display column headers cout <<" ";// extra space over for row labels for(c =0; c < cols; c++) { cout <<"R"<< c <<" "; } cout << endl; // now display data in matrix for(r =0; r < rows; r++) { cout <<"P"<< r <<" "; for(c =0; c < cols; c++) { cout << setw(2)<< v[r][c]<<" "; } cout << endl; } cout << endl; } /** Display state * Display the values of the resource vectors and matrices in the
  • 12. indicated * state structure * * @param state A pointer to a State struct whose info we shoul d display on stdout. */ void displayState(State* s) { cout <<"numResources (m) = "<< s->numResources <<" "; cout <<"numProcesses (n) = "<< s- >numProcesses << endl << endl; cout <<"Available vector V:"<< endl; displayVector(s->numResources, s->available); cout << endl; cout <<"Allocation matrix A: "<< endl; displayMatrix(s->numProcesses, s->numResources, s->alloc); cout << endl; cout <<"Request matrix Q: "<< endl; displayMatrix(s->numProcesses, s->numResources, s- >request); cout << endl; } /** The deadlock detector * The starting point for implementation of the deadlock detecti on algorithm. * We open and read in the allocation matrices here, then perfor m the deadlock detection. * * @ param statefilename A string with the name of the file hol ding the A and Q system state matrices
  • 13. */ void detectDeadlock(char* statefilename) { State* state; state = readSystemState(statefilename); // I have provided some example routines to read and display sy stem state, implemented as a plain // C struct using C 1 and 2 dimensional arrays. You can uncom ment out the following, and/or use // the displayMatrix() and displayVector() functions to help you debug. But make sure you // remove or comment back up any statements after you are done debugging. displayState(state); // You need to implement your solution here. I would recomme nd you use functions for each of // these steps. // Step 1: Set up a data structure that records marked/unmarked // processes. All processes are initially unmarked Search // through the allocation matrix to find rows of all 0, and // mark corresponding processes in your mark structure // Step 2: Create a temporary vector W. Copy contents of availa ble // vector V to W. Suggestion: create a function called // copyVector, that takes a vector as its parameter, and returns // a new vector. // Need to put Steps 3 and 4 in a loop // Step 3: Find index i such that process i is currently unmarked, // and the ith row of Q is less than or equal to W. If no // such process is found, need to terminate algorithm/loop.
  • 14. // Suggestion: write a function that takes Q and W, and // returns either i (index of process meeting criteria) or // -1 // Step 4: If a row was found (e.g. i was a valid process that met // criteria of step 3), mark process i and add the // correspoinding row of allocation matrix to W. Loop bac k // to beginning of step 3. // Step 5: after loop finishes, // if (your marked/unmarked processes contains unmarked proce sses) // { // cout << "Deadlock"; // // loop through your marked/unmarked structure, print out al l unmarked processes as P1, P2, etc. // cout << endl; // } // else // all processes were marked, so no deadlock // { // cout << "No Deadlock" << endl; // } } /** Main entry point of deadlock detection. * The main entry point of the deadlock detection program. Thi s function * checks the command line arguments, and calls the detection f unction if correct * arguments were supplied. We expect a single command line argument * which is the name of the file holding the allocation and reque st matrices * of the current state of the system.
  • 15. * * @param argc The argument count * @param argv The command line argument values. We expect argv[1] to be the * name of a file in the current directory holding A and Q matrices. */ int main(int argc,char** argv) { if(argc !=2) { cout <<"Error: expecting state matrix file as first command li ne parameter"<< endl; cout <<"Usage: "<< argv[0]<<" system-state.sim"<< endl; exit(1); } detectDeadlock(argv[1]); // if don't want to use command line do following. Need to reco mpile by hand since file // name to get simulated events from is hard coded. // Make sure you revert back to using command line before sub mitting your program. //detectDeadlock("state-01.sim"); } prog-03.pdf CSci 430: Programming Project #3 Deadlock Detection Spring 2019
  • 16. Dates: Assigned: Monday February 25, 2019 Due: Wednesday March 13, 2019 (before Midnight) Objectives: ˆ Learn more about Deadlock algorithms. ˆ Better understand how we can algorithmically detect deadlocks on a system. ˆ Use C/C++ to implement vector and matrix data structures, get prac- tice in creating and using such data structures in C/C++. Description: Our textbook gives the following algorithm (pg. 276) for algorithmically detecting if a deadlock is present or not in a system. It requires that the system keep an Allocation matrix A, listing which resources are currently allocated to which processes, and the available vector V, which gives the amount of each resource currently available in the system. In addition, the deadlock detection algorithm requies a request matrix Q, which keeps track of the amount of each resource each process is currently requesting from the system. The algorithm is: 1. Mark each process that has a row in the Allocation matrix of
  • 17. all zeros. 2. Initialize a temporary vector W to equal the Available vector A. 1 3. Find an index i such that process i is currently unmarked and the i th row of Q is less than or equal toW. That is, Qik ≤ Wk, for 1 ≤ k ≤ m. If no such row is found, terminate the algorithm. 4. If such a row is found, mark process i and add the corresponding row of the allocation matrix toW. That is, setWk = Wk+Aik, for 1 ≤ k ≤ m. Return to step 3. A deadlock exists if and only if there are unmarked processes at the end of the algorithm. Each unmarked process is deadlocked. In this assignment we will implement the deadlock detection algorithm. Your program will be given a �le that describes the A allocation matrix and the Q request matrix, representing the current state of all allocations and requested allocations in the system. Your program will implement the deadlock detection algorithm described above. The result of your program will be one of 2 outputs:
  • 18. 1. If no deadlock exists, the program will display No Deadlock on stan- dard output. 2. If a deadlock does exist, the program will display Deadlock: P0, P1, P2 on standard output, where P0, P1, P2 are the processes that the algorithm determined to be deadlocked in the system. State simulation �le formats I have provided a p3-start.cpp template that can open up and read in the process/resource state simulation �les used for this assignment. Here we discuss a bit more the format of these �le. I have provided 2 or 3 exam- ple simulations, with expected correct answers, for you to use to test your implementations with. The input �les needed for this assignment need to contain the information found in theV available vector and theA allocation andQ request matrices. In the following I use r as the number of resources and p as the number of processes. Thus the general format of the input �le is: r p V1 V2 V3 ... Vr A11 A12 ... A1r
  • 19. ... Ap1 Ap2 ... Apr 2 Q11 Q12 ... Q1r ... Qp1 Qp2 ... Qpr For example, the example of the deadlock detection algorithm given on page 277 has a system with r=5 resources and p=4 processes. The V, A and Q vector/matrices are shown on that page. The input �le for the current state of the system shown on page 277 would be 5 4 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1
  • 20. 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 The function named readSystemState() in your template p2- start.cpp code expects a �le of this format, and reads it into a State structure for you. Running Simulations The following is a discussion of the expected output of your program. Your program must work from the command line, and expect a single parameter, the name of the state simulation input �le, as its input. Your program should display only a single line to standard output as a result of running it. If the system, described in the state input �le is not deadlocked, the program should simply state there was no deadlock to standard output: $ p3.exe state-02.sim No Deadlock On the other hand, if your program is deadlocked, it should say that it detected a deadlock, and it should print out the processes that are deadloked to standard output:
  • 21. $ p3.exe state-01.sim Deadlock: P0, P1, 3 I have provided 2 or 3 example input state �les, named state- 01.sim, state-02.sim, etc. I have also provided the correct and expected output for these simulations, named state-01.res, state-02.out, etc. 4 state-01.sim 5 4 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 state-01.res Deadlock: P0, P1, state-02.sim
  • 22. 5 4 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 state-02.res No Deadlock state-03.sim 8 7 0 2 0 1 2 3 1 0 1 0 1 0 0 0 1 1 0 0 0 2 1 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0
  • 23. state-03.res No Deadlock state-04.sim 8 7 0 0 0 1 2 3 1 0 1 0 1 0 0 0 1 1 0 0 0 2 1 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 state-04.res Deadlock: P0, P2, P4, P5, state-05.sim 10 10 1 0 1 0 2 2 1 2 2 1 1 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 0 0
  • 24. 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 state-05.res No Deadlock state-06.sim 10 10 1 0 0 0 0 2 0 2 2 1 1 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 25. 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 state-06.res Deadlock: P1, P3, P5, state-07.sim 10 10 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0
  • 26. 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 state-07.res Deadlock: P0, P1, P2, P3, P4, state-08.sim 10 10 0 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0