Processor Status

Name

Processor Status -- Status of the processor.

Synopsis


struct      proc_queues_t;
const proc_queues_t* get_CPU_queues         (void);
proc_t*     get_CPU_current_proc            (void);
proc_queue_t get_CPU_queue                  (gint nqueue);
proc_queue_t get_CPU_wait_queue             (void);
gint        request_nqueues                 (gint nqueues);
void        move_proc_to_queue              (proc_t *proc,
                                             gint new_queue);
void        move_proc_to_CPU                (proc_t *proc);
gint        suspend_proc                    (proc_t *proc);
gint        wakeup_proc                     (proc_t *proc);

Description

Here is descrived show to find out the status of the processor, the currently running process and all the ready queues.

There are also functions to move processes around and change the number of ready queues.

Details

struct proc_queues_t

typedef struct {		/* Processor status */
	gint nqueues;		/* Number of queues */
	proc_t *current;	/* Currently running process */
	proc_queue_t *queue;	/* Ready process queues */
	proc_queue_t wait;	/* Blocked processes */
} proc_queues_t;


get_CPU_queues ()

const proc_queues_t* get_CPU_queues         (void);

Retrive the processor's status.

Returns : a pointer to the proc_queues_t structure.


get_CPU_current_proc ()

proc_t*     get_CPU_current_proc            (void);

Returns : The currently running process, which may be NULL if the processor is idle.


get_CPU_queue ()

proc_queue_t get_CPU_queue                  (gint nqueue);

nqueue : requested queue.
Returns : ready queue number nqueue.


get_CPU_wait_queue ()

proc_queue_t get_CPU_wait_queue             (void);

Returns : the blocked process queue.


request_nqueues ()

gint        request_nqueues                 (gint nqueues);

Sets the number of queues for handling ready processes.

NOTE: when shrinking the lower queues, those which will be deleted, must be empty or otherwise they will be concatenated to the first queue.

nqueues : requested number of queues.
Returns : nothing important.


move_proc_to_queue ()

void        move_proc_to_queue              (proc_t *proc,
                                             gint new_queue);

Move proc to queue number new_queue.

NOTE: The proc should not be blocked.

proc : process to be moved.
new_queue : target queue for proc.


move_proc_to_CPU ()

void        move_proc_to_CPU                (proc_t *proc);

Starts running process proc.

NOTE: the processor should be idle.

proc : process to run.


suspend_proc ()

gint        suspend_proc                    (proc_t *proc);

Move proc out of the way when it blocks.

proc : process involved.
Returns : nothing important.


wakeup_proc ()

gint        wakeup_proc                     (proc_t *proc);

Move a process back when it becomes ready again letting the current algorithm decide were to put it.

proc : process involved.
Returns : nothing important.

See Also

Process Queues

How to inspect process queues.