FreeNOS
Public Member Functions | Private Member Functions
RecoveryServer Class Reference

Recovery Server. More...

#include <RecoveryServer.h>

Inheritance diagram for RecoveryServer:
ChannelServer< RecoveryServer, RecoveryMessage >

Public Member Functions

 RecoveryServer ()
 Class constructor function. More...
 
- Public Member Functions inherited from ChannelServer< RecoveryServer, RecoveryMessage >
 ChannelServer (RecoveryServer *inst)
 Constructor function. More...
 
virtual ~ChannelServer ()
 Destructor function. More...
 
int run ()
 Enters an infinite loop, serving incoming requests. More...
 
void setTimeout (const uint msec)
 Set a sleep timeout. More...
 

Private Member Functions

void restartProcess (RecoveryMessage *msg)
 Restart a process. More...
 
bool reloadProgram (const ProcessID pid, const char *path) const
 Overwrite the given process by fetching a fresh program data copy. More...
 
bool cleanupProgram (const ProcessID pid) const
 Release and unmap program data. More...
 
bool rewriteProgram (const ProcessID pid, const Address program, const Size size) const
 Overwrite process with given program data. More...
 

Additional Inherited Members

- Public Types inherited from ChannelServer< RecoveryServer, RecoveryMessage >
enum  Result
 Result codes. More...
 
- Protected Types inherited from ChannelServer< RecoveryServer, RecoveryMessage >
typedef void(RecoveryServer ::* IPCHandlerFunction) (RecoveryMessage *)
 Member function pointer inside Base, to handle IPC messages. More...
 
typedef void(RecoveryServer ::* IRQHandlerFunction) (Size)
 Member function pointer inside Base, to handle interrupts. More...
 
- Protected Member Functions inherited from ChannelServer< RecoveryServer, RecoveryMessage >
void addIPCHandler (const Size slot, IPCHandlerFunction h, const bool sendReply=true)
 Register a new IPC message action handler. More...
 
void addIRQHandler (const Size slot, IRQHandlerFunction h)
 Register a new IRQ message vector handler. More...
 
virtual void timeout ()
 Called when sleep timeout is reached. More...
 
virtual bool retryRequests ()
 Retry any pending requests. More...
 
virtual void onProcessTerminated (const ProcessID pid)
 Called whenever another Process is terminated. More...
 
void retryAllRequests ()
 Keep retrying requests until all served. More...
 
- Protected Attributes inherited from ChannelServer< RecoveryServer, RecoveryMessage >
RecoveryServerm_instance
 Server object instance. More...
 
ChannelClientm_client
 Client for sending replies. More...
 
ChannelRegistrym_registry
 Contains registered channels. More...
 
MemoryChannel m_kernelEvent
 Kernel event channel. More...
 
Index< MessageHandler< IPCHandlerFunction >, MaximumHandlerCountm_ipcHandlers
 IPC handler functions. More...
 
Index< MessageHandler< IRQHandlerFunction >, MaximumHandlerCountm_irqHandlers
 IRQ handler functions. More...
 
ProcessID m_self
 ProcessID of ourselves. More...
 
Timer::Info m_time
 System timer value. More...
 
Timer::Info m_expiry
 System timer expiration value. More...
 

Detailed Description

Recovery Server.

Provides fault tolerance to servers by restarting on errors (recovery)

Todo:
Support automatic restart of a process when a CPU exception occurs
Todo:
Pro-actively send ping/pong requests to processes to verify they are still running properly and are not inside an infinite loop.
Todo:
Modify FileSystemServer to use new peek() and seek() functions of MemoryChannel to support mid-transaction recovery.
Todo:
Update various servers to actually use the DatastoreServer for storing persistent data that needs to be preserved on restart. For example, the block cache in TmpFileSystem.
Todo:
Add a fault injection tester that modifies the memory of running programs to introduce/simulate software errors and verify that the system keeps running while the programs are restarted.

Definition at line 53 of file RecoveryServer.h.

Constructor & Destructor Documentation

◆ RecoveryServer()

RecoveryServer::RecoveryServer ( )

Member Function Documentation

◆ cleanupProgram()

bool RecoveryServer::cleanupProgram ( const ProcessID  pid) const
private

Release and unmap program data.

Parameters
pidProcess identifier
Returns
True if success, false otherwise

Definition at line 251 of file RecoveryServer.cpp.

References DEBUG, ERROR, MemoryMap::range(), ReleaseSections, API::Success, MemoryMap::UserData, MemoryMap::UserHeap, MemoryMap::UserPrivate, and VMCtl().

Referenced by reloadProgram().

◆ reloadProgram()

bool RecoveryServer::reloadProgram ( const ProcessID  pid,
const char *  path 
) const
private

◆ restartProcess()

void RecoveryServer::restartProcess ( RecoveryMessage msg)
private

◆ rewriteProgram()

bool RecoveryServer::rewriteProgram ( const ProcessID  pid,
const Address  program,
const Size  size 
) const
private

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