📄 1.html
字号:
#endif<br>
4、文件kernel/kernel_struct.h<br>
#ifndef OS_KERNEL_STRUCT<br>
#define OS_KERNEL_STRUCT<p>
struct semaphore{<br>
int value;<br>
int process;<br>
int thread_id,thread_ring;<br>
int front,back;<br>
struct capability capability;<p>
int heap,v_value;<br>
struct kernel_time first,step;<br>
};<p>
struct thread ;<br>
struct return_stack ;<p>
struct thread_environment{<br>
int system_call,system_call_arg1; /*ax,bx*/<br>
int system_call_arg2,system_call_arg3; /*cx,dx*/<br>
int system_call_arg4,system_call_arg5; /*si,di*/<br>
int system_call_arg6,system_call_arg7; /*bp,r7*/<br>
run_point point; /*ip,cs,flag,sp,ss */<br>
};<p>
struct exception_item{<br>
int flag;<br>
};<p>
struct return_stack{<br>
struct thread_environment environment;<br>
int current_process,process_id,process_p_flag;<br>
struct exception_item exception;<br>
struct thread_physical_block physical_block;<br>
};<p>
struct thread{<br>
enum {SLEEP,RUN,READY} state;<br>
int priority;<br>
int set_v_operation_result_flag;<br>
int heap,process,pro_front,pro_back;<br>
int semaphore,sleep_semaphore,sem_front,sem_back;<br>
int cpu_id;<br>
struct return_stack return_stack[RETURN_BLOCK_NUMBER];<br>
int return_stack_top;<br>
struct user_file_information file[USER_FILE_NUMBER];<br>
};<p>
struct thread_heap{<br>
int thread;<br>
};<p>
#endif<br>
5、文件kernel/os_struct.h<p>
#ifndef OS_OS_STRUCT<br>
#define OS_OS_STRUCT<p>
struct cpu_information{<br>
int thread_id;<br>
struct{<br>
int thread_id,process_id;<br>
struct thread_physical_block physical_block;<br>
}last;<br>
};<p>
struct os_data{<br>
struct{<br>
struct cpu_information used_cpu[VIRTUAL_CPU_NUMBER];<br>
struct{<br>
int cpu_id;<br>
}free_cpu[VIRTUAL_CPU_NUMBER];<br>
int free_cpu_top;<br>
}virtual_cpu;<p>
struct process process[PROCESS_NUMBER];<p>
struct thread thread[THREAD_NUMBER];<br>
struct{<br>
struct thread_heap run_heap[VIRTUAL_CPU_NUMBER];<br>
struct thread_heap ready_heap[THREAD_NUMBER];<br>
int run_thread_number,ready_thread_number;<br>
}thread_heap;<br>
struct semaphore semaphore[SEMAPHORE_NUMBER];<br>
struct{<br>
int semaphore_id;<br>
}semaphore_heap[SEMAPHORE_NUMBER];<br>
struct kernel_time current_time;<br>
struct system_file_information system_file[MEMORY_BODY_NUMBER];<br>
struct capability system_capability;<br>
};<p>
struct current_information {<br>
struct thread_environment *env;<br>
struct return_stack *rt;<br>
struct thread *t;<br>
struct cpu_information *cpu_info;<br>
union system_call_parameter *par;<br>
int thread_id,cpu_id,return_stack_top;<br>
};<br>
extern struct current_information current;<p>
#endif<p>
<p>
<br>
<center><A HREF="#Content">[目录]</A></center>
<hr><br><A NAME="I506" ID="I506"></A><center><b><font size=+2>内存管理器</font></b></center><br>
1、文件memory/memory_struct.h<p>
#ifndef OS_MEMORY_STRUCT<br>
#define OS_MEMORY_STRUCT<p>
struct file_window{<br>
enum{<br>
FILE_OPEN,<br>
FILE_CLOSE<br>
} state;<br>
struct file file;<br>
int block_ring;<br>
int file_front,file_back;<br>
int lock_number;<br>
};<br>
struct memory_sleep_semaphore{<br>
int processor,semaphore;<br>
};<br>
struct physical_block{<br>
enum{<br>
FREE_BLOCK,<br>
READING_BLOCK,<br>
NOT_MODIFIED_BLOCK,<br>
MODIFIED_BLOCK,<br>
WRITING_BLOCK<br>
}state;<p>
int lock_number;<br>
int file_window,logic_block_number;<br>
int physical_number;<br>
int file_front,file_back;<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -