ASL

Active Semaphore List methods.

Authors

Luca Donno, Antonio Lopez, Samuele Marro, Edoardo Merli

Version

0.2.0

Date

2021-02-13

Functions

int insertBlocked(int *semAdd, pcb_t *p)

Inserts a PCB at the tail of the process queue associated with the semaphore with the given physical address.

Remark

TRUE and FALSE are defined in umps3/umps/const.h.

Parameters
  • semAdd – Physical address of the process queue.

  • p – Pointer to the PCB to be inserted.

Returns

TRUE if a new semaphore descriptor is allocated, FALSE otherwise.

pcb_t *removeBlocked(int *semAdd)

Removes the head of the process queue associated with the semaphore identified by the given physical address.

Parameters

semAdd – Physical address of the process queue.

Returns

The head of the process queue if a descriptor with physical address semAdd. Returns NULL if the descriptor was not found.

pcb_t *outBlocked(pcb_t *p)

Removes and returns the PCB pointed by p from the process queue of the semaphore on which p is blocked.

Parameters

p – Pointer to the PCB to be removed.

Returns

A pointer to the removed PCB. Returns NULL if the PCB pointed by p is not in the process queue of its semaphore.

pcb_t *headBlocked(int *semAdd)

Returns a pointer to the head of the process queue associated with semaphore semAdd.

Parameters

semAdd – Semaphore identifier.

Returns

The head of the process list associated with the semaphore semAdd. Returns NULL if the list is empty.

void initASL()

Initializes the Active Semaphore List.

Remark

This function should be called before any other ASL-related function.