DEV Community

ivinieon
ivinieon

Posted on

How can multiple programs be executed?

How can multiple programs be executed?

  • Program: A collection of commands that a computer can execute.
  • Process: A program that is running on a computer. Each process is assigned an independent memory space.
  • CPU: The computational unit that executes commands.
  • Main Memory: Where processes wait to be executed by the CPU.
  • I/O(Input/Output): Reading and writing files, sending and receiving data somewhere on the network. Handling input and output devices and sending or receiving data.

Single process system

Only one program runs at a time. CPU usage is not efficient because when a program performs an IO operation, the CPU is idle.
→ Load multiple programs into memory and execute them simultaneously. When IO operation occurs, another process runs on the CPU:

Multiprogramming

To maximize CPU usage.

Disadvantages
If the CPU usage time is long, the processes continue to wait.
→ Let the process run for a very short time(quantum) when using the CPU. Alternatively executing very short periods of time.

Multitasking

To minimize the response time of the process.

Disadvantages

  • A single process cannot perform multiple tasks simultaneously.
  • Context switching between processes is a heavy task(programs cross over.)
  • Data sharing between processes is difficult. → the memory space they occupy is independent.
  • Dual-core processors have been released. &raar; improving the performance of a single CPU has trouble such as overheating.

Thread

A process can have more than one thread.
Unit of execution(CPU).
Context switching between threads of the same process is lightweight.
Threads share the memory space of the process they belong to.
→ Threads also have. their unique areas as well.(such as stacks)

Multithreading

A single process executes multiple tasks simultaneously.
Each core executes one task in parallel.

Extended multitasking concept: Multiple processes and threads share very short CPU time slices.

Multiprocessing

A system that utilizes two or more processors or cores.

Summary
Multitasking: Sharing cores
Multithreading: Dual Threads
Multiprocessing: More than 2 cores.

This posting is just a study note which was written after watching youtube videos in Korean.

Youtube Link

Top comments (0)