Simple Virtual Machine
A simple but flexible virtual machine
Loading...
Searching...
No Matches
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.
 
SVM_FUNCTION SVM_Scheduler svm_scheduler_get_current (const void *svm)
 This function retrieves the current scheduler.
 
SVM_FUNCTION void * svm_scheduler_get_internal (const void *svm, const SVM_Scheduler scheduler)
 This function extracts the internal structure of a scheduler.
 
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.
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_attach (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const SVM_Size argc, const SVM_Parameter argv[])
 This function attaches a process to a scheduler with an integer value parameter.
 
SVM_FUNCTION SVM_Boolean svm_scheduler_process_detach (const void *svm, const SVM_Scheduler scheduler, const SVM_Process process, const SVM_Size argc, const SVM_Parameter argv[])
 This function detaches a process from a scheduler with an integer value parameter.
 
SVM_FUNCTION SVM_Boolean svm_scheduler_notify (const void *svm, const SVM_Scheduler scheduler, const SVM_Size argc, const SVM_Parameter argv[])
 This function sends a notification to a scheduler with an integer value parameter.
 

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 SVM_Boolean svm_scheduler_notify ( const void *  svm,
const SVM_Scheduler  scheduler,
const SVM_Size  argc,
const SVM_Parameter  argv[] 
)

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]argcThe number of parameters.
[in]argvThe parameters.

The parameters are sent verbatim to the scheduler attach plugin callback. The argv parameter can be a NULL pointer if the sequencer callback accepts it.

Warning
If the argv is not a NULL pointer and its size is smaller than argc, it will result in an undefined behavior.
Returns
TRUE if the notification has been successfully processed, FALSE otherwise.
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_Size  argc,
const SVM_Parameter  argv[] 
)

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 parameters are sent verbatim to the scheduler attach plugin callback. The argv parameter can be a NULL pointer if the sequencer callback accepts it.

Warning
If the argv is not a NULL pointer and its size is smaller than argc, it will result in an undefined behavior.
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_Size  argc,
const SVM_Parameter  argv[] 
)

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]argcThe number of parameters.
[in]argvThe parameters.

The parameters are sent verbatim to the scheduler detach plugin callback. The argv parameter can be a NULL pointer if the sequencer callback accepts it.

Warning
If the argv is not a NULL pointer and its size is smaller than argc, it will result in an undefined behavior.
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