class Computer

A simulated computer

Inheritance:


Public Methods

[more] Computer(ID newID = 0, string newName = "Computer")
Default constructor
[more]void addCPU(CPU newCPU)
Adds a CPU to the computer
[more]void replaceCPU(CPU newCPU)
Replaces an existing CPU in the computer with another one.
[more]void replaceRAM(RAM newRAM)
Replaces existing RAM with another module
[more]void replaceDisk(Disk newDisk)
Replaces existing disk in the computer with another one.
[more]unsigned long getNumCPUs(void) const
[more]SIZE getNumUserProcesses(void) const
The number of processes currently running on this computer.
[more]void servingNetRAM(const bool value)
[more]bool servingNetRAM(void) const
Sets whether this computer may be used for harvesting network RAM.
[more]bool startThread(const Token& token)
Starts a process running on this computer
[more]bool stopThread(Token& token)
Stops a running process on this computer.
[more]MEMAMT getRAMSize(void) const
Amount of RAM the computer has (in MB)
[more]MEMAMT getVMemoryAllocated(void) const
Returns the amount of virtual memory allocated on this machine
[more]PERCENT getMemoryAllocated(void) const
[more]MEMAMT getMemoryAllocatedMB(void) const
[more]MEMAMT getMemoryOverallocatedMB(void) const
[more]MEMAMT getDiskAllocated(void) const
[more]bool isOverAllocationThreshold(void) const
[more]PERCENT getMemoryUnallocated(void) const
[more]MEMAMT getMemoryUnallocatedMB(void) const
Calculates amount of memory unallocated on the computer
[more]PERCENT getEstMemoryAllocated(MEMAMT additional) const
[more]TIME getCPUInUseTime(void) const
[more]TIME getDiskInUseTime(void) const
[more]PNRServent* getServent(void) const
[more]void setServent(PNRServent* _servent)
[more]set<Token> & getThreads(void)
[more]Token& getCurrentlyRunning(void)
[more]MEMAMT getNetworkRAMAllocated(void) const
[more]void setNetworkRAMAllocated(const MEMAMT amt)
[more]bool isThreadCurrentlyRunning(void)
[more]void setCurrentlyRunning(const Token& token)
[more]void stopCurrentlyRunning(void)
[more]TIME nextPageFault(TIME memoryAccessRate, MEMAMT processData, MEMAMT dataInRAMMB) const
[more]bool isFaultDisk(void) const
Determines if a page fault results in a reference to disk or to network RAM.
[more]string toString(void) const
[more]bool activate(void)
"Turns on" the computer - makes it ready to receive and service requests
[more]void reqCPU(const Token& tkn, const TIME reqTime)
Request to use one of the computer's CPUs
[more]void relCPU(const Token& token)
Releases a CPU from service.
[more]TIME getDiskTransferTime(MEMAMT transferSize = PAGESIZE)
[more]void reqDisk(const Token& tkn, TIME transferTime)
Request the services of the computer's disk to read information.
[more]void relDisk(const Token& token)
Finishes disk read/write job
[more]bool allocateVMemory(const MEMAMT amount)
Allocates virtual memory on this computer
[more]MEMAMT percentToMB(const PERCENT percent) const
[more]PERCENT MBToPercent(const MEMAMT amount) const
[more]MEMAMT deallocateVMemory(const MEMAMT amount)
Deallocates virtual memory on this computer
[more]void addAllocProjected(const MEMAMT amount)


Inherited from SimObj:

Public Methods

ostring getName(void) const
oID getID(void) const
ovoid setName(const string newName)
ovoid setID(const ID newID)
ovirtual 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.).
o Computer(ID newID = 0, string newName = "Computer")

ovoid addCPU(CPU newCPU)
A computer can have more than one CPU

ovoid replaceCPU(CPU newCPU)
Returns:
true if successful

ovoid replaceRAM(RAM newRAM)
There is no "addRAM" function since every computer comes "prebuilt" with a default amount of RAM.

ovoid replaceDisk(Disk newDisk)

ounsigned long getNumCPUs(void) const
Returns:
The number of CPUs in the computer

oSIZE getNumUserProcesses(void) const

ovoid servingNetRAM(const bool value)
Returns:
whether this computer may be used for harvesting network RAM.

obool servingNetRAM(void) const

obool startThread(const Token& token)

obool stopThread(Token& token)

oMEMAMT getRAMSize(void) const

oMEMAMT getVMemoryAllocated(void) const

oPERCENT 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

oMEMAMT getMemoryAllocatedMB(void) const
Returns:
total amount of memory allocated on computer by processes (in MB)

oMEMAMT 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)

oMEMAMT getDiskAllocated(void) const
Returns:
amount of memory allocated on the computer that is paged to disk (in MB)

obool isOverAllocationThreshold(void) const
If this is true, then page faults will start occuring.
Returns:
whether more memory is allocated than is available

oPERCENT getMemoryUnallocated(void) const
Returns:
amount of physical memory that is not allocated yet.

oMEMAMT 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.

oPERCENT getEstMemoryAllocated(MEMAMT additional) const
Returns:
percentage of memory allocated assuming that the additional amount of memory passed is allocated also

oTIME getCPUInUseTime(void) const
Returns:
how many seconds the CPU has been in use during this simulation

oTIME getDiskInUseTime(void) const
Returns:
how many seconds the disk has been in use during this simulation

oPNRServent* getServent(void) const

ovoid setServent(PNRServent* _servent)

oset<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

oToken& getCurrentlyRunning(void)

oMEMAMT getNetworkRAMAllocated(void) const

ovoid setNetworkRAMAllocated(const MEMAMT amt)

obool isThreadCurrentlyRunning(void)

ovoid setCurrentlyRunning(const Token& token)

ovoid stopCurrentlyRunning(void)

oTIME nextPageFault(TIME memoryAccessRate, MEMAMT processData, MEMAMT dataInRAMMB) const
Returns:
time until next page fault

obool isFaultDisk(void) const
Returns:
true if the fault refers to disk

ostring toString(void) const
Returns:
A string representation of the computer

obool activate(void)

ovoid reqCPU(const Token& tkn, const TIME reqTime)

ovoid relCPU(const Token& token)

oTIME getDiskTransferTime(MEMAMT transferSize = PAGESIZE)
Returns:
amount of time to read or write the passed amount of data to disk

ovoid reqDisk(const Token& tkn, TIME transferTime)

ovoid relDisk(const Token& token)

obool 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.

oMEMAMT percentToMB(const PERCENT percent) const
Returns:
the MB value of a percentage of computer's ram.

oPERCENT MBToPercent(const MEMAMT amount) const
Returns:
the percentage (in terms of physical ram available) representing a given amount of RAM.

oMEMAMT deallocateVMemory(const MEMAMT amount)
virtual memory consists of the capacity of the computer's RAM and an assumed unlimited supply of secondary storage (disk)

ovoid 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++.