Шукаєте відповіді та рішення тестів для OS LAB EVEN SEM 24-25? Перегляньте нашу велику колекцію перевірених відповідей для OS LAB EVEN SEM 24-25 в moodle.spit.ac.in.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
A single processor system has 3 resource types X,Y,Z.
there are 5 units of each resource type.
Consider the scenario where column allocation denotes the number of units of each resource types allocated to each process. And the column request denote the number of units of each resource type requested by a process in order to complete execution . state which process finish last?
|
Allocation
|
Request
| ||||
|
X
|
Y
|
Z
|
X
|
Y
|
Z
|
P1
|
1
|
2
|
1
|
1
|
0
|
3
|
P2
|
2
|
0
|
1
|
0
|
1
|
2
|
P3
|
2
|
2
|
1
|
1
|
2
|
0
|
let there be 5 processes and 3 resources type A,B,C
Resource type A has 10 instances.
Resource type B has 5 instances.
Resource type C has 7 instances.
Consider the snapshot at time T0
|
Allocation
|
Max
|
Available
| ||||||
P1
|
0
|
1
|
0
|
7
|
5
|
3
|
3
|
3
|
2
|
P2
|
2
|
0
|
0
|
3
|
2
|
2
|
|
|
|
P3
|
3
|
0
|
2
|
9
|
0
|
2
|
|
|
|
P4
|
2
|
1
|
1
|
2
|
8
|
2
|
|
|
|
P5
|
0
|
0
|
2
|
4
|
3
|
3
|
|
|
|
Which of the following statement is true
Semaphore S=1, there are 5 processes po,p1,p2,p3,p4 execute the following code
p0 to p3 execute while (1) { P(S) <CS.> V(S) } | p4 execute {P(S) <CS.> V(S)} |
---|
How many maximum number of processes can be present in critical section at any point of time?
Binary semaphore S1=1 and S2=1
int x=10
p0(){ p(s1) p(s2) x=x+1 v(s2) v(s1)} | ------------ | p1(){ p(s2) p(s1) x=x+1 v(s2) v(s1)} |
---|
what will be the value of x after execution of p0 and p1?
Processes p1,p2,p3,p4,p5 share a semaphore variable mutex, initialized to 1. Suppose a processes executes in the following manner :
signal(mutex);
.....
critical section
.....
wait(mutex);
In this situation :
Semaphore S=1, there are 5 processes po,p1,p2,p3,p4 execute the following code
p0 to p3 execute while (1) { P(S) <CS.> V(S) } | p4 execute {V(S) <CS.> V(S)} |
---|
How many maximum number of processes can be present in critical section at any point of time?
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are 0.
Method used by P1 :
while(S1==S2);
Critical section
S1 = S2;
Method used by P2 :
while(S1!=S2);
Critical section
S2 = not(S1);
which process will execute first? the above construct fails to provide ---
What is value of binary semaphore "S" after executing 10 P (Wait) operations if the initial value of "S" is 1? how many process will be blocked?
boolean blocked[2];
int turn;
void P(int id) {
while(true) {
blocked[id] = true;
while(turn != id) {
while(blocked[1-id])
/* do nothing */;
turn = id;
}
/* critical section */
blocked[id] = false;
/* remainder */
}
}
void main() {
blocked[0] = false;
blocked[1] = false;
turn = 0;
parbegin(P(0), P(1)); //RUN P0 and P1 parallel
The above code provide satisfies progress or not?
Binary semaphore S1=1 and S2=0
int x=10
p0(){ p(s1) x=x+1 v(s2)} | --------------- | p1(){ p(s2) x=x+1 v(s1)} |
---|
what will be the value of x after execution of p0 and p1?
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!