The basic task of a system that deals the memory is the management of the position in the memory of a RAM and other memory devices. It is one of the crucial component of an OS. Mutual support and letting a number of operating processes to be allowed in the treatment of the main memory is involved in managing the memory. There is always this interest to have more memory than the physical memory. It allows these stuff to be finish through the help of a virtual memory concept where the virtual memory can be many times larger as than the physical memory. A requirement is needed to be satisfied when managing a memory and these requirements will help efficiently manage the memory and these are relocation, protection, sharing, logical organization and physical organization. A relocation is needed when there is a program that is running and it does not know the location where it will be loaded because a program cannot simply create a static address.
Instead, it must be made relative to where the program has been loaded. A relocation table is created where it contains the list of directions that were created and it is gathered in the executable file. For a 32-bit windows OS, it is not required for it to give relocation tables for the EXE files, since these files are the first image that is loaded into the virtual address space. They will be loaded at a common address that they select. In a 64-bit windows OS, randomization of the space layout address is required where it is an approach that lets the computer be secured which is involved in the avoidance of memory corruption.
Hence, relocation sections cannot be excluded by the compiler. These modern systems use dynamic relocation where addresses are obtained at execution time. It uses the references in the memory that is in the running process which are not involve in the referencing of the area in the physical memory. For a Unix OS, the shared library and executable format allows several group of relocation to be determined. The system focuses on controlling the needed pages in a memory and it gives a reminder that a page has been referred. A process is swapped out if all its required pages cannot be maintained in the memory and if conditions that happened in the system is related to thrashing. There is a need for a process to be protected from any unwanted interference that is caused by other process. Thus, the processes in the programs should not be able to reference the memory locations in a process for writing or reading purposes without permission.
Memory protection is provided in windows by using the virtual memory hardware. It is also secured because there is a placement of different memory objects in different memory pages and an application control of access permission is given to the objects of the memory. Accessing of pages in the space of the system can only be done in kernel mode; accessing of the appropriate data using the user-mode processes can only be done in user-mode. A feature which is a copy-on-write in sharing the pages is used and it is an optimization that allows multiple processes to map their virtual address spaces. The physical page is then shared until the page has been modified by one of the processes. This is implemented by setting the protection field of a page to read only. A protection exception is raised when a process is trying to modify the page and the virtual memory manager makes a private copy of the page for use by the process. In addition, virtual pages are also protected and object-based memory protection is provided.
For a Unix operating system, a child process inherits from its parent which have different type of ID’s. It contains the information to have a permission for the page and is dependent to the hardware. A copy-on-write feature is also used where the semantics of fork requires the child process to obtain a copy of the parent’s address space. It can be implemented by a distinct memory area allocation and a swap space for the child process. When a process is forked, the reference count of all the data pages is incremented by one in the parent’s address space and all data pages are made to be read-only in the access privileges field by the bits that are manipulated.
A protection fault is raised if there is any attempt at modifying a data page. There are numerous programs that are accessed simultaneously with an intent for a communication to be provided among them or to have the copies that are redundant to be avoided. The files that are shared is supported between different processes. The kernel uses data structures to determine the effect of the process to another with the view to file sharing. Each process consists of an entry in a process table where its entry is a descriptors of an open file. In addition, there is a maintenance of a file table in the kernel for all the open files. Each of the open file consist of a structure of v-node. Unix can perform preemptive multi-tasking which can run several programs at the same amount of time.
And it is a multi-user system which allows the sharing of the computer system to many users at the same amount of time. Any number of applications can be run simultaneously in a Unix system where the resources are shared among all. Unix supports a shared memory where one process can ask for an area to be shared to other processes by using a key that creates a server.
The shared memory in windows operating system is provided when the memory backed is used by the paging file and it is destroyed automatically when the shared memory that is attached to the last process is destroyed. There are different characteristics in modules that are written in programs and the processes consist of the composition of modules or different sizes. There is a possibility that the mechanisms are introduced by which the modules among the process can be shared. Unix file system can be organized and stored in a large number of information that makes the management to be easy.
There is an organization of all the data in Unix into the files and an organization of all the files into the directories. And these directories can be organized as a structure that looks like a tree. The organization of the files in a Unix system are like a directory tree.
The logical address space of a Unix operating system is where the process differentiates the page table among three different kinds of pages which is swapped-out pages, a resident page which is currently residing in the memory, and the unaccessed page in which the access to the page has not been performed even if during the process is operating and loading in the memory has not been done. In order for a disk space to be conserved, there is an effort to be made in order for an allocation just as a swap space to happen. An allocation of a sufficient swap space is needed for the user stack and the area of data to be accommodated.
In Unix, the page table is efficiently used and there is a paging in the hardware. The virtual memory manager of Unix maintains a list which is a frames of free pages and it tries to keeps a percentage of at least 5 of the total frames of pages on that list every time. This creates the pageout daemon that activates when the frames of a free page are falling below five percent. Adding of pages has been done to a free list and goes to sleep when more than five percent frames of free page is contained. In optimizing traffic in a page, dirty pages are written by the virtual memory manager to a clusters of swap space.
This optimization saves an operation of page-in and delays which are constant to the process of page-faulting. It is required that each process in the Unix operating system to be able to execute an amount of memory. Handing out and allocation of memory is done by the kernel for each of the process. The corruption of program of the other users is prohibited and also the users are prohibited in corrupting the operating system. Unix has a file system which helps in the hierarchy that helps the data to be organized in a way that it is in order, security for the multi-user file system to be protected and helps the user to write, read, execute the privileges of a user and completeness in the system. The virtual memory of Unix grants the user a full utilization of the installed physical memory in the system as well as the hard disk parts which is called swap space. It divides its memory into frames that are fixed in size or pages.
The size of the page is 4 kilobytes. For a windows that is operating in different architectures, 32-bit and 64-bit logical addresses is supported and it has a 4 KB page size. It consists of either two gigabyte or three gigabyte of address space in a process. The remaining space of the logical address is given for the operating system to utilize. This part of the address space of every process is mapped by the kernel. Windows is using different level of page tables and formats of the page table entry.
The process’ page table is stored in the space of the logical address space which is a reserved part of the process. For a 32-bit windows, each of the process owns a space in the virtual address to let the addressing of the memory to be up to four gigabytes. And for a 64-bit windows, each of the process also owns a space in the virtual address that is eight terabytes. The virtual address space can be accessed by all of the threads of each process. The threads are prohibited in accessing the memory of another process, which helps in preventing a process to be corrupted.
Windows is also using an algorithm which is the “First in, First out algorithm” in page replacement. In addition to the other features that the two operating system has, the memory management of Unix has two schemes which is the paging system and the kernel memory allocator. The policies in managing the memory are swapping which gives an easy implementation and demand paging which gives great flexibility to the system. The algorithm for the page replacement in Unix operating system is a clock algorithm which has two pointers that are maintained. Buffers of memory in the kernel memory allocator are provided to different subsystems of a kernel. Unix displays a steady-state behavior when there is a need for a kernel memory and a lazy buddy system which constantly breaks the buffers or coalesces them in order to adjust the shifting demands. And the advantages of Unix operating system is that the implementation is easy, it utilizes the space, memory allocation is not restricted, any part of the region can be released and reusing of memory is allowed. For the windows, the allocation of memory and performance of paging is controlled by the virtual memory manager.
A cluster of demand paging is used in windows and it utilizes two levels of paging. Virtual pages in windows are divided into lists which can be classified as free, modified, standby, zero, read-only memory and bad. Windows also uses a scheme in which it manages the resident set.