Advertisement
Marko35S

PCB.h

May 14th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. /*
  2.  * PCB.h
  3.  *
  4.  *  Created on: May 7, 2018
  5.  *      Author: OS1
  6.  */
  7.  
  8. #ifndef PCB_H_
  9. #define PCB_H_
  10.  
  11. #include <stdio.h>
  12. #include <dos.h>
  13.  
  14. #include "Define.h"
  15. #include "Queue.h"
  16. #include "Thread.h"
  17.  
  18. //currently running thread
  19. PCB* running;
  20.  
  21. //if all threads are either blocked or sleeping use this thread
  22. //PCB* defaultThread = new Thread();
  23.  
  24. //forward declaration of the necessary classes
  25. class Thread;
  26. class List;
  27.  
  28. class PCB {
  29. public:
  30. /********************************************************/
  31. /*                  Methods                             */
  32.     //PCB constructor
  33.     PCB(Thread *myThread, StackSize stackSize = defaultStackSize, Time timeSlice = defaultTimeSlice);
  34.  
  35.     void wrapper();
  36.  
  37. /*********************************************************/
  38. /*                  Atributes               */
  39.  
  40.     unsigned *stack;
  41.     unsigned ss, sp, bp;
  42.  
  43.     //Number of time quantums that this Thread gets
  44.     Time timeSlice;
  45.  
  46.     //Time to sleep
  47.     Time sleepTime;
  48.  
  49.     //Flag that describe the state of the Thread
  50.     volatile int state;
  51.  
  52.     //Pointer to the thread that this pcb describes
  53.     Thread *myThread;
  54.  
  55.     //Threads that are waiting for this one
  56.     Queue* waitQueue;
  57.  
  58.     //ID
  59.     ID id;
  60.  
  61. /********************************************************/
  62. };
  63.  
  64. #endif /* PCB_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement