Applications의 동작 원리(CPU, GPU, Memory, and multi-process architecture)

서정준·2024년 3월 1일
0

When you start an application on your computer or phone, the CPU and GPU are the ones powering the application. Usually, applications run on the CPU and GPU using mechanisms provided by the Operating System.
👉 Application은 CPU, GPU에서 돌아가고 그 제어는 운영체제가 한다.

When you start an application, a process is created. The program might create thread(s) to help it do work, but that's optional. The Operating System gives the process a "slab" of memory to work with and all application state is kept in that private memory space. When you close the application, the process also goes away and the Operating System frees up the memory.
👉 Application을 시작하면 process가 만들어지고 프로그램이 thread가 필요할 경우 thread를 생성한다.
👉 운영체제는 process에게 메모리를 주게 되고 Application이 종료되었을 경우 운영체제는 할당되었던 메모리를 삭제한다.

Execute program on Process and Thread

A process can ask the Operating System to start another process to run different tasks. When this
happens, different parts of the memory are allocated for the new process. If two processes need to
talk, they can do so by using Inter Process Communication (IPC). Many applications
are designed to work this way so that if a worker process get unresponsive, it can be restarted
without stopping other processes which are running different parts of the application.

👉 IPC를 이용해 process간의 소통이 이루어진다.
👉 process마다 다른 메모리가 할당 되므로 한 process의 동작이 멈췄다 해도 다른 process에 영향을 미치지 못한다.

Browser architecture
Until very recently, Chrome gave each tab a process when it could; now it tries to give
each site its own process, including iframes

👉 Chrome은 각각의 사이트에 프로세스를 할당한다.

Browser process
Controls "chrome" part of the application including address bar, bookmarks, back and forward buttons.
Also handles the invisible, privileged parts of a web browser such as network requests and file access.
Renderer process
Controls anything inside of the tab where a website is displayed.
Plugin process
Controls any plugins used by the website, for example, flash.
GPU process
Handles GPU tasks in isolation from other processes. It is separated into different process because GPUs handles requests from multiple apps and draw them in the same surface.

The benefit of multi-process architecture in Chrome

If one tab becomes unresponsive, then you can close the unresponsive tab and move on while keeping
other tabs alive. If all tabs are running on one process, when one tab becomes unresponsive, all
the tabs are unresponsive. That's sad.
👉 하나의 tab이 응답하지 않을 경우 다른 tab을 이용할 수 있다.

Another benefit of separating the browser's work into multiple processes is security and
sandboxing.
👉 보완성이 좋다.

출처
https://developer.chrome.com/blog/inside-browser-part1/

profile
통통통통

0개의 댓글