Operating System (OS) Basics

Udhayakumar C
2 min readOct 15, 2020

--

An Operating System (OS) is a collection of software that (Abstracts, Arbitrates) manages computer hardware.

Processes and Process Management

A process is basically a program in execution. it can be divided into four sections ─ stack, heap, text, and data. These are following

Process Section

image source

Stack: The process Stack contains temporary data and local variables.

Heap: This is dynamically allocated memory to a process during its run time.

Data: This contains global and static variables.

Text: This includes the current activity.

Process States

The process passes through different states while executing. These states are following,

image source

Start: This is the initial state of the process when created.

Ready: The process is waiting to be assigned to a processor.

Running: The process is executing

Waiting: The process is waiting for user input

Terminated: The process finished the execution or canceled.

Process Control Block (PCB)

PCB keeps all information about every process to track. PCB is identified by a unique process ID (PID).

image source

Process ID: unique identification of process.

State: the current state of the process.

Pointer: A pointer to the parent process.

Program Counter: it is a pointer to the address of the next instruction for the current process.

CPU Register: Process are stored for execution.

CPU Scheduling: To scheduling the process by its priority.

Memory management information: it has information about memory limits.

Accounting Information: This includes the amount of CPU used for process execution, time limits, execution ID, etc.

IO Status Information: This includes a list of I/O devices allocated to the process.

Parallelism

Concurrency is executing a lot of threads at once in Multiple cores. Need more than one core.

Core 1 ->Thread 1

Core 2 ->Thread 2

Core 1 will execute thread 1, Core 2 will execute thread 2

The goal of parallelism is performance.

Concurrency

Concurrency is executing a lot of threads at once in a single core.

Core 1 => T1 -> T2 -> T1 -> T2

Where the core will execute the thread 1 for some time and thread 2 for some time.

The goal of concurrency is a non-blocking application. The application should not hang

--

--

Udhayakumar C
Udhayakumar C

Written by Udhayakumar C

Senior Software Engineer @Yavar Tech Works

No responses yet