首页 > 试题广场 >

Write (in pseudocode) an imple

[问答题]

Write (in pseudocode) an implementation of  virtual clocks,including the queuing and management of timer requests for the kemel and applications.Assume that the hardware provides three timer channels.

推荐

Each channel would run the following algorithm:

/* * data definitione * * /

// a list of interrupte sorted by earlleat-time-first order

List interruptList

//the 1ist that aasociates a requeat with an entry in interruptLiat
List requeatLiat

// an interrupt-based timer

Timer timer


while [true) {

/* * Get the next earliest time in the 1ist * * /
timer .setTime - interruptlist.next ();

/* * An interrupt will occur at time timer aetTime .*/

/* * now wait for the timer interrupt

i.e.for the timer to expire **/

notify( requeatlist.next() );

}

发表于 2018-03-25 10:22:13 回复(0)