Simple Virtual Machine
A simple but flexible virtual machine
SVM schedulers

This module contains API functions to handle SVM schedulers. More...

Functions

SVM_FUNCTION SVM_Scheduler svm_scheduler_get (const void *svm, const SVM_Value_PluginEntryPoint name)
 This function retrieves a scheduler from its name. More...
 
SVM_FUNCTION SVM_Scheduler svm_scheduler_get_current (const void *svm)
 This function retrieves the current scheduler. More...
 
SVM_FUNCTION void * svm_scheduler_get_internal (const void *svm, const SVM_Scheduler scheduler)
 This function extracts the internal structure of a scheduler. More...
 
SVM_FUNCTION SVM_String svm_scheduler_print (const void *svm, const SVM_Scheduler scheduler)
 This function returns a string representation of the state of a scheduler. More...
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_attach (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const SVM_Value_Integer parameter)
 This function attaches a process to a scheduler with an integer value parameter. More...
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_attach__raw (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const unsigned long int parameter)
 This function attaches a process to a scheduler with a raw integer parameter. More...
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_detach (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const SVM_Value_Integer parameter)
 This function detaches a process from a scheduler with an integer value parameter. More...
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_detach__raw (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const unsigned long int parameter)
 This function detaches a process from a scheduler with a raw integer parameter. More...
 
SVM_FUNCTION void svm_scheduler_notify (const void *svm, const SVM_Scheduler scheduler, const SVM_Value_Integer parameter)
 This function sends a notification to a scheduler with an integer value parameter. More...
 
SVM_FUNCTION void svm_scheduler_notify__raw (const void *svm, const SVM_Scheduler scheduler, const unsigned long int parameter)
 This function sends a notification to a scheduler with a raw integer parameter. More...
 

Detailed Description

This module contains API functions to handle SVM schedulers.

A scheduler is a dedicated orchestrator thread controlling process execution.

Schedulers work by reacting to some events they receive from processes.

Note
Schedulers do not manage the execution sequence of kernels within a process. This specific orchestration is managed by sequencers.
See also
SVM processes
SVM process sequencer

Function Documentation

◆ svm_scheduler_get()

SVM_FUNCTION SVM_Scheduler svm_scheduler_get ( const void *  svm,
const SVM_Value_PluginEntryPoint  name 
)

This function retrieves a scheduler from its name.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]nameThe scheduler name.
Note
If parameter name is NULL, the default scheduler is returned.
Returns
The scheduler.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the name is not associated to a scheduler.

◆ svm_scheduler_get_current()

SVM_FUNCTION SVM_Scheduler svm_scheduler_get_current ( const void *  svm)

This function retrieves the current scheduler.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
Returns
The current scheduler, or a NULL pointer when outside a scheduler context.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_scheduler_get_internal()

SVM_FUNCTION void * svm_scheduler_get_internal ( const void *  svm,
const SVM_Scheduler  scheduler 
)

This function extracts the internal structure of a scheduler.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe scheduler from which the internal structure is extracted.
Note
When this API function is used on a scheduler, synchronisation mechanisms have to be put in place to protect concurrent access to this structure.
Returns
The internal structure pointer.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_scheduler_notify()

SVM_FUNCTION void svm_scheduler_notify ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Value_Integer  parameter 
)

This function sends a notification to a scheduler with an integer value parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe scheduler to notify.
[in]parameterA parameter.
Note
If the scheduler does not support notifications, the notification is silently discarded.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_scheduler_notify__raw()

SVM_FUNCTION void svm_scheduler_notify__raw ( const void *  svm,
const SVM_Scheduler  scheduler,
const unsigned long int  parameter 
)

This function sends a notification to a scheduler with a raw integer parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe scheduler to notify.
[in]parameterA parameter.
Note
If the scheduler does not support notifications, the notification is silently discarded.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_scheduler_print()

SVM_FUNCTION SVM_String svm_scheduler_print ( const void *  svm,
const SVM_Scheduler  scheduler 
)

This function returns a string representation of the state of a scheduler.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe scheduler from which the status will be extracted.
Returns
A SVM_String containing a representation of the scheduler state.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_scheduler_process_attach()

SVM_FUNCTION SVM_Boolean svm_scheduler_process_attach ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Process  process,
const SVM_Value_Integer  parameter 
)

This function attaches a process to a scheduler with an integer value parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe receiving scheduler.
[in]processThe process to be attached.
[in]parameterA parameter.

The parameter is passed to the scheduler plugin callback attaching the process.

Note
When the attach operation fails on a newly created process and the process variable is kept local, the process remains in the system. This dangling process should be unlocked then terminated.
Returns
TRUE if the process has been attached, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when the API function is called outside a process.
See also
svm_process_ownership_lock
svm_process_get_current
svm_process_terminate
svm_scheduler_get

◆ svm_scheduler_process_attach__raw()

SVM_FUNCTION SVM_Boolean svm_scheduler_process_attach__raw ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Process  process,
const unsigned long int  parameter 
)

This function attaches a process to a scheduler with a raw integer parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe receiving scheduler.
[in]processThe process to be attached.
[in]parameterA parameter.

The parameter is passed to the scheduler plugin callback attaching the process.

Note
When the attach operation fails on a newly created process and the process variable is kept local, the process remains in the system. This dangling process should be unlocked then terminated.
Returns
TRUE if the process has been attached, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when the API function is called outside a process.
See also
svm_process_ownership_lock
svm_process_get_current
svm_process_terminate
svm_scheduler_get

◆ svm_scheduler_process_detach()

SVM_FUNCTION SVM_Boolean svm_scheduler_process_detach ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Process  process,
const SVM_Value_Integer  parameter 
)

This function detaches a process from a scheduler with an integer value parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe giving scheduler.
[in]processThe process to be detached.
[in]parameterA parameter.

The parameter is passed to the scheduler plugin callback detaching the process.

Note
When the detach operation succeeds on a process and the process variable is kept local, the process remains in the system. This dangling process should be unlocked then terminated.
Returns
TRUE if the process has been detached, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when the API function is called outside a process.
See also
svm_process_ownership_lock
svm_process_get_current
svm_process_terminate
svm_scheduler_get

◆ svm_scheduler_process_detach__raw()

SVM_FUNCTION SVM_Boolean svm_scheduler_process_detach__raw ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Process  process,
const unsigned long int  parameter 
)

This function detaches a process from a scheduler with a raw integer parameter.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]schedulerThe giving scheduler.
[in]processThe process to be detached.
[in]parameterA parameter.

The parameter is passed to the scheduler plugin callback detaching the process.

Note
When the detach operation succeeds on a process and the process variable is kept local, the process remains in the system. This dangling process should be unlocked then terminated.
Returns
TRUE if the process has been detached, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when the API function is called outside a process.
See also
svm_process_ownership_lock
svm_process_get_current
svm_process_terminate
svm_scheduler_get