Thread Synchronization Module


Role in the System

The purpose of this module is to encapsulate thread routines and their synchronization. The relevant files are as follows: The thread.* files define the data structures that control threads. The operating system maintains a ready queue (controlled by scheduler.*) which lists the threads waiting to use the CPU. A pointer called "currentThread" points to the thread currently occupying the CPU. When the executing thread is done its process, it calls "Yield()". This sets the pointer "threadToBeDestroyed" to point to the relinguishing thread and "moves" the next thread into the CPU by reassigning "currentThread" to the new thread. If the thread has not completed its task before the allocated time is up, the function "Sleep()" is called which moves it to the end of the queue and brings in a new process. This is done so as to avoid, what is called in operating system parlance, "starvation". Furthermore, it is possible for a thread to need to invoke child threads of itself to complete a task. This is done via "Fork()". Note that the parent thread must be notified when the child thread has completed; and it is not acceptable that a parent process be terminated somehow before the children terminate. The switch.* files are internal to the system and are used to return the machine to the state the thread left it before being removed from the the CPU. The synch files are where the synchronization routines are defined. One of the assignments for NACHOS involves the students implementing either: Both of these are synchronization strategies which form the foundation of the operating system (these implementations are used on future assignments).

Uses Relation


UP ONE LEVEL

BACK TO MAIN

INDEX OF FILE NAMES

INDEX OF MODULE NAMES