An operating system capable of executing various programs.
It optimizes CPU usage through its multiprocessing features
and offers a user interface with commands for program execution.
Kernel creates a separate 4GB virtual memory space for each process.
This virtual space is connected to RAM or Disk
using Paging Address Translation.
Both virtual memory and physical memory are divided into Pages of size 4KB.
This allows processes to seamlessly use memory beyond the physical RAM constraints
while also providing memory protection and sharing capabilities.
Virtual Memory layout
Kernel Memory starts from a constant point, KERNEL_BASE, and extends up to the base plus 265MB in Virtual Memory
and is mapped in RAM from 0 to 256MB.
kernel Memory allocates executable files (.exe) of programs that need to run,
along with page tables and directory tables, among other things. It includes it own heap and stack.
Memory in the kernel heap can be allocated (show code) using first fit (show code) and best fit (show code) strategies,
and it also supports memory freeing (show code) and reallocation (show code).
User Memory from 0 and extends up to KERNEL_BASE in Virtual Memory.
The User Memory allocates Program Code and Data,
It includes it own heap and stack.
Memory in the User heap can be allocated (show code) and it also supports memory freeing (show code).
When a process needs to run, kernel creates a structure called 'Env' for it.
This structure contains metadata about the process such as its id, status, and current working set (see more).
kernel handles this allocation and creates a 'working set' structure for each frame it allocates.
We utilize both LRU (show code) and FIFO (show code) strategies to manage the working set of a process.
-
Solve competition in Memory by virtual memory (RAM + DISK):
FOS can run programs with size greater than RAM.
the system can select a victims from environments and add em to DISK if RAM becomes full. -
Solve competition in CPU through multiprocessing:
This allows FOS to run multiple processes simultaneously.
The Round Robin (RR) (show code) and Berkeley Software Distribution (BSD) (show code) strategies are used to manage this.
FOS provides a command line interface (CLI) which allows users to load, execute and kill programs.
-
enable FIFO strategy
FOS> fifo
-
enable LRU strategy
FOS> lru 2
-
enable BSD strategy
// to enable BSD by 64 priorities and 5 quantum FOS> schedBSD 64 5
//run merge sort and quick sort by lru and BSD
FOS> lru 2
FOS> schedBSD 64 10
FOS> load qs 5000 100 // active list of size 5000 and second list of size 100
FOS> load ms1 100 20
FOS> runall
FOS> kill 2048 // call env_free to free up exit env
FOS> kill 2049
- BSD Scheduler
- Round-robin scheduling
- Paging_strategy
- Page Replacement Algorithms
- MMU Role in intel 80386
If you think that anything can be improved in any way, please do suggest :
Open pull request with improvements
Discuss ideas in issues.