Ask Question
1 February, 20:02

Design an algorithm for a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of time units (ticks). You may assume the existence of a real hardware clock that invokes a function tick () in your monitor at regular intervals.

+5
Answers (1)
  1. 1 February, 21:58
    0
    The algorithm a monitor that implements an alarm clock is designed below.

    Monitor alarm

    {

    Condition c;

    int current = 0;

    void delay (int ticks)

    {

    int alarms;

    alarms = current + ticks;

    while (current > alarms)

    c. wait (alarms);

    c. signal;

    }

    void tick ()

    {

    current = current + 1;

    delay. signal;

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Design an algorithm for a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers