-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpageswap.h
More file actions
36 lines (29 loc) · 829 Bytes
/
Copy pathpageswap.h
File metadata and controls
36 lines (29 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _PAGESWAP_H_
#define _PAGESWAP_H_
#include "types.h"
#include "mmu.h"
// Swap slot management
#define NSWAPSLOTS 800
#define BLOCKS_PER_PAGE 8
struct swap_slot {
int page_perm;
int is_free;
};
extern struct swap_slot swap_slots[NSWAPSLOTS];
// Adaptive parameters
#define LIMIT 100
extern int Th; // Current threshold
extern int Npg; // Pages to swap
extern int alpha; // α parameter
extern int beta; // β parameter
// // Function prototypes
// void swap_init(void);
// int swap_alloc(int perm);
// void swap_free(int slot_index);
// void swap_write(int slot_index, void *page);
// void swap_read(int slot_index, void *page);
// void swap_out(void);
// void handle_pgfault(pde_t *pgdir, uint va,uint n);
// void invlpg(uint va);
// void adaptive_swap(void);
#endif // _PAGESWAP_H_