Scheduler
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Scheduler::Queue Class Reference

This class implements the ready queue and the wait queue. Those queues contain processes ready to run and waiting for i/o respectively. More...

#include <queue.h>

Public Types

typedef std::list< std::shared_ptr< Process > >::iterator iterator
 

Public Member Functions

void add (std::shared_ptr< Process > p)
 add a process to the queue More...
 
std::shared_ptr< Processremove (std::shared_ptr< Process > p)
 removes the process from the queue. Note: this does not delete the process. Just remove it from queue. More...
 
iterator begin ()
 
iterator end ()
 
size_t size () const
 
bool isEmpty () const
 
void print () const
 print a summary of the queue's content More...
 
std::string getDisplay () const
 get the queue's content as a string, for command-line output More...
 
int getMaxSize () const
 get the maximum size of the queues More...
 

Static Public Member Functions

static QueuegetReadyQueue ()
 get a pointer to the system's ready queue More...
 
static QueuegetWaitQueue ()
 get a pointer to the system's wait queue More...
 

Detailed Description

This class implements the ready queue and the wait queue. Those queues contain processes ready to run and waiting for i/o respectively.

Definition at line 28 of file queue.h.

Member Typedef Documentation

typedef std::list<std::shared_ptr<Process> >::iterator Scheduler::Queue::iterator

Definition at line 52 of file queue.h.

Member Function Documentation

void Queue::add ( std::shared_ptr< Process p)

add a process to the queue

Definition at line 23 of file queue.cpp.

Queue::iterator Queue::begin ( )

Definition at line 65 of file queue.cpp.

Queue::iterator Queue::end ( )

Definition at line 69 of file queue.cpp.

std::string Queue::getDisplay ( ) const

get the queue's content as a string, for command-line output

Definition at line 95 of file queue.cpp.

int Queue::getMaxSize ( ) const

get the maximum size of the queues

Definition at line 116 of file queue.cpp.

Queue * Queue::getReadyQueue ( )
static

get a pointer to the system's ready queue

Definition at line 30 of file queue.cpp.

Queue * Queue::getWaitQueue ( )
static

get a pointer to the system's wait queue

Definition at line 37 of file queue.cpp.

bool Queue::isEmpty ( ) const

Definition at line 80 of file queue.cpp.

void Queue::print ( ) const

print a summary of the queue's content

Definition at line 86 of file queue.cpp.

std::shared_ptr< Process > Queue::remove ( std::shared_ptr< Process p)

removes the process from the queue. Note: this does not delete the process. Just remove it from queue.

Parameters
pa pointer to the process to remove
Returns
a pointer to the process if it was indeed in the queue, or nullptr otherwise

Definition at line 48 of file queue.cpp.

size_t Queue::size ( ) const

Definition at line 75 of file queue.cpp.


The documentation for this class was generated from the following files: