A simulated computer
Inheritance:
Public Methods
-
Computer(ID newID = 0, string newName = "Computer")
- Default constructor
-
void addCPU(CPU newCPU)
- Adds a CPU to the computer
-
void replaceCPU(CPU newCPU)
- Replaces an existing CPU in the computer with another one.
-
void replaceRAM(RAM newRAM)
- Replaces existing RAM with another module
-
void replaceDisk(Disk newDisk)
- Replaces existing disk in the computer with another one.
-
unsigned long getNumCPUs(void) const
-
-
SIZE getNumUserProcesses(void) const
- The number of processes currently running on this computer.
-
void servingNetRAM(const bool value)
-
-
bool servingNetRAM(void) const
- Sets whether this computer may be used for harvesting network RAM.
-
bool startThread(const Token& token)
- Starts a process running on this computer
-
bool stopThread(Token& token)
- Stops a running process on this computer.
-
MEMAMT getRAMSize(void) const
- Amount of RAM the computer has (in MB)
-
MEMAMT getVMemoryAllocated(void) const
- Returns the amount of virtual memory allocated on this machine
-
PERCENT getMemoryAllocated(void) const
-
-
MEMAMT getMemoryAllocatedMB(void) const
-
-
MEMAMT getMemoryOverallocatedMB(void) const
-
-
MEMAMT getDiskAllocated(void) const
-
-
bool isOverAllocationThreshold(void) const
-
-
PERCENT getMemoryUnallocated(void) const
-
-
MEMAMT getMemoryUnallocatedMB(void) const
- Calculates amount of memory unallocated on the computer
-
PERCENT getEstMemoryAllocated(MEMAMT additional) const
-
-
TIME getCPUInUseTime(void) const
-
-
TIME getDiskInUseTime(void) const
-
-
PNRServent* getServent(void) const
-
-
void setServent(PNRServent* _servent)
-
-
set<Token> & getThreads(void)
-
-
Token& getCurrentlyRunning(void)
-
-
MEMAMT getNetworkRAMAllocated(void) const
-
-
void setNetworkRAMAllocated(const MEMAMT amt)
-
-
bool isThreadCurrentlyRunning(void)
-
-
void setCurrentlyRunning(const Token& token)
-
-
void stopCurrentlyRunning(void)
-
-
TIME nextPageFault(TIME memoryAccessRate, MEMAMT processData, MEMAMT dataInRAMMB) const
-
-
bool isFaultDisk(void) const
- Determines if a page fault results in a reference to disk or to network RAM.
-
string toString(void) const
-
-
bool activate(void)
- "Turns on" the computer - makes it ready to receive and service requests
-
void reqCPU(const Token& tkn, const TIME reqTime)
- Request to use one of the computer's CPUs
-
void relCPU(const Token& token)
- Releases a CPU from service.
-
TIME getDiskTransferTime(MEMAMT transferSize = PAGESIZE)
-
-
void reqDisk(const Token& tkn, TIME transferTime)
- Request the services of the computer's disk to read information.
-
void relDisk(const Token& token)
- Finishes disk read/write job
-
bool allocateVMemory(const MEMAMT amount)
- Allocates virtual memory on this computer
-
MEMAMT percentToMB(const PERCENT percent) const
-
-
PERCENT MBToPercent(const MEMAMT amount) const
-
-
MEMAMT deallocateVMemory(const MEMAMT amount)
- Deallocates virtual memory on this computer
-
void addAllocProjected(const MEMAMT amount)
-
Inherited from SimObj:
Public Methods
-
string getName(void) const
-
ID getID(void) const
-
void setName(const string newName)
-
void setID(const ID newID)
-
virtual void clear(void)
Documentation
This object simulates a computer. A computer in this simulation
is essentially a collection of resources (e.g. RAM, CPUs, etc.).
Computer(ID newID = 0, string newName = "Computer")
-
void addCPU(CPU newCPU)
-
A computer can have more than one CPU
void replaceCPU(CPU newCPU)
-
- Returns:
- true if successful
void replaceRAM(RAM newRAM)
-
There is no "addRAM" function since every
computer comes "prebuilt" with a default amount
of RAM.
void replaceDisk(Disk newDisk)
-
unsigned long getNumCPUs(void) const
-
- Returns:
- The number of CPUs in the computer
SIZE getNumUserProcesses(void) const
-
void servingNetRAM(const bool value)
-
- Returns:
- whether this computer may be used for harvesting network RAM.
bool servingNetRAM(void) const
-
bool startThread(const Token& token)
-
bool stopThread(Token& token)
-
MEMAMT getRAMSize(void) const
-
MEMAMT getVMemoryAllocated(void) const
-
PERCENT getMemoryAllocated(void) const
-
Note that this percentage can be well over 1 (or 100%)
- Returns:
- the amount of memory allocated expressed as a percentage
of the amount of physical memory available
MEMAMT getMemoryAllocatedMB(void) const
-
- Returns:
- total amount of memory allocated on computer by processes (in MB)
MEMAMT getMemoryOverallocatedMB(void) const
-
The overallocated memory may be stored either on disk or in network RAM.
- Returns:
- amount of memory allocated on computer that is not stored in ram (in MB)
MEMAMT getDiskAllocated(void) const
-
- Returns:
- amount of memory allocated on the computer that is paged to disk (in MB)
bool isOverAllocationThreshold(void) const
-
If this is true, then page faults will start occuring.
- Returns:
- whether more memory is allocated than is available
PERCENT getMemoryUnallocated(void) const
-
- Returns:
- amount of physical memory that is not allocated yet.
MEMAMT getMemoryUnallocatedMB(void) const
-
- Returns:
- a positive number is there is unallocated memory on the computer. Returns
zero or a negative number if there is no unallocated memory or if memory is overallocated.
PERCENT getEstMemoryAllocated(MEMAMT additional) const
-
- Returns:
- percentage of memory allocated assuming that the additional
amount of memory passed is allocated also
TIME getCPUInUseTime(void) const
-
- Returns:
- how many seconds the CPU has been in use during this simulation
TIME getDiskInUseTime(void) const
-
- Returns:
- how many seconds the disk has been in use during this simulation
PNRServent* getServent(void) const
-
void setServent(PNRServent* _servent)
-
set<Token> & getThreads(void)
-
This will only be more than 1 if we are using gang scheduling.
- Returns:
- the set of threads that is currently running on this computer
Token& getCurrentlyRunning(void)
-
MEMAMT getNetworkRAMAllocated(void) const
-
void setNetworkRAMAllocated(const MEMAMT amt)
-
bool isThreadCurrentlyRunning(void)
-
void setCurrentlyRunning(const Token& token)
-
void stopCurrentlyRunning(void)
-
TIME nextPageFault(TIME memoryAccessRate, MEMAMT processData, MEMAMT dataInRAMMB) const
-
- Returns:
- time until next page fault
bool isFaultDisk(void) const
-
- Returns:
- true if the fault refers to disk
string toString(void) const
-
- Returns:
- A string representation of the computer
bool activate(void)
-
void reqCPU(const Token& tkn, const TIME reqTime)
-
void relCPU(const Token& token)
-
TIME getDiskTransferTime(MEMAMT transferSize = PAGESIZE)
-
- Returns:
- amount of time to read or write the passed amount of data to disk
void reqDisk(const Token& tkn, TIME transferTime)
-
void relDisk(const Token& token)
-
bool allocateVMemory(const MEMAMT amount)
-
virtual memory consists of the capacity of the computer's RAM
and an assumed unlimited supply of secondary storage (disk)
- Returns:
- true if all could be allocated locally. False if not.
MEMAMT percentToMB(const PERCENT percent) const
-
- Returns:
- the MB value of a percentage of computer's ram.
PERCENT MBToPercent(const MEMAMT amount) const
-
- Returns:
- the percentage (in terms of physical ram available) representing
a given amount of RAM.
MEMAMT deallocateVMemory(const MEMAMT amount)
-
virtual memory consists of the capacity of the computer's RAM
and an assumed unlimited supply of secondary storage (disk)
void addAllocProjected(const MEMAMT amount)
-
- This class has no child classes.
- Author:
- John Oleszkiewicz
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.