Process

Process in Layman’s terms

Hemal Shah explained these. I did a more formal rigorous study through SE350.

You should now look into Thread.

Process vs. Thread?

Processes are what actually execute the program. Each process is able to run concurrent subtasks called threads.

  • Threads are sub-tasks of processes and if synchronized correctly can give the illusion that your application is performing everything at once. Without threads you would have to write one program per task, run them as processes and synchronize them through the operating system.

Source

Also see Multithreading.

Each program has a main thread. If you don’t program multithreading into a program, when it launches as a process, it will always run on a single thread.

Processes vs. Threads

As explained by Hemal Shah

  • Processes can be on multiple threads
  • A thread cannot own multiple processes. A thread is owned by a process

A process is just a program is being executed from a binary file (a sequence of 0s and 1s). All operating systems have their own binaries that they can execute (window is .exe, Apple is .dmg, etc)

  • At the lowest level, there is code and data. In Von Neumann architecture you have the saying that Code is data. Remember what you learned for MIPS, like an add operation. The add is the code, and the data is the two registers that you want to add together
  • So at the lowest level, that is all there is to a binary being executed.

Now, how this relates to threads? Well, each software thread is just a process running from a binary.

But Hemal also talked about how a single process can run on multiple threads.

More Context

So threads share CPU time. The technique is called Context Switching.

Also, the main memory is just RAM.