Well, what the fuck is a program and how the fuck is it related to a process?
Before we go into what the fuck a process is, let’s try to understand what the fuck a program is first.
A set of instructions.
Well now, that wasn’t very clear, was it? Let’s try to kinda redefine it.. I say “A program is a set of instructions that a computer can follow to achieve a goal.” But it’s still a little jargony, isn’t it? Think of it as a recipe, a handbook, or a manual.. a set of instructions… now it clicks, doesn’t it? It’s basically a programmer’s written note to the computer that says.. do this.. do this.. and do that after that… and finally do that and that’s how you get the citizenship of Saudi Arabia.
But here’s the catch. A program is merely a set of instructions. You do have to run it, to reach the goal. And that’s where process comes in but more on that later. Think of a program as like a book named “How to get inside a girl’s pants in 10 steps” and process as the action you take based on the book to get inside her pants.
A process is a program in execution.
For example, when you write a program in Java and compile it, the JVM creates a bytecode thingy. The original code and the bytecode thingy, both are programs. When you actually run the binary code, it becomes a process.
A process is an ‘active’ entity as opposed to a program which is considered to be a ‘passive’ entity. A single program can create many processes when it’s run multiple times, for example when we open a .exe or binary file multiple times, many instances begin (many processes are created).
Process models (Uniprogramming, Multiprogramming, Multiprocessing)
Uniprogramming => Only one process at a time.
Multiprogramming => Multiple processes at a time i.e A computer running more than one program at a time (like running MS Word and Google Chrome simultaneously to be able to copy Wikipedia for the group project report).
Multiprocessing => System with multiple processors i.e A computer using more than one CPU at a time.
Multitasking – Tasks sharing a common resource (like a single CPU).
As the name itself suggests, multitasking refers to the execution of multiple tasks (say processes, programs, threads etc.) at a time. But.. But.. hold on a minute…
Isn’t it same as multiprogramming? How does it differ from multiprogramming?
Multitasking is a logical extension of multiprogramming. The major way in which multitasking differs from multiprogramming is that multiprogramming works on the concept of context switching whereas multitasking is solely based on time-sharing systems. So, basically, a multitasking system basically divides CPU’s time to be able to do what it does.
K.. I’m bored now. In the next article… we’ll probably look at the states of process and process control block which means how the process looks inside a memory. But for now… hosta la vista, amigos.