OS202 - johanessteven19 - Updated Weekly throughout the semester!
Memory.
Memory is one of the most critical parts on a computer system. Memory is defined as the external device used to store information related to the works of a computer. The memory itself is built from a large array of bytes that each will be associated to a certain address. Therefore, if the system would like to retrieve a certain information stored in the memory, the system will proceed to call the address associated to the memory and then retrive the contents of that array.
Source: OSC Chapter 9.
Memory management.
Because the memory is such an integral part of the computer, we want the memory to be used as efficiently as possible so that it may store more data and will therefore allow the computer to perform more operations. One way to do so is to allocate the memory space into several parts, each part specific to a different process. By using specialized registers such as the base and limit registers, the memory can be allocated as suitable to the system’s needs. The allocation can be defined in the registers, with the base registers denoting the smallest legal physical memory address, and the limit registers denoting the size of the range.
Source: OSC Chapter 9.
Address.
There are two different types of addresses associated with the memory. The first type is the Logical Address, which is generated by the CPU and will then be translated into a physical address, which is where the actual data is stored ‘as seen’ by the memory unit. The logical address is also called a virtual address, because it only appears as if the data is stored there in the ‘virtual world’.
Source: OSC Chapter 9.
Allocation of memory.
The memory space can be divided into several parts according to either a) first fit, b) best fit, or c) worst fit. These three ways each have their own advantages and could be strategically used to allow more memory space to be used efficiently. This is called dynamic allocation. For first fit, we allocate a request from a process into the first partition we encounter. For best fit, we allocate it into the smallest possible partition that can fulfill the request. This obviously will need the whole list to be searched first to find a suitable one. The worst fit is the exact opposite, in which the largest partition possible is used. Generally speaking, the first fit and best fit method will perform better in terms of speed and storage usage.
Source: OSC Chapter 14.
Paging.
Paging is one of the ways the modern OS performs memory management. In it, a page number and a page offset will be created by splitting the logical address. The page number will serve as the index of a table containing pages of every process. It is the number of bits required for the pages in the Logical Address Space to be represented. Page offset, on the other hand, will serve as the specific location being referenced in the Physical Address Space.
Address translation.
From the previous point, we have learned that the Logical Address will be translated into a Physical Address. In paging, this can be done by referencing a translation look-aside buffer (TLB), which is a hardware cache of the page table. This process will involve taking the page number from the logical address and checking if the page’s frame is stored in the TLB. If the frame is found, then it is taken from the TLB. If it is not, then the frame must first be retrieved from the page table.
Source: OSC Chapter 9
Logical Address vs. Physical Address.
We, as the user of the computer, will only ever deal with the logical address. This address will then be converted by the MMU (Memory Management Unit) into the appropriate physical address, which is where the code/data is located in the RAM. Then, and only then, will the computer know which data is requested by the user.
Swapping.
Swapping, just like the name, is the process of swapping the process that is temporarily out of memory into a backing store (an appropriately-sized disk enough to accomodate copies of all memory images for all users), before being brought back again to be completed. This concept is important for increasing the degree of multiprogramming. The system will maintain a ready queue of ready-to-run processes which were backed out.
Source: OSC Chapter 9.