COMMUNICATION AND SYNCHRONIZATION MECHANISMS:
The Windows NT 4.0 operating system models a microkernel architecture, meaning that each subsystem of the kernel knows nothing about the other subsystems. As a result, the NT kernel is entirely message-based which allows all parts of the operating system to communicate with each other. Messages are passed for all events that occur and it is the programs responsibility to listen for these messages and act accordingly. Therefore, the basic structure for most Windows programs is simply a message loop that receives and dispatches all messages in the applications message queue.
Since Windows messages are vital to communication, the SRMS service needs to
establish a method for communication with the task threads, and vice-versa. The
application uses three main methods to facilitate communication: windows messages, mutex
objects, and event objects. Although there are hundreds of predefined Windows messages,
Win32 provides a special function called RegisterWindowMessage() that creates
unique system-wide and application-specific Windows messages. As part of its initial setup
process, the SRMS interface creates 13 of these unique messages for various events that
may occur or for certain events that it needs communicate to the task. Event objects are
signaled or non-signaled kernel objects that are used in waiting functions. These are the
primary synchronization mechanisms used between the scheduler and a task. When a task
registers, the scheduler creates four unique event objects and saves them in its task
structure. When the scheduler needs to wake the task out of a waiting state, it sets the
event to signaled, which moves the task thread from the NT kernel's waiting queue to the
ready queue. The four event objects are described below. They are created in the set_SRMS_rtparams()
function and stored in the task_struct for that task . These events are guaranteed to be
unique for each task because the tasks real-time thread id is part of the identifier
string used by Win32s CreateEvent() function.
h |
used by the scheduler to signal a task that it is ready to be scheduled |
|
used by a task to signal the scheduler that it is finished calculating its execution requirement |
|
used by a task to signal the scheduler that its job is completed |
|
used by the scheduler to signal a task that a new job has been released |
Mutex objects are also used for synchronizing exclusive access to any of the SRMS scheduler's lists or queues.