CS 340 Programming Assignment 3 solved




Amend your operating system to do contiguous memory allocation.
As usual, there are two phases of operation for the program, SysGen and Running.
During the SysGen, in addition to all the other information requested, (that is number of
printers, CD-RWs and disk units, the history parameter α, etc., the installer (me) should
be prompted to specify the total size of memory. All memory sizes are in number of words
hence you needn’t worry if we are using an 8 bit word or a 64 bit word.
While “running” the Long Term Scheduler (me) signals the arrival of a process by typing
an “A” on the keyboard. As before, the program should assign a process id. The OS should
prompt the LTS (me) for the size of the process (in words). If the process is larger than
the total memory in the system, the OS should reject the process with an appropriate error
message. If there is enough total memory, but not enough free memory, the OS should hold
the process in a job pool. Processes should be dispatched from this pool on a “largest that
will fit” basis. If or when there is enough usable memory for the process the OS should
assign it that memory and load the process.
All the previous commands should do what they’ve done in the last two HWs.
When a “t” signals completion of a job, in addition to sending all the “right” information
to the accounting module, the OS should free up the memory used by that job.
If there are processes in the job pool that will fit into memory they should be loaded
as described above. If there are no processes in the job pool that can fit into an existing
hole, but there is a process that would fit if the holes were contiguous, then (and only
then) memory should compactified (compacted) and that job loaded. There should never be
processes in the job pool if there is sufficient memory to run them.
An “S” should display all the information in earlier programs as well as the base and
limit values for each process it displays. Remember not to let things scroll off the screen! A
new “S” option, “m” should display system memory information, i.e. a list of base and limit
values for every process and every hole.
When a device request is made, the “starting location in memory” should be read in as
an integer representing the logical address. The corresponding physical address should be
displayed. Invalid references should be trapped.
Email source code and whatever instructions I might need to compile your code. You
know what I need and how to package it by now.