Memory Management in hindi


मेमोरी मैनेजमेंट क्या है? (memory management in hindi)

मेमोरी मैनेजमेंट एक operating system) का Function है जो Primary Memory को Handal करता है और Manage करता है। इसके साथ ही ये Process को execution के दौरान Memory और Disk के बीच घुमाने का काम भी करता है।
Memory Management सारे के सारे Memory Location का ट्रैक रखता है; भले ही उन्हें किसी Process को allocate किया गया हो या फिर वो खाली बैठे हों। ये इस बात की जांच भी करता है कि किस process कितनी Memory  देने की जरूरत है।
कौन से  process को किस समय पर Memory दी जाएगी- ये तय करना भी मेमोरी मैनेजमेंट का ही कार्य होता है।
जब भी कोई मेमोरी फ्री होता है यानी किसी प्रोसेस को एक्सीक्यूट करने के बाद खाली होता है तो मेमोरी मैनेजमेंट उसी हिसाब से अपने रिकॉर्ड को अपडेट भी करता रहता है।

swapping in memory management:-

Swapping  एक ऐसा मैकेनिज्म है जिसमे किसी भी Process  को अस्थाई रूप Main memory से Secondary  Storage  यानी कि Disk में Swapp किया जा सकता है और उस मेमोरी को अन्य प्रोसेस के लिए उपलब्ध कराया जा सकता है। कुछ समय के बाद, System  फिर से प्रोसेस को डिस्क में से अपने मेन मेमोरी में वापस Swapp कर लेता है।
वैसे तो स्वैपिंग की प्रक्रिया से सिस्टम के परफॉरमेंस पर असर पड़ता है लेकिन ये बड़े और एक से ज्यादा प्रोसेस को रन करने में मदद करता है। यही कारण है कि स्वैपिंग को मेमोरी compaction की तक्तिक भी कहा गया है।
Swapping diagram:-
स्वैपिंग प्रक्रिया द्वारा लिए गए कुल समय में इसके द्वारा मेन मेमोरी से डिस्क में प्रोसेस को मूव करने में जो समय लगता है वो भी शामिल होता है।
और साथ ही प्रोसेस को वापस सेकेंडरी डिस्क से मेन मेमोरी में कॉपी करने का समय भी इसमें शामिल होता है। मेमोरी को फिर से वापस गेन करने के समय को भी इसमें जोड़ा जाता है।
मान लीजिये कि यूजर प्रोसेस का आकार है 2048KB और वो एक ऐसे स्टैंडर्ड्स हार्ड डिस्क पर है जहां स्वैपिंग के पास डाटा ट्रान्सफर रेट 1Mbps है। अब हम कैलकुलेट करेंगे कि 1000K का सल में मेमोरी से या मेमोरी में ट्रान्सफर करने में कितना समय लगेगा।
2048KB / 1024KB per second
= 2 seconds            
= 2000 milliseconds
अब इन और आउट टाइम को ध्यान में रखते हुए ये 4000 मिली सेकंड (और नया ओवरहेड जहां प्रोसेस मेमोरी को रगें करने की कोशिश करता है) का समय लेगा।

Schedulers:-

Schedulers are special system software which handle process scheduling in various ways. Their main task is to select the jobs to be submitted into the system and to decide which process to run. Schedulers are of three types −
  • Long-Term Scheduler
  • Short-Term Scheduler
  • Medium-Term Scheduler

Long Term Scheduler

It is also called a job scheduler. A long-term scheduler determines which programs are admitted to the system for processing. It selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling.
The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system.
On some systems, the long-term scheduler may not be available or minimal. Time-sharing operating systems have no long term scheduler. When a process changes the state from new to ready, then there is use of long-term scheduler.

Short Term Scheduler

It is also called as CPU scheduler. Its main objective is to increase system performance in accordance with the chosen set of criteria. It is the change of ready state to running state of the process. CPU scheduler selects a process among the processes that are ready to execute and allocates CPU to one of them.
Short-term schedulers, also known as dispatchers, make the decision of which process to execute next. Short-term schedulers are faster than long-term schedulers.

Medium Term Scheduler

Medium-term scheduling is a part of swapping. It removes the processes from the memory. It reduces the degree of multi programming. The medium-term scheduler is in-charge of handling the swapped out-processes.
A running process may become suspended if it makes an I/O request. A suspended processes cannot make any progress towards completion. In this condition, to remove the process from memory and make space for other processes, the suspended process is moved to the secondary storage. This process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be necessary to improve the process mix.
A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. There are six popular process scheduling algorithms which we are going to discuss in this chapter −
  • First-Come, First-Served (FCFS) Scheduling
  • Shortest-Job-Next (SJN) Scheduling
  • Priority Scheduling
  • Shortest Remaining Time
  • Round Robin(RR) Scheduling
  • Multiple-Level Queues Scheduling
These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state.

First Come First Serve (FCFS)

  • Jobs are executed on first come, first serve basis.
  • It is a non-preemptive, pre-emptive scheduling algorithm.
  • Easy to understand and implement.
  • Its implementation is based on FIFO queue.
  • Poor in performance as average wait time is high.
Wait time of each process is as follows −
Process
Wait Time : Service Time - Arrival Time
P0
0 - 0 = 0
P1
5 - 1 = 4
P2
8 - 2 = 6
P3
16 - 3 = 13
Average Wait Time: (0+4+6+13) / 4 = 5.75

Shortest Job Next (SJN)

·        This is also known as shortest job first, or SJF
·        This is a non-preemptive, pre-emptive scheduling algorithm.
·        Best approach to minimize waiting time.
·        Easy to implement in Batch systems where required CPU time is known in advance.
·        Impossible to implement in interactive systems where required CPU time is not known.
·        The processer should know in advance how much time process will take.
Wait time of each process is as follows −
Process
Wait Time : Service Time - Arrival Time
P0
3 - 0 = 3
P1
0 - 0 = 0
P2
16 - 2 = 14
P3
8 - 3 = 5
Average Wait Time: (3+0+14+5) / 4 = 5.50

Priority Based Scheduling

·        Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems.
·        Each process is assigned a priority. Process with highest priority is to be executed first and so on.
·        Processes with same priority are executed on first come first served basis.
·        Priority can be decided based on memory requirements, time requirements or any other resource requirement.
Wait time of each process is as follows −
Process
Wait Time : Service Time - Arrival Time
P0
9 - 0 = 9
P1
6 - 1 = 5
P2
14 - 2 = 12
P3
0 - 0 = 0
Average Wait Time: (9+5+12+0) / 4 = 6.5

Shortest Remaining Time

·        Shortest remaining time (SRT) is the preemptive version of the SJN algorithm.
·        The processor is allocated to the job closest to completion but it can be preempted by a newer ready job with shorter time to completion.
·        Impossible to implement in interactive systems where required CPU time is not known.
·        It is often used in batch environments where short jobs need to give preference.

Round Robin Scheduling

·        Round Robin is the preemptive process scheduling algorithm.
·        Each process is provided a fix time to execute, it is called a quantum.
·        Once a process is executed for a given time period, it is preempted and other process executes for a given time period.
·        Context switching is used to save states of preempted processes.
Wait time of each process is as follows −
Process
Wait Time : Service Time - Arrival Time
P0
(0 - 0) + (12 - 3) = 9
P1
(3 - 1) = 2
P2
(6 - 2) + (14 - 9) + (20 - 17) = 12
P3
(9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5

Multiple-Level Queues Scheduling

Multiple-level queues are not an independent scheduling algorithm. They make use of other existing algorithms to group and schedule jobs with common characteristics.
  • Multiple queues are maintained for processes with common characteristics.
  • Each queue can have its own scheduling algorithms.
  • Priorities are assigned to each queue.
For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based on the algorithm assigned to the queue.


Tausif

Hi! My name is TAUSIF AHMAD I have completed B.Tech in Computer Science from Maulana Azad National Urdu University Hyderabad. I am always ready to have new experiences meet new people and learn new things. 1. I am very interested in Frontend Development. 2. I love video editing and graphics designing. 3. I enjoy challenges that enables to grow. 4. I am part time Blogger.

1 Comments

Post a Comment
Previous Post Next Post