Monitory

Quiz by
Hralyb
Rate:
Last updated: May 14, 2025
You have not attempted this quiz yet.
First submittedMay 14, 2025
Times taken11
Average score71.4%
Report this quizReport
30:00
Enter answer here
0
 / 63 guessed
The quiz is paused. You have remaining.
Scoring
You scored / = %
This beats or equals % of test takers also scored 100%
The average score is
Your high score is
Your fastest time is
Keep scrolling down for answers and more stats ...
Hint
Answer
notify deklarace
struct Monitor{
 
semaphor mutex, condition;
 
int condCount;
 
}
notify inicializace
void initS(struct Monitor *s){
 
init(s->mutex, 1);
 
init(s->condition, 0);
 
s->condCount = 0;
 
}
enter
void enter(struct Monitor *s){
 
lock(s->mutex);
 
}
wait
void wait(struct Monitor *s){
 
s->condCount++;
 
unlock(s->mutex);
 
lock(s->condition);
 
lock(s->mutex);
 
}
notify
void notify(struct Monitor *s){
 
if(s->condCount > 0){
 
s->condCount--;
 
unlock(s->condition);
 
}
 
}
leave
void leave(struct Monitor *s){
 
unlock(s->mutex);
 
}
signal deklarace
struct Monitor{
 
semaphore mutex, condition, priority;
 
int condCount, prioCount;
 
}
signal inicializace
void Init(struct Monitor *s){
 
init(s->mutex, 1);
 
init(s->condition, 0);
 
init(s->priority, 0);
 
s->condCount = s->prioCount = 0;
 
}
monitorEnter
void monitorEnter(struct Monitor *s){
 
lock(s->mutex);
 
}
condWait
void condWait(struct Monitor *s){
 
s->condCount++;
 
if(s->prioCount > 0)
 
unlock(s->priority)
 
else
 
unlock(s->mutex);
 
lock(s->condition);
 
s->condCount--;
 
}
condSignal
void condSignal(struct Monitor *s){
 
if(s->condCount > 0){
 
s->prioCount++;
 
unlock(s->condition);
 
lock(s->priority);
 
s->prioCount--;
 
}
 
}
monitorExit
void monitorExit(struct Monitor *s){
 
if(s->prioCount > 0)
 
unlock(s->priority);
 
else
 
unlock(s->mutex);
 
}
Save Your Stats
Your Next Quiz
I finally learned them all. Can you name all 50?
Can you name the capitals cities of all 196 countries in the world?
Guess every major city in the world by guessing any city within 1,000 kilometers. With a map!
20 random countries have been removed from the map of the world! Can you identify them in 3 minutes?
Comments
No comments yet