Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

90 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Process-Scheduling-Simulator-API

image

시연 영상

Details

Youtube

GIF

Screen-Recording-2023-05-12-at-11 49 29-PM

'프로세스 스케줄링' 이란?

Details
  • Process 스케줄링은 multi-tasking system에서 여러 프로세스들에 프로세서 할당(dispatch) 순서를 결정하는 작업입니다.
  • 목적은 성능 향상에 있습니다.
  • 성능 지표는 굉장히 많은 종류가 있으며, 대표적인 지표는 다음과 같습니다.
    • mean response time (평균 응답 시간)
    • throughput (단위 시간당 처리량)
    • resource utilization (단위 시간당 자원 활용도)

기본 알고리즘

FCFS, RR, SPN, SRTN, HRRN

Details
  • 도착한 순서대로 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • Batch system에 적합
    • 빠른 응답시간보다는 작업 처리에 대한 성능이 더 중요하기 때문
  • time-sharing(interactive) system에 부적합
  • 장점
    • resource utilization이 높음
      • 불필요한 스케줄링(context switching)이 이루어지지 않아 프로세서가 지속적으로 작업을 수행할 수 있기 때문
  • 단점
    • convoy effect가 발생
      • burst time이 긴 프로세스에 의해 다른 프로세스들의 대기시간이 길어지는 현상
    • 평균 respone time이 김
      • convoy effect가 원인
  • 도착한 순서대로 프로세스를 dispatch 하되, 프로세서 사용 제한 시간(time quantum) 이 존재
  • Preemptive 알고리즘
image
  • running 상태의 프로세스중 time quantum이 만료된 프로세스가 있고, ready 상태의 프로세스가 있다면 선점
  • 장점
    • time-sharing(interavtive) system에 적합
    • 특정 프로세스들의 자원 독점을 방지
  • 단점
    • 잦은 context switching으로 인해 overhead가 큼
  • time quantum이 시스템 성능을 결정 짓는 핵심 요소
    • very large(infinite) time quantum -> FCFS
    • very small time quantum -> processor sharing
      • 사용자는 모든 프로세스가 각각의 프로세서 위에서 실행되는 것처럼 느끼게 됨
      • (프로세서의 작업 수행 체감 속도) = (프로세서의 실제 작업 속도 * 프로세서의 개수)
  • burst time이 가장 작은 프로세스를 dispatch
  • Non-preemptive 알고리즘
image
  • 장점
    • 프로세스들의 평균 waiting time과 response time이 짧음
    • 시스템 내 프로세스들의 수를 최소화
      • 스케줄링 overhead가 감소하고, 메모리 절약을 할 수 있어 시스템의 효율을 향상시킴
  • 단점
    • burst time이 상대적으로 긴 프로세스는 starvation 현상이 발생할 수 있음
    • burst time을 예측하기 어려움
      • 예측하기 위한 기법이 필요
  • SPN을 preemptive 방식으로 변형한 알고리즘
  • 잔여 burst time이 running 프로세스보다 더 적은 ready 상태의 프로세스가 있다면 선점
image
  • 장점
    • SPN의 장점을 극대화
  • 단점
    • 잔여 burst time을 계속해서 추적해야 하는 overhead
    • 잦은 context switching으로 인한 overhead
  • 위 단점으로 인해 구현 및 사용이 비현실적
  • SPN + Aging concept을 적용한 알고리즘
  • Non-preemptive 알고리즘
  • Aging concept
    • 프로세스의 waiting time을 고려하여 우선순위 설정
    • response ratio가 가장 높은 프로세스가 가장 우선순위가 높음
      • response ratio: (WT + BT) / BT
image
  • 장점
    • SPN의 장점을 취하면서도 starvation을 방지함
  • 단점
    • ready 상태 프로세스들의 우선순위를 지속적으로 업데이트 필요
    • burst time 예측 기법 필요

알고리즘 구현 Flow chart

FCFS

FCFS (First-Come-First-Service)

image

RR

RR (Round-Robin)

image

SPN

SPN (Shortest-Process-Next)

image

SRTN

SRTN (Shortest-Remaining-Time-Next)

image

HRRN

HRRN (High-Response-Ratio-Next)

image

말년병장

말년병장

image

API 명세

Request

POST /schedule

HTTP Body

Processes

  • 1 <= processes.size() <= 99
  • 프로세스별 property
    • name
    • arrivalTime
    • workload

Processors

  • 1 <= processors.size() <= 15
  • 프로세서별 property
    • name
    • core

Algorithm

  • 다음 중 택 1
    • FCFS
    • RR
    • SPN
    • SRTN
    • HRRN
    • MN

Time quantum

  • Round-Robin 알고리즘에서의 프로세스 실행 제한 시간

Request JSON Example

{
"processes": [
{
"name": "p1",
"arrivalTime": 0,
"workload": 9
},
{
"name": "p2",
"arrivalTime": 1,
"workload": 8
},
{
"name": "p3",
"arrivalTime": 3,
"workload": 11
},
{
"name": "p4",
"arrivalTime": 4,
"workload": 7
},
{
"name": "p5",
"arrivalTime": 5,
"workload": 12
}
],
"processors": [
{
"name": "Core1",
"core": "E"
}
],
"algorithm": "RR",
"timeQuantum": 2
}
Response

HTTP Body

  • 시간 구간(n ~ n + 1초)별 상태

from

  • start time (n)

to

  • end time (n + 1)

Pairs

  • [프로세스, 프로세서] pair 리스트
    • 프로세서가 해당 프르세스에 할당되었다는 의미
  • pair별 property
    • processorName
    • processName

ProcessorPowerConsumptions

  • 프로세서별 누적 전력 소비량
  • 프로세서 누적 전력 소비량별 property
    • processorName
    • totalPowerConsumption

TotalPowerConsumption

  • 모든 프로세서의 누적 전력 소비량 합

Ready queue

  • 현재 ready queue 상태 (프로세스 리스트)
  • 우선순위순 (앞에서부터)

Terminated Processes

  • 해당 시간에 종료된 프로세스 리스트
  • 프로세스별 property
    • name
    • arrivalTime
    • burstTime
    • waitingTime
    • turnaroundTime
    • normalizedTurnaroundTime

Response JSON Example

{
"statuses": [
{
"from": 0,
"to": 1,
"pairs": [
{
"processorName": "Core1",
"processName": "p1"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 1.1
}
],
"totalPowerConsumption": 1.1,
"readyQueue": [],
"terminatedProcesses": []
},
...skip...
{
"from": 6,
"to": 7,
"pairs": [
{
"processorName": "Core1",
"processName": "p3"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 7.4
}
],
"totalPowerConsumption": 7.4,
"readyQueue": [
"p2",
"p4",
"p5"
],
"terminatedProcesses": []
},
...skip...
{
"from": 19,
"to": 20,
"pairs": [
{
"processorName": "Core1",
"processName": "p4"
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2"readyQueue": [],
"terminatedProcesses": [
{
"name": "p2",
"arrivalTime": 1,
"burstTime": 7,
"waitingTime": 11,
"turnaroundTime": 18,
"normalizedTurnaroundTime": 2.57
}
]
},
{
"from": 20,
"to": 21,
"pairs": [
{
"processorName": "Core1",
"processName": null
}
],
"processorPowerConsumptions": [
{
"processorName": "Core1",
"totalPowerConsumption": 21.2
}
],
"totalPowerConsumption": 21.2,
"readyQueue": [],
"terminatedProcesses": [
{
"name": "p4",
"arrivalTime": 5,
"burstTime": 5,
"waitingTime": 10,
"turnaroundTime": 15,
"normalizedTurnaroundTime": 3.0
}
]
}
]
}

클래스 다이어그램

Details

image

domain diagram

사용 기술

Details
  • Language
    • Java 11
  • Framework
    • Spring Boot 2.7.12
  • Build tool
    • Maven
  • Infra
    • AWS EC2
    • Nginx

About

프로세스 스케줄링 알고리즘 API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages