Task 5

[ Class Overview ] [ PIT ]

Task 5: Time-slice scheduling for OOStuBS

Learning objectives

Task description

In task 3, we changed the synchronisation of activities within OOStuBS to the use of the pro-/epilogue model. Now you are supposed to apply a coarse-grained locking strategy and to define a system-call interface. The scheduler should be able to displace threads triggered by the timer interrupt.

To achieve this, you must implement classes Guarded_Scheduler, Thread, PIT and Watch.

To be able to call the protected methods of the scheduler from user programs, the global variable scheduler must no longer be an instance of class Scheduler, but of class Guarded_Scheduler.

Since the main() function, as a part of the operating-system kernel, is also a protected section, it shall run on the epilogue level. In particular, it must not release the epilogue lock itself.

Implementation notes

You can (and should) use consistency tests in Locker to ensure that the epilogue level is entered and left correctly.

Consider which cases have to be distinguished when switching threads, which methods are called in the process, and where the epilogue level has to be entered or left.

Template code

For this task we do not provide anything (except for the file and class structure).

Additional information