CST 334 - Module 2

Week 2 

This week's topic is more centered around the idea of processes, which is essentially a program that is running instead of sitting in storage. However, it doesn't end there. The OS sets an environment and tools for the user program to use (also known as context). Additionally, if the pc runs multiple programs at once, the OS must be able to run them all at the same time (i.e. run one program for a time, then stop it, switch to the next program, and so on) all without forgetting each programs data/instruction. Remember, time is important when trying to complete many tasks. 

There are many ways the programs can share the CPU, first in last out, round robin, shortest job first, etc. These are essentially ways the scheduler can assign which order of process to run, resulting in faster response times or turnaround time (time = process finished - process arrived). But this is started to get more into scheduling than processes so let's take a step back.

The process is comprised of a unique identifier (PID), code/data, stack/heap, context, and pointers to open files/devices. The context is saved in the registers and contains the program counter, current operands, and stack pointer. 

Adding on to the relationship between scheduling and processes, there are 5 states of a process that is important to know. Running, ready, blocked, new, and dead. For now, let's focus on the first three. What is interesting about the first three is that this is how a process can be scheduled. When a process is created, it now ready to be run and waits to be scheduled. Once scheduled, it is now running, but can be blocked when waiting for something like an input or output. The reason it is blocked is to make use of the CPU by keeping it productive instead of waiting. Thus, if there are multiple processes in the ready state, the process that is now waiting for an input can be blocked/waiting, and the next ready process starts running.

There is much more to talk about, but let's end this post here because time is important.

Comments

Popular posts from this blog

CST 300 - Module 4

CST 300 - Module 2

CST 300 - Module 3