The Gateway to Computer Science Excellence
0 votes
i have one doubt ...we know that ready , running and block waiting are lies inside main memory but it saying that when the process are in running state then process are suppose to given to CPU so when we have done with given of process to CPU how we can say that the process are in RAM or Running state are in RAM...please reply it is actually funny question .
in Compilers, Architecture, HPC by
edited | 101 views

2 Answers

0 votes
When the process completes its work, the memory is deallocated.

If process moves from running to ready or waiting, the process will be in memory since the CPU will require to complete the rest of the work
I didn't get the reason why running process is said to be in Memory even though "running" means the process is given to the CPU..

I had the same doubt.. please elaborate..
i think it is like in our mobile phones...we open so many apps the main one is running in  RAM and rest are ready to run in RAM.
The background apps occupy space in the RAM ..the foreground app(the one on the display screen) is actually the running app..
By the phrase, a process is given to CPU, it means CPU is accessing the data and processing it and storing it back to the memory. This to and fro happens multiple times. If the data of the process is removed from memory from where will CPU access data?
Each process has PCB which has GPRS as one of it's attributes. So

" if the data of the process is removed from memory from where will CPU access data " then it can access it from the CPU registers..

correct me..
Register count and size is limited.(since increasing it will increase the cost) We can store only limited data and that too important to the CPU(the one which it is currently processing).
0 votes

A process is a data structure that an OS requires to execute  a program. For a given program, we create a process in the main memory. A process consists of Data Section (consisting of global and static variables), Code / Text Section (which contains executable machine code), Heap and Stack (to support dynamic memory allocation and function calls).

So when the scheduler schedules a process, the OS takes that process's context (PCB) and puts it in RUNNING queue, just to keep track of the what process's are running.

When we say "a process is running or CPU is executing a process"


                                                     or in your words

              process is given to the CPU

, what we mean is that the CPU is taking executable machine code from that process's (which is living inside the main memory) text / code section and executing it line by line.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,522 answers
95,372 users