Topics
Operating System
- Introduction to Operating System (OS)
- Idea of an Operating System
- Windows NT
- LINUX
- File Systems and Its types
- File Operations
- Access Methods and its types
- Allocation Methods
- Concepts Related to Process Management
- Concepts related to memory management
- Basics of Graphical User Interface (GUI)
- Access and Security Aspects of O.S.
Data Structures
C++ Programming
- Introduction to C++ Programming
- Idea Behind Object-Orientated Programming
- Object-orientated programming approach
- Object-Oriented Terms and Concepts
- Classes and Objects
- Constructors and Destructors
- Functions in C + +
- Arrays in C++
- Pointers in C++
- References in C++
- Strings in C++
- Inheritance
- Virtual functions and polymorphism
- Friends in C++
- Operator overloading and type conversions
- Files and Stream
HyperTex Markup Language (HTML)
- Introduction to Memory Management
- Partitioning
- Variable Partitions
- Paging
- Segmentation
- Virtual Memory
Concepts related to memory management
Memory Management is the last portion of the operating system. It performs following functions:
- To keep track of all memory locations - free and allocated.
- To decide memory allocation policy i.e. which process should get how much memory.
- To use various techniques and algorithms to allocate and deallocate memory locations.
Memory map for single user computer
The memory map for single user computer consists of kernel, command interpreter, the program to be executed and free available memory. Kernel of the operating system provides basic operating system services while command interpreter interprets operating system commands.
Fixed Partitioning
Partitioning divides main memory into sections called partitions. Fixed Partitioning is when those partitions are permanent. For example, a memory of 32 K words might be divided into regions of following sizes.
As jobs enter the system, they are put in job queue. The job scheduler considers each job's memory requirement and available regions in determining which jobs are allocated memory. When a job is allocated space, it is loaded into the region. There may be a case where the allocated job's size is smaller than the memory which results in internal Fragmentation.
Variable partitions
In variable partitions the number of partitions and their sizes are variable. They are not defined at the time of system generation. At any given time, any partition can be free or allocated to some process. In variable partition the starting address of any partition is not fixed. Figure below shows variable partitions.
Variable partition suffers from external fragmentation. Suppose a job of size 7 K is terminated. A job of 2 K size may be loaded and a partition of 5 K remains unused. This causes memory wastage, called external fragmentation.
Paging
A program's virtual address space and physical memory are divided into equal-sized pages and frames respectively. Pages fit exactly into frames so any page can be assigned to any page frame.
Segmentation
Segmentation is like paging. Pages are physical in nature and are of fixed size, whereas segments are logical divisions of program, and they are of variable sizes. For instance, each program in executable form can be considered as consisting of segments: code, data and stack. Each of the these can be further divided into further segments. In a program, normally we have a main program and some subprograms. There can be various functions like "SQRT" divided into segments. The segment table has a separate entry for each segment, giving the beginning address of the segment in physical memory and length of that segment.
Virtual Memory
Note: Virtual memory allows processes to run with parts stored on disk, enabling executing programs larger than physical memory. It decreases performance and is complex to implement. Following terms are commonly used with virtual memory:
- Locality of reference: This is the basic principle behind virtual memory. In locality of reference, we forecast if a page is likely to be referenced soon, based on its past behavior.
- Page fault: A page fault occurs when a process wants a page not in memory, prompting the operating system to load the required page from disk.
- Working set: A process's working set is the set of actively used pages in physical memory.
- Page replacement policy: As pages are bought in there may be a time when the memory is full, and a page is to be added. In this case, page replacement policy decides which page should be replaced from the main memory.
- Dirty page / Dirty bit: If the page is modified after loading into the memory, it is called as dirty page and is indicated by 1 bit.
- Demand Paging: In demand paging, a page is brought in only when demanded.