2009/04/30

OS Exercise - Memory Allocation

Screenshot as below. It can do First/Best/Worst Fit...


Please choose your allocation algorithm:
1. First Fit
2. Best Fit
3. Worst Fit
Your choose is (1/2/3, other input means EXIT): 2

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):2

INPUT MEMORY USAGE
Input Process #, Request Memory Size: 100, 1000

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):1

MEMORY....
Start  End   Size Process#
---------------------------
0400 - 2559 (2160)  free

QUEUE....
Start  End   Size Process#
---------------------------
0000 - 0999 (1000)  100


MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):3
Fit : 2

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):1

MEMORY....
Start  End   Size Process#
---------------------------
0400 - 1399 (1000)  100
1400 - 2559 (1160)  free

QUEUE....
Start  End   Size Process#
---------------------------

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):5
Terminated by user.

Source Codes per request

沒有留言: