Virtual Memory and Data Storage Explained
Virtual Memory and Segmentation
In memory segmentation, partitions are resizable. Segmentation takes advantage of the fact that programs are divided into logical parts, such as pieces of data, code, etc. In this case, the program and its data are divided into a number of segments. The translation is carried out in the same way as paging, but taking into account that the size of the segments is variable. The segment table controls this. Thus, each entry in the table should also contain the residence bit, the segment address on the disk, the segment starting address, and the length of each segment. The OS will maintain a table of segments for each process. The address of the beginning of this table is in a hardware register, called the Record of Origin of Table Blocks (ROTB).
Memory Management Strategies
- Raising Strategy: Determines when to transfer a page or segment from secondary to primary storage.
- Demand-raising strategies wait for a running process to reference a page or a segment before bringing it in.
- Advance procurement strategies attempt to determine in advance which pages or segments will be referenced by a process.
- Demand Paging: This technique requires hardware support (presence bit).
- Placement Strategies: Determine where in main memory a page or an incoming segment should be placed, i.e., the amount of memory to allocate.
- Replacement Strategies: Used to decide which page or segment must be moved to make room for an incoming page or segment when the main memory is fully occupied.
Physical Storage of Data
Data storage components:
- Track: Concentric circles into which the storage space is split.
- Sectors: Divisions of the tracks.
- Cylinders: A logical union of several parallel tracks from several storage areas.
- Platter: Storage areas.
- Read/Write Head: Physical units that can read/write to the device.
Disk Access Times
- Search Time: Time for a head to go from one track to another. It depends on the distance between the current position and the destination track.
- Latency (or Rotational Delay): Time it takes for the head to go from the current sector to the desired sector.
- Disk Cache: A buffer in main memory for disk sectors. The cache contains a copy of some sectors of the disk.
Storage Space Allocation
- Continuous Mapping: When a file is created, it is assigned contiguous blocks. Each directory contains file names, the address of the starting block of each file, and their total size.
- Linked Allocation: Allocation is made up of individual blocks, i.e., not necessarily contiguous. Each block contains a pointer to the next. The directory will contain the names of files and the initial and final block address of each.
- Allocation with Indices (Index): The directory stores an index block for each file, with pointers to all building blocks. When you read a file, there are two accesses: one to the index block and another to the desired data block.
Access Methods in File Systems
- Sequential: Accesses records of a file one at a time until the desired record is reached.
- Direct: Allows access to any record immediately.
- Sequential Indexing: Each file has a table of pointers; each pointer is the address of an index block.