TD2 II.3-4 Manage UserStack with Bitmap
Add a Semaphore to manage threads waiting list
This commit is contained in:
parent
6e0d91918a
commit
4da093ca38
4 changed files with 67 additions and 11 deletions
|
@ -19,6 +19,13 @@
|
|||
#include "noff.h"
|
||||
#include "list.h"
|
||||
|
||||
|
||||
#ifdef CHANGED
|
||||
#include "bitmap.h"
|
||||
class Semaphore;
|
||||
#define UserStackSize 256
|
||||
#endif //CHANGED
|
||||
|
||||
#define UserStacksAreaSize 1024 // increase this as necessary!
|
||||
|
||||
class AddrSpace:public dontcopythis
|
||||
|
@ -41,8 +48,12 @@ class AddrSpace:public dontcopythis
|
|||
// Dump program layout as SVG
|
||||
unsigned NumPages() { return numPages; }
|
||||
#ifdef CHANGED
|
||||
int Threads; // count number of threads into address space
|
||||
int threads; // count number of threads into address space
|
||||
Semaphore * semThreadsCounter;
|
||||
Semaphore * semAllocateUserStack;
|
||||
BitMap * memoryMap;
|
||||
int AllocateUserStack();
|
||||
void DeAllocateUserStack(int addr);
|
||||
#endif
|
||||
private:
|
||||
NoffHeader noffH; // Program layout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue