Post

How do computer programs run

How do computer programs run?

The diagram shows the steps.

๐Ÿ”น User interaction and command initiation

By double-clicking a program, a user is instructing the operating system to launch an application via the graphical user interface.

๐Ÿ”น Program Preloading

Once the execution request has been initiated, the operating system first retrieves the programโ€™s executable file.

The operating system locates this file through the file system and loads it into memory in preparation for execution.

๐Ÿ”น Dependency resolution and loading

Most modern applications rely on a number of shared libraries, such as dynamic link libraries (DLLs).

๐Ÿ”น Allocating memory space

The operating system is responsible for allocating space in memory.

๐Ÿ”น Initializing the Runtime Environment

After allocating memory, the operating system and execution environment (e.g., Javaโ€™s JVM or the .NET Framework) will initialize various resources needed to run the program.

๐Ÿ”น System Calls and Resource Management

The entry point of a program (usually a function named

1
main
) is called to begin execution of the code written by the programmer.

๐Ÿ”น Von Neumann Architecture

In the Von Neumann architecture, the CPU executes instructions stored in memory.

๐Ÿ”น Program termination

Eventually, when the program has completed its task, or the user actively terminates the application, the program will begin a cleanup phase. This includes closing open file descriptors, freeing up network resources, and returning memory to the system.

 How Computer Programs Run

Translate to Korean

์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ์€ ์–ด๋–ป๊ฒŒ ์‹คํ–‰๋ ๊นŒ์š”?

๋‹ค์ด์–ด๊ทธ๋žจ์€ ๋‹จ๊ณ„๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

๐Ÿ”น ์‚ฌ์šฉ์ž ์ƒํ˜ธ ์ž‘์šฉ ๋ฐ ๋ช…๋ น ์‹œ์ž‘

ํ”„๋กœ๊ทธ๋žจ์„ ๋‘ ๋ฒˆ ํด๋ฆญํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๊ทธ๋ž˜ํ”ฝ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ์‹œ์ž‘ํ•˜๋„๋ก ์šด์˜ ์ฒด์ œ์— ์ง€์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”น ํ”„๋กœ๊ทธ๋žจ ์‚ฌ์ „ ๋กœ๋”ฉ

์‹คํ–‰ ์š”์ฒญ์ด ์‹œ์ž‘๋˜๋ฉด ์šด์˜ ์ฒด์ œ๋Š” ๋จผ์ € ํ”„๋กœ๊ทธ๋žจ์˜ ์‹คํ–‰ ํŒŒ์ผ์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.

์šด์˜ ์ฒด์ œ๋Š” ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ํ†ตํ•ด ์ด ํŒŒ์ผ์„ ์ฐพ์•„ ์‹คํ–‰์„ ์ค€๋น„ํ•˜๊ธฐ ์œ„ํ•ด ๋ฉ”๋ชจ๋ฆฌ์— ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ์ข…์†์„ฑ ํ•ด๊ฒฐ ๋ฐ ๋กœ๋“œDependency resolution and loading

๋Œ€๋ถ€๋ถ„์˜ ์ตœ์‹  ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์€ DLL(๋™์  ์—ฐ๊ฒฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ)๊ณผ ๊ฐ™์€ ์—ฌ๋Ÿฌ ๊ณต์œ  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„ ํ• ๋‹น

์šด์˜ ์ฒด์ œ๋Š” ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„ ํ• ๋‹น์„ ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ๋Ÿฐํƒ€์ž„ ํ™˜๊ฒฝ ์ดˆ๊ธฐํ™”

๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹นํ•œ ํ›„ ์šด์˜ ์ฒด์ œ ๋ฐ ์‹คํ–‰ ํ™˜๊ฒฝ(์˜ˆ: Java์˜ JVM ๋˜๋Š” .NET Framework)์€ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ๋‹ค์–‘ํ•œ ๋ฆฌ์†Œ์Šค๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ์‹œ์Šคํ…œ ํ˜ธ์ถœ ๋ฐ ๋ฆฌ์†Œ์Šค ๊ด€๋ฆฌ

ํ”„๋กœ๊ทธ๋žจ์˜ ์ง„์ž…์ (์ผ๋ฐ˜์ ์œผ๋กœ โ€˜mainโ€™์ด๋ผ๋Š” ํ•จ์ˆ˜)์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ๊ฐ€ ์ž‘์„ฑํ•œ ์ฝ”๋“œ์˜ ์‹คํ–‰์„ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ํฐ ๋…ธ์ด๋งŒ ์•„ํ‚คํ…์ฒ˜

Von Neumann ์•„ํ‚คํ…์ฒ˜์—์„œ CPU๋Š” ๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅ๋œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”น ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ

๊ฒฐ๊ตญ ํ”„๋กœ๊ทธ๋žจ์ด ์ž‘์—…์„ ์™„๋ฃŒํ•˜๊ฑฐ๋‚˜ ์‚ฌ์šฉ์ž๊ฐ€ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ์ ๊ทน์ ์œผ๋กœ ์ข…๋ฃŒํ•˜๋ฉด ํ”„๋กœ๊ทธ๋žจ์€ ์ •๋ฆฌ ๋‹จ๊ณ„๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” ์—ด๋ ค ์žˆ๋Š” ํŒŒ์ผ ๋””์Šคํฌ๋ฆฝํ„ฐ๋ฅผ ๋‹ซ๊ณ , ๋„คํŠธ์›Œํฌ ๋ฆฌ์†Œ์Šค๋ฅผ ํ™•๋ณดํ•˜๊ณ , ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์‹œ์Šคํ…œ์— ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

This post is licensed under CC BY 4.0 by the author.