0

What exactly is a process and what all things is a process comprised of? I have read the Wikipedia page and I found only abstract details over there.

I want to know what details are stored by a process - for eg., a process identifier, program counter, etc. What are the other things that are part of a process? Also, how is process memory organised? For eg., are all components of a process present in memory contiguously?

closed as unclear what you're asking by gnat, user22815, durron597, GlenH7, user40980 Apr 27 '15 at 1:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you after the physical parts of a computer that implement a process, or just a more approachable abstract definition than the one Wikipedia gave? Adding some detailed subquestions like "It says X but if that's true then how could it be used for Y?" would make it a lot easier for us to tell what kind of answer you're looking for. – Ixrec Apr 26 '15 at 10:00
3

A process is one coherent set of instructions that an OS is currently executing. Everything else pretty much follows from that.

For instance, a process resides in memory, and each one has its own state. If your computer is running four instances of Bash simultaneously (not an uncommon situation), they are all the same program, but four different processes. Each has its own program counter, its own entry in the OS's process table, and either can currently be scheduled or not scheduled independent of each other. They may or may not share the same memory segments to hold parts of their opcodes - that depends on things like static/dynamic linking.

What else is part of a process? For instance, dynamically allocated memory. Programs that allocate memory get that memory allocated to them specifically, in a dedicated data segment. Again, your four Bash processes won't share that memory, unless they perform a coordinated protocol to explicitly share some of it. Then there is the bookkeeping info that the OS keeps about a process: its number, its priority, its owning user id, the amount of cycles it has already used, etc.

Handling processes reasonably efficiently is in fact quite complicated, and a big reason why writing an O.S. is not a trivial task. But in the end, processes are just instances of programs, i.e. opcode streams, and everything else is just accounting to keep those streams flowing efficiently. (Ask again if you have more specific questions or barriers to understanding.)

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