0% found this document useful (0 votes)
2 views3 pages

Multitasking

Uploaded by

Anif Kma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Multitasking

Uploaded by

Anif Kma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Multitasking, Multiprocessing, Multithreading & Thread (Notes)

Multitasking

Definition

Multitasking is the ability of an operating system to run multiple tasks simultaneously


using the CPU.

The OS switches the CPU between tasks very quickly, so they appear to run at the same time.

Example

• Listening to music on Spotify

• Coding in VS Code

• Browsing Chrome

All running together on the computer.

Structure

Computer

Multitasking

Types of Multitasking

Multitasking has two types:

Multitasking
├ Process-Based Multitasking (Multiprocessing)
└ Thread-Based Multitasking (Multithreading)

Multiprocessing (Process-Based Multitasking)

Definition

Multiprocessing means running multiple processes (programs/applications)


simultaneously.

A process is a program in execution.

Example

Process 1 → Spotify
Process 2 → VS Code
Process 3 → Chrome
Each process:

• has its own memory

• runs independently

• does not share memory with other processes

Key Idea

Multiprocessing = multiple applications running

Multithreading (Thread-Based Multitasking)

Definition

Multithreading means running multiple tasks inside a single program using threads.

Example inside a browser:

Chrome (Process)
├ Thread → Load webpage
├ Thread → Play video
└ Thread → Handle user input

All these tasks run inside the same application.

Key Idea

Multithreading = multiple tasks inside one program

Threads:

• share the same memory of the process

• run tasks simultaneously

Thread

Definition

A thread is the smallest unit of execution inside a process.

A thread performs a specific task of a program.

Example

Video Player (Process)

Thread 1 → Play video


Thread 2 → Play audio
Thread 3 → Handle user input
Execution

Definition

Execution means running the instructions of a program.

When the CPU runs the program’s instructions, it is called execution.

Instructions of a Program

Instructions are the commands written in code that tell the computer what to do.

Example:

int a = 10;
int b = 20;
int c = a + b;
[Link](c);

Each line is an instruction.

Full Concept Chain

Program

Process (program running)

Threads

Execution

Running program instructions

Final Quick Definitions

Multitasking
Running multiple tasks simultaneously using the CPU.

Multiprocessing
Running multiple processes (applications) simultaneously.

Multithreading
Running multiple tasks inside a single program using threads.

Thread
The smallest unit of execution inside a process.

Execution
Running the instructions of a program.

You might also like