in Operating System edited
1,212 views
0 votes
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 Operating System edited
by
1.2k views

2 Answers

0 votes
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

4 Comments

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?
0
0
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..
0
0
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
0
0 votes
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.

Related questions