We need a memory management visualization which supports different block-finding algorithms (first fit, best fit, worst fit, maybe others). It should have a panel where explanatory text comes up for each action (see our other applets for examples of this). The main part of the UI should be a panel with a big colored block, representing memory (all initially free), and a single small text input box with a button underneath it marked "add". Underneath this panel is another panel with a dropdown box where the user can select the block-finding algorithm and a reset button. Initially only the dropdown box is active (can be clicked).
The user chooses a block-finding algorithm and then the rest of the UI is enabled while the dropdown becomes disabled. The user should then type an amount of memory in blocks (limited to range 1 to size of memory -- probably 100 blocks) and click "add". The visualization will then run the block- finding algorithm, select a block, and color it appropriately. The "add" button should become a "next" button, and each click should perform one logical step in the algorithm.
When the algorithm is done, an arrow should lead from the text input box to the appropriate block. The button should change to say "del" and the text box should be non-editable. A new text box with "add" button should appear to the right of the current one, allowing the user to request another block.
When any block's "del" button is clicked, that memory should be colored as free memory, the associated text box and "del" button should disappear, and any textbox/del buttons to the right should shift left to occupy the newly-blank space. This again occurs step by step, showing each stage of the algorithm.
The following UI sketches might help.
+------------------------------------------------------------------------------+
| |
| +------------------------------------------------+ +----------------------+ |
| | | | /\ |
| | +------------------------------------------+ | | (Explanation text ## |
| | | | | | comes up in this ## |
| | | | | | panel in colors, || |
| | | | | | along with other || |
| | | | | | questions the sys- || |
| | +------------------------------------------+ | | tem wants to ask) || |
| | | | || |
| | [__] | | || |
| | {add} | | || |
| | | | || |
| +------------------------------------------------+ | || |
| __ | || |
| Algorithm: [ First Fit \/] | || |
| | \/ |
| {Reset} +----------------------+ |
| |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| |
| +------------------------------------------------+ +----------------------+ |
| | | | /\ |
| | +------------------------------------------+ | | Finding 25 free... ## |
| | | | | | | Found 25 free at ## |
| | | | | | | position 0. || |
| | | /\ | | | | || |
| | | || | | | | || |
| | +--||--------------------------------------+ | | || |
| | || | | || |
| | [25] [__] | | || |
| | {del} {add} | | || |
| | | | || |
| +------------------------------------------------+ | || |
| __ | || |
| Algorithm: [ First Fit \/] | || |
| | \/ |
| {Reset} +----------------------+ |
| |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| |
| +------------------------------------------------+ +----------------------+ |
| | | | /\ |
| | +------------------------------------------+ | | Finding 25 free... ## |
| | | | | | | | | Found 25 free at ## |
| | | | | | | | | position 0. || |
| | | /\ | /\ | /\ | | | | || |
| | | || | || | || | | | | Finding 32 free... || |
| | +--||------//----//------------------------+ | | Found 32 free at || |
| | || // // | | position 25. || |
| | [25] [32] [18] [__] | | || |
| | {del} {del} {del} {add} | | Finding 18 free... || |
| | | | Found 18 free at || |
| +------------------------------------------------+ | position 57. || |
| __ | || |
| Algorithm: [ First Fit \/] | || |
| | \/ |
| {Reset} +----------------------+ |
| |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| |
| +------------------------------------------------+ +----------------------+ |
| | | | /\ |
| | +------------------------------------------+ | | Finding 25 free... ## |
| | | | | | | | | Found 25 free at ## |
| | | | | | | | | position 0. || |
| | | /\ | | /\ | | | | || |
| | | || | | || | | | | Finding 32 free... || |
| | +--||---------===//------------------------+ | | Found 32 free at || |
| | || ==// | | position 25. || |
| | [25] [18] [__] | | || |
| | {del} {del} {add} | | Finding 18 free... || |
| | | | Found 18 free at || |
| +------------------------------------------------+ | position 57. || |
| __ | || |
| Algorithm: [ First Fit \/] | Freeing 32... || |
| | \/ |
| {Reset} +----------------------+ |
| |
+------------------------------------------------------------------------------+
LEGEND:
{text} button
[__] text input field
__
[ text \/] dropdown box