process.h File Reference

#include <config/config_param.h>
#include <config/config_cparam.h>
#include <sys/queue.h>
#include <sys/ktypes.h>
#include <sys/stats.h>
#include <sys/kpthread.h>

Defines

#define PROC_NEW   0
 Process States.

Functions

void xmk_enter_kernel (void)
void xmk_leave_kernel (void)
void process_block (queuep queue, unsigned int state)
void process_unblock (queuep queue)
pid_t proc_create (unsigned int priority)
int process_invalidate (process_struct *proc)
int sys_process_status (pid_t pid, p_stat *ps)
pid_t sys_get_currentPID (void)

Detailed Description

Process management declarations and definitions

Function Documentation

pid_t proc_create unsigned int  priority  ) 
 

Process creation primitive.

  • Reserves a pid for the process.
  • Initializes the process structure (except for the context)
  • Places the process in the READY_Q.
    Parameters:
    priority is the priority of the process
    Returns:
  • PID of the new process.
  • -1 on Error. Max. process exceeded.
    Note:
  • None

void process_block queuep  queue,
unsigned int  state
 

Block the process.

  • Place the process into the specified wait queue, change the state of the process and set the kernel flag to PROCESS_BLOCK.
  • Call the process_scheduler
    Parameters:
    queue is the queue where the process is enqueued.
  • state is the state of the process in queue.
    Returns:
  • Nothing
    Note:
  • None

int process_invalidate process_struct proc  ) 
 

Remove the Process with pid. This is an internal proc that is called by sys_kill() and also by the schedulers to remove "DEAD" processes

Parameters:
proc is the process structure of process to invalidate
Returns:
  • 0 on Success
  • -1 on Error
Note:
  • None

void process_unblock queuep  queue  ) 
 

Unblock the first process in queue and place it onto the ready queue. Call the process_scheduler only if this is PRIO scheduling. This is because we do not want the current process to prematurely lose its time slice. Change the state of the process to PROC_READY

Parameters:
queue is the queue where the process is enqueued.
Returns:
  • Nothing
Note:
  • None

pid_t sys_get_currentPID void   ) 
 

Return the PID of the currently running process context

Returns:
  • PID of the currently running process context.
Note:
  • None

int sys_process_status pid_t  pid,
p_stat ps
 

Return the status of the process.

Parameters:
pid is the Process ID of the process.
  • ps is the structure where the status is returned.
Returns:
  • The status of the process is returned on ps
  • If pid not an active process, ps->pid is assigned -1
Note:
  • None

void xmk_enter_kernel void   )  [inline]
 

Lock kernel by turning off ALL system interrupts

Returns:
  • Nothing
Note:
  • Locks kernel against ALL interrupts.
  • Does not lock against critical interrupts.

void xmk_leave_kernel void   )  [inline]
 

Unlock kernel by turning on system timer interrupts

Returns:
  • Nothing
Note:
  • Unlocks kernel with respect to ALL interrupts except critical interrupts


Generated on Thu Feb 13 14:46:24 2014 for 2014.1_doc by  doxygen 1.4.5