os202

Mohammad Saddam Mashuri's OS202


Project maintained by saddamonpc Hosted on GitHub Pages — Theme by mattgraham

HOME

Top 10 List of Week 04

Why hello there! I’m thankful you have the time to read my top 10 of week 4 of this course. This week topic is Addressing Please do realize that this top 10 are my opinion and may not be the same with yours.

The way I grade this top 10 list are by 3 categories:

* how important it is,

* how simple it is,

* and how relevant the topic is to the operating system course.

I heard this week is gonna be tough, and it shows. This week’s topic houses one of the most complicated operating system concepts. While I do wish that my journey in computer science is going to be easier, well… It doesn’t, and I don’t think it will ever be. But, hardwork pays off, and at least I’ll probably get a job out of it.

Please enjoy your stay here, and good luck to my other mates doing this course!

  1. The Address Space
    The address space allows the OS to create an easy to use abstraction of physical memory. This abstraction is called the address space. Understanding this fundamental OS abstraction of memory is key to understanding how memory is virtualized. The address space of a process contains all of the memory state of the running program.

  2. Memory Allocation
    One of the simplest methods of allocating memory is to assign processes to variably sized partitions in memory. In this variable-partition scheme, the operating system keeps a table showing which parts of memory are available, and which are used. However, this scheme is vulnerable to the general dynamic storage-allocation problem (how to satisfy a request of size ‘n’ from a list of free holes). There are many solutions to this problem, as follows:
    • First fit
      Allocate the first hole that is big enough, such that searching can start either at the beginning of the set of holes or at the location where the previous first-fit search ended.
    • Best fit
      Allocate the smallest hole that is big enough. This strategy produces the smallest leftover hole, but we must search the entire list.
    • Worst fit
      Allocate the largest hole. This strategy produces the largest leftover hole, and we must search the entire list. However, a large leftover hole may be more useful than the smaller leftover hole.

      Both the first-fit and best-fit strategies for memory allocation suffer from external fragmentation (enough free space, but all the free space are not located together. This is discussed in point no. 6). Paging, may help fix this problem.
  3. Paging
    To keep allocation from being more challenging over time, it may be worth to chop up space into fixed-sized pieces, rather than into a variable-sized one. In virtual memory, this is called paging. Instead of splitting up a process’s address space into some number of variable-sized logical segments (e.g., code, heap, stack), we divide it into fixed-sized units, each of which we call a page. Another advantage of paging, is the simplicity of free-space management that paging offers.

  4. Page Table
    Page table is a data structure used by the virtual memory system to store the mapping between logical addresses and physical addresses. Logical addresses are generated by the CPU for the pages of the processes therefore they are generally used by the processes. Physical addresses are the actual frame address of the memory. They are generally used by the hardware or more specifically by RAM subsystems.

  5. Address Translation
    In virtualizing memory, attaining both efficiency and control while providing the desired virtualization, requires a strategy commonly referred to as hardware-based address translation AKA address translation. With address translation, the hardware transforms each memory access, changing the virtual address provided by the instruction to a physical address where the desired information is actually located. Hence, on each and every memory reference, an address translation is performed by the hardware to redirect application memory references to their actual locations in memory.

  6. Fragmentation
    Fragmentation is a phenomenon in which storage space is used inefficiently, reducing both performance and capacity of the memory. In simple words, Fragmentation causes storage space to be “wasted”. There are three types of fragmentation:
    • External fragmentation
      There is enough free memory, but this free memory is spread out, and not located together.
    • Internal fragmentation
      Computer memory is sometimes allocated than is necessary.
    • Data fragmentation
      A collection of data in memory is broken up into many pieces that are not close together.
  7. Swapping
    Swapping is a mechanism in which a process can be swapped temporarily out of main memory to secondary storage and make that memory available to other processes. The purpose of swapping is to maximize the number of processes in the system. Swapping is a useful technique that enables a computer to execute programs and manipulate data files larger than main memory.

  8. No Swapping on Mobile Systems
    Mobile systems typically do not support swapping in any form. Mobile devices usually use flash memory rather than hard disks for non-volatile storage. Instead of swapping, mobile system such as Apple’s iOS asks application to relinquish allocated memory. Androids adapts similar strategy as iOS, but it may terminate a process if insufficient free memory is available.

  9. Big Endian and Little Endian
    This topic was talked briefly in the IDS / PSD course, but I think it’s high time we need to review about this topic for a few seconds. Big endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. Little endian system, in contrast, stores the least significant byte of a word at the smallest memory address.

    I’ll show you an example, for the hex ‘0x12674592’ in 32-bit representation, can be stored as - Big Endian and Little Endian example

  10. Linux Libraries
    Linux libraries contains an assortment of pre-compiled pieces of code that can be reused. These simplifies our lives as a programmer. There are two Linux C/C++ library types that can be created:
    • Static libraries (.a): Library of object code which is linked with, and becomes part of the application.
    • Shared libraries (.so): There is only one form of this library but it can be used in two ways:
      • Dynamically linked: Here a program is linked with the shared library and the kernel loads the library (in case it’s not in memory) upon execution.
      • Dynamically loaded: the program takes full control by calling functions with the library.

That’s it for this week’s top 10 list. How is it? Do you agree with it? Or maybe something is missing or doesn’t seem right? Well, maybe take a second to give me a feedback and contact me through github. Thank you for reading!

Sources:
Abraham Silberschatz - Operating System Concepts -Wiley (2018)
http://pages.cs.wisc.edu/~remzi/OSTEP/
https://www.tutorialspoint.com/big-endian-and-little-endian
https://www.tecmint.com/understanding-shared-libraries-in-linux/