Name
Memory Status -- Status of the memory.
Description
Here is descrived show to find out the status of memory,
the frames available, what process they belong to, valid and invalid pages...
Details
struct frame_info_t
typedef struct { /* what there is to know about a frame */
gint frame; /* frame number */
gint proc; /* process it belongs to or NO_PROC */
gint page; /* page it belongs to of NO_PAGE */
guint32 flags; /* See mem_frame_flags_t */
guint32 private_flags; /* algorithm dependet flags */
}frame_info_t; |
enum mem_frame_flags_t
typedef enum { /* bit indexes for frame flags */
MEM_FRAME_LOCKED=0, /* frame is locked and should not be
stolen of assigned */
MEM_FRAME_REFERENCED, /* frame has been referenced recently */
MEM_FRAME_MODIFIED /* frame is modified and should be writen to
swap if stolen */
} mem_frame_flags_t; |
FRAME_LOCKED()
#define FRAME_LOCKED(frame) (test_bit(MEM_FRAME_LOCKED, &frame->flags)) |
Test whether frame is locked.
FRAME_REFERENCED()
#define FRAME_REFERENCED(frame) (test_bit(MEM_FRAME_REFERENCED, &frame->flags)) |
Test whether frame has been referenced.
FRAME_MODIFIED()
#define FRAME_MODIFIED(frame) (test_bit(MEM_FRAME_MODIFIED, &frame->flags)) |
Test whether frame has been modified.
struct proc_pages_info_t
typedef struct { /* memory related information for a
process */
gint pid; /* process id of the process */
gint n_pages; /* number of pages its using */
guint32 bitmap; /* bitmap of valid pages */
frame_info_t *frame[MAX_PAGES]; /* frames where the pages are stored*/
gint block[MAX_PAGES]; /* swap blocks assigned to pages */
GSList *node; /* GSList link this struct is hanging
from */
} proc_pages_info_t; |
PAGE_VALID()
#define PAGE_VALID(proc_pages, page) (proc_pages->bitmap & (1<<page)) |
Test whether page is valid in proc_pages.
NO_FRAME
#define NO_FRAME -1 /* frame number when there is no frame */ |
NO_PAGE
#define NO_PAGE -1 /* page number when there is no page */ |
NO_PROC
#define NO_PROC -1 /* process number when there is no process */ |
NO_BLOCK
#define NO_BLOCK -1 /* block number when there is no block */ |
init_page_info ()
void init_page_info (void); |
Initialize the code which keeps track of pages and frames.
put_free_frame ()
void put_free_frame (gint frame); |
Give back a frame to be returned by get_free_frame later.
have_free_frame ()
gboolean have_free_frame (void); |
get_proc_pages ()
Retrives the memory related information for pid.
If there is no memory information for pid and creat is TRUE the
information will be created.
virt_to_phys ()
gint virt_to_phys (gint pid,
gint page); |
mem_page_invalid ()
void mem_page_invalid (gint pid,
gint page); |
Makes page of pid's address space invalid so pid will incure a page
fault if it tryes to use it.
mem_assign_frame ()
gint mem_assign_frame (gint pid,
gint page,
gint frame); |
Assings frame to page in pid's address space.
mem_page_valid ()
void mem_page_valid (gint pid,
gint page); |
Makes page of pid's address space valid for pid to use.