Definition of a Process and its States
Process States Model
Process Control Block
Process Context
Process Control : Creation
Process Control : Process Switch
Process Control : Termination, Communication
Definition of a Process and its States
What is a Process?
Definition
A program in execution-실행 중인 프로그램. exe는 실행가능한 프로그램일 뿐. 클릭해서 실행시켜야 프로세스가 만들어짐.
An instance of a program running on a computer 컴퓨터에서 실행 중인 프로그램의 변수.
The entity that can be assigned to and executed on a processor 프로세서에서 할당되고 실행될 수 있는 엔티티.
특징
the execution of a sequence of instructions, 인스트럭션들의 연속들로 구성되어 실행
a current state, and 현상태
an associated set of system instructions 시스템 인스트럭션들에 대한 관련 집합.
Consists of 3 components -> 실행가능한 프로그램, 데이터, 콘텍스트로 구성되어 있다.
An executable program (code, or text)
Data used in the program
Execution context of the program
Process States
Trace of process : sequence of instruction that execute for a process-> 프로세스에 대해 실행되는 명령어 시퀀스
Dispatcher (a kernel function) switches the processor from one process to another : 프로세스에 cpu를 배정하고 실행하게끔 한다.
Two-State Process Model
: Running or Not Running.
Reasons for Process Creation 프로세스들이 생성되는 이유.
Created by OS to provide a service (운영 체제는 사용자가 기다릴 필요 없이(예: 인쇄 제어 프로세스) 사용자 프로그램을 대신하여 기능을 수행하는 프로세스를 만들 수 있습니다.)
Created by an existing process -> 유저 프로그램이 os에 자식 프로세스를 만들어달라고 요청할 수 있습니다.
Created by user command -> foreground 혹은 backgrond 모드로 프로그램이 실행됩니다.
Reasons for Process Termination 프로세스가 종료되는 이유.
Normal completion->마지막 instruction까지 정상적으로 실행되고 종료.
Protection error -> 프로세스가 접근해서는 안되는 메모리나 프로세스 등에 접근할 때.
Parent request -> 부모 프로세스의 요청에 의해서.
Arithmetic error, I/O failure, Invalid instruction, etc.
Process States Model
Not-running Processes
Ready state
-Ready to execute
-Waiting for the processor to dispatch
Blocked state (= wait state, sleep state) : cpu를 줘도 실행 못할 상태일 수 있다. 막무가내로 오래 기다렸으니 주는 것은 없다.
- Waiting for some event to occur (e.g. I/O completion)
Five-State Process Model
레디 상태에서, 스케쥴러가 하나를 골라 러닝 상태로 보냅니다. 이를 디스패치라고 합니다. 러닝 상태의 프로세스는 인스트럭션을 처리합니다. 러닝 상태에서 타임아웃이 되면, 타임 슬라이스가 다 되었다는 뜻으로 레디 상태로 돌아갑니다. 러닝에서 블록으로 간다면, 입출력을 해야 할 때 보내며, 끝날 때까지 블록 상태로 두는데, 여기서 깨어나면 레디로 들어갑니다. 프로세스가 할 일 다 끝내고 exit kill을 하면 좀비상태로 넘어갑니다.
멀티 블록 큐에서는 큐를 이벤트 종류에 따라 따로 줍니다. 이렇게 나누게 되면 운영체제의 실행 능력이 빨라집니다.
Suspended Processes 보조 기억장치로 옮기고, 입출력이 끝날 때까지 기다리라고 하는 상태.
A process becomes suspend state when it is swapped to disk 프로세스가 디스크로 넘어가면 서스펜디드 상태가 됩니다. [빈 공간을 확보하기 위해] 보조 기억장치로 넘어갑니다.
- User context of a process is moved from main memory to hard disk : 프로세스의 사용자 컨텍스트가 기본 메모리에서 하드 디스크로 이동됩니다
Two new states
Blocked/Suspend (suspended block): blocked state in hard disk 이미 메인메모리에서 블록된 상태로 있던 프로세스.
Ready/Suspend (suspended ready) : ready state in hard disk
'CSE > 운영체제(OS)' 카테고리의 다른 글
1. Operating System Overview-Timesharing (0) | 2023.04.17 |
---|---|
Operating System Overview-Uni-programming, Multi-programming (1) | 2023.04.16 |
댓글