Memory management

Memory Management: 

Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution.
The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when no longer needed. 

Different Memory Management Techniques: 
The following are the three key memory management techniques used by an operating system: 
  1. Segmentation. 
  2. Paging. 
  3. Swapping
Swapping involves performing two tasks called swapping in and swapping out.
  1. Swapping in: The task of placing the pages or blocks of data from the hard disk to the main memory.
  2. Swapping out: The task of removing pages or blocks of data from main memory to the hard disk.
Segmentation refers to the technique of dividing the physical memory space into multiple blocks. Each block has specific length and is known as a segment. 
Base address: Starting address of each segment.
Segment table: Contains details about each segment.

Paging is a technique in which the main memory of computer system is organized in the form of equal sized blocks called pages.
Page table:  Where the address of occupied pages of physical memory are stored.
Paging enables the operating system to obtain data from the physical memory location without specifying lengthy memory address in the instruction. In this technique, the virtual address is used to map the physical address of the data. The length of virtual address is specified in the instruction and is smaller than physical address of the data. It consists of two different numbers, first number is the address of page called virtual page in the page table and the second number is the offset value of the actual data in the page.

Paged Segmentation: 
In Segmented Paging, the main memory is divided into variable size segments which are further divided into fixed size pages. Pages are smaller than segments. Each Segment has a page table which means every program has multiple page tables.

Paging vs Swapping:
Paging allows the memory address space of a process to be noncontiguous.
Swapping allows multiple programs to run parallelly in the operating system.
Paging is more flexible as only pages of a process are moved.
Swapping is less flexible as it moves entire process back and forth between main memory and back store.
Paging allows more processes to reside in main memory
Compared to paging swapping allows less processes to reside in main memory.

Paging vs Segmentation:
A page is of fixed block size.
A segment is of variable size.
Paging may lead to internal fragmentation.
Segmentation may lead to external fragmentation.
Paging involves a page table that contains base address of each page.
Segmentation involves the segment table that contains segment number and offset (segment length).
Operating Systems: covered following topics in Operating Systems.
    A list of Video lectures
    Python Programming ↓ 👆
    Java Programming ↓ 👆
    JAVA covered following topics in these notes.
    JAVA Programs
    Principles of Programming Languages ↓ 👆
    Principles of Programming Languages covered following topics in these notes.

    Previous years solved papers:
    A list of Video lectures References:
    1. Sebesta,”Concept of programming Language”, Pearson Edu 
    2. Louden, “Programming Languages: Principles & Practices” , Cengage Learning 
    3. Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. 
    4. E Horowitz, "Programming Languages", 2nd Edition, Addison Wesley

      Computer Organization and Architecture ↓ 👆

      Computer Organization and Architecture covered following topics in these notes.

      1. Structure of desktop computers
      2. Logic gates
      3. Register organization
      4. Bus structure
      5. Addressing modes
      6. Register transfer language
      7. Direct mapping numericals
      8. Register in Assembly Language Programming
      9. Arrays in Assembly Language Programming


      1. William stalling ,“Computer Architecture and Organization” PHI
      2. Morris Mano , “Computer System Organization ”PHI

      Computer Network ↓ 👆
      Computer Network covered following topics in these notes.
      1. Data Link Layer
      2. Framing
      3. Byte count framing method
      4. Flag bytes with byte stuffing framing method
      5. Flag bits with bit stuffing framing method
      6. Physical layer coding violations framing method
      7. Error control in data link layer
      8. Stop and Wait scheme
      9. Sliding Window Protocol
      10. One bit sliding window protocol
      11. A protocol Using Go-Back-N
      12. Selective repeat protocol
      13. Application layer
      1. Andrew S. Tanenbaum, David J. Wetherall, “Computer Networks” Pearson Education.
      2. Douglas E Comer, “Internetworking with TCP/IP Principles, Protocols, And Architecture",Pearson Education
      3. KavehPahlavan, Prashant Krishnamurthy, “Networking Fundamentals”, Wiley Publication.
      4. Ying-Dar Lin, Ren-Hung Hwang, Fred Baker, “Computer Networks: An Open Source Approach”, McGraw Hill.