Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Functions
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_Value_Integer parameter)
| This function attaches a process to a scheduler with an integer value parameter.
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.
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.
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.
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.
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.

## 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | name | The scheduler name.

Note
  If parameter name is NULL, the default scheduler is returned.

Returns
  The scheduler.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.

Returns
  The current scheduler, or a NULL pointer when outside a scheduler context.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The 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

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The scheduler to notify.
  [in] | parameter | A parameter.

Note
  If the scheduler does not support notifications, the notification is silently discarded.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The scheduler to notify.
  [in] | parameter | A parameter.

Note
  If the scheduler does not support notifications, the notification is silently discarded.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The scheduler from which the status will be extracted.

Returns
  A SVM_String containing a representation of the scheduler state.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The receiving scheduler.
  [in] | process | The process to be attached.
  [in] | parameter | A 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The receiving scheduler.
  [in] | process | The process to be attached.
  [in] | parameter | A 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The giving scheduler.
  [in] | process | The process to be detached.
  [in] | parameter | A 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | scheduler | The giving scheduler.
  [in] | process | The process to be detached.
  [in] | parameter | A 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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