Skip to content

Commit 496b0f9

Browse files
committed
🔨 refactor: structure of the files
1 parent 2d17e01 commit 496b0f9

6 files changed

+43
-456
lines changed

FCFS.java

-75
This file was deleted.

PageReplacementFIFO.java

-80
This file was deleted.

PageReplacementLRU.java

-108
This file was deleted.

README.md

+43-36
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,72 @@
44

55
### Table of contents
66

7-
- [Introduction](#introduction)
8-
- [Demonstration](#demonstration)
9-
- [Algorithms](#algorithms)
10-
- [Local Setup](#local-setup)
11-
- [Author](#author)
12-
- [License](#license-)
7+
- [Introduction](#introduction)
8+
- [Demonstration](#demonstration)
9+
- [Algorithms](#algorithms)
10+
- [Local Setup](#local-setup)
11+
- [Author](#author)
12+
- [License](#license-)
1313

14-
## *Introduction*
14+
## _Introduction_
1515

1616
A simple Memory Allocation Simulatory built with JAVA, for a better understanding of how memory allocation works in an **Operating System**. It simulates common **memory allocation strategies**:
1717

18-
- **First-Fit**
19-
- **Best-Fit**
20-
- **Worst-Fit**
18+
- **First-Fit**
19+
- **Best-Fit**
20+
- **Worst-Fit**
21+
22+
This repository also contains the code for
23+
24+
- Scheduling Algorithms
25+
- Page Replacement Algorithms
26+
- Paging Simulator
27+
- Disk Scheduling Policies
2128

2229
## Demonstration
2330

24-
- Welcome to the Memory Allocation Simulator.
25-
- First, we ask whether the user wants to enter a values or not, if not, then a few values are already hardcoded.
26-
- The hardcoded values are important for understanding, debugging and saving time.
31+
- Welcome to the Memory Allocation Simulator.
32+
- First, we ask whether the user wants to enter a values or not, if not, then a few values are already hardcoded.
33+
- The hardcoded values are important for understanding, debugging and saving time.
2734

2835
![](image/README/1615909517978.png)
2936

30-
- After taking the input value of the Memory Divisions, their current status (Free/Not Free) and the process numbers, we print the current table of the Memory Allocation.
37+
- After taking the input value of the Memory Divisions, their current status (Free/Not Free) and the process numbers, we print the current table of the Memory Allocation.
3138

3239
![](image/README/1615565277496.png)
3340

34-
- So now, we take the size of the input process, and a menu comes up.
41+
- So now, we take the size of the input process, and a menu comes up.
3542

3643
![](image/README/1615576690655.png)
3744

38-
- Output for the First Fit
45+
- Output for the First Fit
3946

4047
![](image/README/1615576752475.png)
4148

42-
- Output for the Best Fit
49+
- Output for the Best Fit
4350

4451
![](image/README/1615576776052.png)
4552

46-
- Output for the Worst Fit
53+
- Output for the Worst Fit
4754

4855
![](image/README/1615576798291.png)
4956

5057
## Algorithms
5158

5259
A simple Memory Allocation Simulatory built with JAVA, for a better understanding of how memory allocation works in an **Operating System**. It simulates common **memory allocation strategies**:
5360

54-
- **First-Fit**
55-
- In the first fit approach is to allocate the first free partition or hole large enough which can accommodate the process.
56-
- *Advantage*: It finishes after finding the first suitable free partition. **Fastest algorithm because it searches as little as possible.**
57-
- *Disadvantage*: **Internal Fragmentation** - The remaining unused memory areas left after allocation become waste if it is too smaller. Thus, request for larger memory requirement cannot be accomplished.
58-
- **Best-Fit**
59-
- The best fit deals with allocating the smallest free partition which meets the requirement of the requesting process. This algorithm first searches the entire list of free partitions and considers the smallest hole that is adequate.
60-
- *Advantage*: It then tries to find a hole which is close to actual process size needed. Memory utilization is much better than first fit as it searches the smallest free partition first available.
61-
- *Disadvantage*: It is slower and may even tend to fill up memory with tiny useless holes.
62-
- **Worst-Fit**
63-
- In worst fit approach is to locate largest available free portion so that the portion left will be big enough to be useful. It is the reverse of best fit.
64-
- *Advantage*: Reduces the rate of production of small gaps.
65-
- *Disadvantage*: If a process requiring larger memory arrives at a later stage then it cannot be accommodated as the largest hole is already split and occupied.
61+
- **First-Fit**
62+
- In the first fit approach is to allocate the first free partition or hole large enough which can accommodate the process.
63+
- _Advantage_: It finishes after finding the first suitable free partition. **Fastest algorithm because it searches as little as possible.**
64+
- _Disadvantage_: **Internal Fragmentation** - The remaining unused memory areas left after allocation become waste if it is too smaller. Thus, request for larger memory requirement cannot be accomplished.
65+
- **Best-Fit**
66+
- The best fit deals with allocating the smallest free partition which meets the requirement of the requesting process. This algorithm first searches the entire list of free partitions and considers the smallest hole that is adequate.
67+
- _Advantage_: It then tries to find a hole which is close to actual process size needed. Memory utilization is much better than first fit as it searches the smallest free partition first available.
68+
- _Disadvantage_: It is slower and may even tend to fill up memory with tiny useless holes.
69+
- **Worst-Fit**
70+
- In worst fit approach is to locate largest available free portion so that the portion left will be big enough to be useful. It is the reverse of best fit.
71+
- _Advantage_: Reduces the rate of production of small gaps.
72+
- _Disadvantage_: If a process requiring larger memory arrives at a later stage then it cannot be accommodated as the largest hole is already split and occupied.
6673

6774
---
6875

@@ -88,13 +95,13 @@ If input process is of size 200 KB, then:
8895

8996
![](image/README/1614854479103.png)
9097

91-
## *Local Setup*
98+
## _Local Setup_
9299

93-
* Download the latest version of Java - [Java SE - Downloads | Oracle](https://www.oracle.com/java/technologies/javase-downloads.html).
94-
* Clone the repository: `git clone https://github.com/tusharnankani/MemoryAllocationSimulator.git`
95-
* Open this directory in Command Promt or Shell.
96-
* Compile the file using the command: `javac MemoryAllocation.java`
97-
* Run the file using the command: `java MemoryAllocation`
100+
- Download the latest version of Java - [Java SE - Downloads | Oracle](https://www.oracle.com/java/technologies/javase-downloads.html).
101+
- Clone the repository: `git clone https://github.com/tusharnankani/MemoryAllocationSimulator.git`
102+
- Open this directory in Command Promt or Shell.
103+
- Compile the file using the command: `javac MemoryAllocation.java`
104+
- Run the file using the command: `java MemoryAllocation`
98105

99106
## Author
100107

0 commit comments

Comments
 (0)