0
$\begingroup$

Let us consider the following scenario,

The cpu started executing a program, which is in secondary memory with n lines of code, so, it brings m ( < n ) lines of code in to main memory and started executing.

We can call the m lines of code, which are in main memory as process.

But my doubt is that, what about the remaining n-m lines of code that are in secondary memory, which are not yet reached main memory, can we call them process? or just program? The remaining n-m lines may execute by the CPU in future. But what now the n-m lines of code are?

$\endgroup$
2
$\begingroup$

A process is a technical term that has a well-defined meaning. You can't just re-define standard terms that have an accepted meaning... or if you do, you should expect it to cause confusion. My advice is to stick with the standard meaning of this term, and read an operating system textbook to learn what is the accepted notion of a "process".

Wikipedia defines a process as "an instance of a computer program that is being executed". A process is not some set of lines of code. A program contains a bunch of machine-level instructions. (Those machine-level instructions are typically obtained by compiling some source code.) A process is then a running instance of a program. The process typically is comprised of multiple resources: some memory (in particular, a region of virtual memory), one or more threads of execution, and some operating system state that is specific to the particular process.

So, no, you can't call "the set of lines of code in secondary memory" a process -- that's not what a process is. Similarly, when you write "We can call the m lines of code, which are in main memory as process.", my reaction is: no, you can't -- that's not what a process is.

$\endgroup$
1
$\begingroup$

A process is a set of instructions that will eventually be executed by the CPU , it doesn't matter if it's on main or secondary memory, the CPU will see it as Virtual Memory (https://en.wikipedia.org/wiki/Virtual_memory).

A process can be seen as an entity that has his own memory and tables on the CPU (see GDT: https://en.wikipedia.org/wiki/Global_Descriptor_Table) so it will still be a process even if it's on main or secondary memory.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.