When a Program is booted up on an Operating system let’s say Windows, then it launches the program in user mode. When a user-mode program requests to run, a process and virtual address space (address space for that process) are created for it by Windows. User-mode programs are less privileged than user-mode applications and are not allowed to access the system resources directly. For instance, if an application under user mode wants to access system resources, it will have to first go through the Operating system kernel by using syscalls.
운영 체제
(Windows로 가정)에서User Mode Program
이 실행을 요청하면OS
는process
및Virtual address space
이 만들어집니다.
User Mode Program
은User Mode applications
보다 권한이 낮고 시스템 리소스에 직접 액세스할 수 없습니다. 예를 들어, 사용자 모드 응용 프로그램이 시스템 리소스에 액세스하려면 먼저syscall
을 사용하여OS kernel
을 통과해야 합니다.
실행 환경
안정성 및 보안
자원 접근 방식
✅ 사용자 모드 프로그램과 사용자 모드 애플리케이션은 사용자 모드에서 실행된다는 공통점이 있습니다.
❌ 용어의 범위와 목적, 사용 사례에 있어 차이점이 존재합니다.
🤔 위 문장이 시사하는 바가 무엇일까? 예시를 통해 알아보자!
백그라운드 업데이트 프로그램 (User Mode Program):
웹 브라우저 (User Mode applications):
위의 예시를 통해 User Mode Program
이 제한된 권한을 가지는 이유와, User Mode Application
이 더 많은 권한을 필요로 하는 이유를 쉽게 이해할 수 있습니다 😊
The kernel is the core program on which all the other operating system components rely, it is used to access the hardware components and schedule which processes should run on a computer system and when, and it also manages the application software and hardware interaction. Hence it is the most privileged program, unlike other programs, it can directly interact with the hardware. When programs running under user mode need hardware access for example webcam, then first it has to go through the kernel by using a syscall, and to carry out these requests the CPU switches from user mode to kernel mode at the time of execution. After finally completing the execution of the process the CPU again switches back to the user mode.
Kernel
은 다른 모든 OS 구성 요소들이 의존하는 핵심 프로그램으로, 하드웨어 구성 요소들에 접근하여 컴퓨터 시스템에서 어떤 프로세스를 언제 실행해야 하는지 스케쥴링하며, 응용 소프트웨어와 하드웨어 상호 작용도 관리합니다.
따라서Kernel
은 다른 프로그램과 달리 하드웨어와 직접 상호 작용할 수 있는 가장 특권이 있는 프로그램입니다. 웹캠과 같은User Mode
에서 실행되는 프로그램이 하드웨어 액세스가 필요할 때, 먼저syscall
을 사용하여kernel
을 통과해야 하며, 이러한 요청을 수행하기 위해 CPU는 실행 시User Mode
에서kernel Mode
로 전환됩니다. 최종적으로 프로세스 실행을 완료한 후 CPU는 다시User Mode
로 전환됩니다.
Criteria | Kernel Mode | User Mode |
---|---|---|
Access to Resources | Kernel mode에서 프로그램은 시스템 자원에 직접적이고 무제한적인 접근이 가능합니다. | User mode에서 응용 프로그램은 시스템 자원에 직접 접근할 수 없으며, 자원에 접근하기 위해서는 시스템 호출을 해야 합니다. |
Interruptions | Kernel mode에서 인터럽트가 발생하면 전체 OS가 다운될 수 있습니다. | User mode에서 인터럽트가 발생하면 단일 프로세스만 실패합니다. |
Modes | Kernel mode는 master mode, privileged mode, system mode로도 알려져 있습니다. | User mode는 unprivileged mode, restricted mode, slave mode로도 알려져 있습니다. |
Virtual address space | Kernel mode에서는 모든 프로세스가 단일 가상 주소 공간을 공유합니다. | User mode에서는 모든 프로세스가 별도의 가상 주소 공간을 가집니다. |
Level of privilege | Kernel mode에서는 응용 프로그램이 더 많은 권한을 가집니다. | User mode에서는 응용 프로그램이 더 적은 권한을 가집니다. |
Restrictions | Kernel mode는 사용자 프로그램과 kernel 프로그램 모두에 접근할 수 있기 때문에 제한이 없습니다. | User mode는 kernel 프로그램에 접근해야 하며, 직접 접근할 수 없습니다. |
Mode bit value | Kernel mode의 모드 비트 값은 0입니다. | User mode의 모드 비트 값은 1입니다. |
Memory References | Kernel mode에서는 두 메모리 영역을 모두 참조할 수 있습니다. | User mode에서는 User mode에 할당된 메모리만 참조할 수 있습니다. |
System Crash | Kernel mode에서 시스템 크래시는 심각하며 상황을 더욱 복잡하게 만듭니다. | User mode에서 시스템 크래시는 단순히 세션을 재개함으로써 복구될 수 있습니다. |
Access | 이 모드에서는 필수 기능만 작동할 수 있습니다. | User 프로그램은 이 모드에서 접근하고 실행할 수 있습니다. |
Functionality | Kernel mode는 시스템의 모든 메모리 블록을 참조할 수 있으며, CPU에게 명령 실행을 지시할 수 있어 매우 강력하고 중요한 모드입니다. | User mode는 표준 및 일반적인 보기 모드로, 정보는 스스로 실행되거나 메모리 블록을 참조할 수 없으며, 이를 위해 API(Application Protocol Interface)가 필요합니다. |
출처: GeeksforGeeks - Difference between User Mode and Kernel Mode