-
Notifications
You must be signed in to change notification settings - Fork 0
/
ram.py
137 lines (72 loc) · 2.03 KB
/
ram.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# RAM contains information read from Settings Block group, MBG, FBG, MBRBG and IBG
import math
# Address space read from hard disk once
# Master Block Group
global master_block
global mbr
"""
MAKE IT TO VARY TO HANDLE ISSUR IN UNIX FILE SYSTEM REGARDING MEMORY USAGE
"""
out_scope_block = float('inf')
"""
STAYS CONSTANT IN SPECIFIC FILE SYSTEM
"""
# Size/threshold/limit settings read from hard disk once
global directory_dictory_limit_per_block
directory_dictory_limit_per_block = 2
# Threshold defines how many direcotry dictionary can be in one block of dbg
threshold = directory_dictory_limit_per_block
global block_size
block_size = 4096
global int_size
int_size = 342
settings = {"threshold":threshold, "block_size":block_size, "int_size":int_size}
# Below commented might potentially be useless
# global disk_size
# disk_size = 50;
# global inode_entries
# inode_entries = 0
global ints_per_block
ints_per_block = math.floor(block_size / int_size)
# Inode ranges for each disc
global inode4disks
inode4disks = {};
"""
Updated frequently by file system
"""
# CRITICAL
# Free blocks heap read from hard disk once
global free_blocks
free_blocks = []
# Inode info read from hard disk once
global current_inode
current_inode = 0;
# CRITICAL
# Inode Table
inode_table = []
# Parent Directory Inode
# parent = "root"
# parents_stack = []
# Open file table, for only non threaded operations
oft = {}
# Threads
threads_queue = {}
# thread queue flag
# semaphore = 0
# opened file - finode : [semaphore, method/object]
ofp_count = {}
# threads names
threads_names = {"cmakeFile":0,"cOpen":0, "trwt":0}
# threads output buffer
threads_output = []
# WORKING
# Add threads_output in userspace
# User space
# Will contain current_inode and parents stack.
user_space = {}
# changes happendes since last update
changes = 0
# changes_threshold
changes_threashold = 1
# current filesystem name
current_fileSystem = ""