Blogger Tricks

13 May 2012

Basic Memory Management in Operating Systems

Memory management systems can be divided into two classes:
1.    Those that move processes back and forth between main memory and disk during execution (swapping and paging) and
2.    Those that do not move processes back and forth between main memory and disk memory management scheme of Class 2 is discussed below.

1. Mono-programming Without Swapping or paging


To run just one program at a time, sharing memory between that program and OS is the simplest memory management scheme. Three variations on this scheme: Fig 1.1 


1.1(a): OS at bottom in ram
1.1(b): OS in ROM at top of memory
1.1(c): Device driver at top in ROM and rest of OS at bottom in RAM

Model (c) is used by small MS-DOS systems. On IBM PCs, the portion of OS in ROM is called BIOS (BASIC INPUT OUTPUT SYSTEM). I.e. model (b)

In this scheme, only one process at a time can be running. As soon as user types a command, OS copies requested program from disk to memory and execute it.

When the process finishes, OS displays a prompt character and waits for a new command when it receives the command, it loads a new program into memory and overwrites the one.

2. Multi-programming With Fixed Partitions

Mono-programming is sometimes used on small computers with simple OS. ButIt is desirable to allow multiple processes to run at once.
On timesharing system having multiple processes in memory at once that, when one process is waiting for I/O to finish, another one can use the CPU.

Thus multiprogramming increased the CPU utilization. On personal computers it is useful to run 2 or more programs at once.




Easiest way to achieved multiprogramming is to decide memory into n (possibly unequal) partitions.

When a job arrives, it can be put into input queue for the smallest partitions which is large enough to hold it.

Partitions are fixed the scheme so any space in partitions which is not used by a process is lost.